ocnn 2.2.4__py3-none-any.whl → 2.2.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ocnn/__init__.py +1 -1
- ocnn/models/autoencoder.py +2 -1
- ocnn/models/ounet.py +1 -2
- ocnn/octree/octree.py +24 -3
- ocnn/octree/points.py +1 -1
- {ocnn-2.2.4.dist-info → ocnn-2.2.6.dist-info}/METADATA +33 -22
- {ocnn-2.2.4.dist-info → ocnn-2.2.6.dist-info}/RECORD +10 -10
- {ocnn-2.2.4.dist-info → ocnn-2.2.6.dist-info}/WHEEL +1 -1
- {ocnn-2.2.4.dist-info → ocnn-2.2.6.dist-info}/LICENSE +0 -0
- {ocnn-2.2.4.dist-info → ocnn-2.2.6.dist-info}/top_level.txt +0 -0
ocnn/__init__.py
CHANGED
ocnn/models/autoencoder.py
CHANGED
|
@@ -33,8 +33,9 @@ class AutoEncoder(torch.nn.Module):
|
|
|
33
33
|
self.full_depth = full_depth
|
|
34
34
|
self.feature = feature
|
|
35
35
|
self.resblk_num = 2
|
|
36
|
-
self.code_channel = 64 # dim-of-code = code_channel * 2**(3*full_depth)
|
|
37
36
|
self.channels = [512, 512, 256, 256, 128, 128, 32, 32, 16, 16]
|
|
37
|
+
# dim-of-code = code_channel * 2**(3*full_depth)
|
|
38
|
+
self.code_channel = self.channels[full_depth]
|
|
38
39
|
|
|
39
40
|
# encoder
|
|
40
41
|
self.conv1 = ocnn.modules.OctreeConvBnRelu(
|
ocnn/models/ounet.py
CHANGED
|
@@ -18,8 +18,7 @@ class OUNet(AutoEncoder):
|
|
|
18
18
|
|
|
19
19
|
def __init__(self, channel_in: int, channel_out: int, depth: int,
|
|
20
20
|
full_depth: int = 2, feature: str = 'ND'):
|
|
21
|
-
super().__init__(channel_in, channel_out, depth, full_depth, feature
|
|
22
|
-
code_channel=-1) # !set code_channe=-1
|
|
21
|
+
super().__init__(channel_in, channel_out, depth, full_depth, feature)
|
|
23
22
|
self.proj = None # remove this module used in AutoEncoder
|
|
24
23
|
|
|
25
24
|
def encoder(self, octree):
|
ocnn/octree/octree.py
CHANGED
|
@@ -35,7 +35,9 @@ class Octree:
|
|
|
35
35
|
and :obj:`points`, contain only non-empty nodes.
|
|
36
36
|
|
|
37
37
|
.. note::
|
|
38
|
-
The point cloud must be in range :obj:`[-1, 1]`.
|
|
38
|
+
The point cloud must be strictly in range :obj:`[-1, 1]`. A good practice
|
|
39
|
+
is to normalize it into :obj:`[-0.99, 0.99]` or :obj:`[0.9, 0.9]` to retain
|
|
40
|
+
some margin.
|
|
39
41
|
'''
|
|
40
42
|
|
|
41
43
|
def __init__(self, depth: int, full_depth: int = 2, batch_size: int = 1,
|
|
@@ -151,7 +153,9 @@ class Octree:
|
|
|
151
153
|
point_cloud (Points): The input point cloud.
|
|
152
154
|
|
|
153
155
|
.. note::
|
|
154
|
-
|
|
156
|
+
The point cloud must be strictly in range :obj:`[-1, 1]`. A good practice
|
|
157
|
+
is to normalize it into :obj:`[-0.99, 0.99]` or :obj:`[0.9, 0.9]` to retain
|
|
158
|
+
some margin.
|
|
155
159
|
'''
|
|
156
160
|
|
|
157
161
|
self.device = point_cloud.device
|
|
@@ -176,7 +180,7 @@ class Octree:
|
|
|
176
180
|
for d in range(self.depth, self.full_depth, -1):
|
|
177
181
|
# compute parent key, i.e. keys of layer (d -1)
|
|
178
182
|
pkey = node_key >> 3
|
|
179
|
-
pkey, pidx,
|
|
183
|
+
pkey, pidx, _ = torch.unique_consecutive(
|
|
180
184
|
pkey, return_inverse=True, return_counts=True)
|
|
181
185
|
|
|
182
186
|
# augmented key
|
|
@@ -287,6 +291,23 @@ class Octree:
|
|
|
287
291
|
update_neigh (bool): If True, construct the neighborhood indices.
|
|
288
292
|
'''
|
|
289
293
|
|
|
294
|
+
# increase the octree depth if required
|
|
295
|
+
if depth > self.depth:
|
|
296
|
+
assert depth == self.depth + 1
|
|
297
|
+
self.depth = depth
|
|
298
|
+
self.keys.append(None)
|
|
299
|
+
self.children.append(None)
|
|
300
|
+
self.neighs.append(None)
|
|
301
|
+
self.features.append(None)
|
|
302
|
+
self.normals.append(None)
|
|
303
|
+
self.points.append(None)
|
|
304
|
+
zero = torch.zeros(1, dtype=torch.long)
|
|
305
|
+
self.nnum = torch.cat([self.nnum, zero])
|
|
306
|
+
self.nnum_nempty = torch.cat([self.nnum_nempty, zero])
|
|
307
|
+
zero = zero.view(1, 1)
|
|
308
|
+
self.batch_nnum = torch.cat([self.batch_nnum, zero], dim=0)
|
|
309
|
+
self.batch_nnum_nempty = torch.cat([self.batch_nnum_nempty, zero], dim=0)
|
|
310
|
+
|
|
290
311
|
# node number
|
|
291
312
|
nnum = self.nnum_nempty[depth-1] * 8
|
|
292
313
|
self.nnum[depth] = nnum
|
ocnn/octree/points.py
CHANGED
|
@@ -63,9 +63,9 @@ class Points:
|
|
|
63
63
|
if self.batch_id is not None:
|
|
64
64
|
assert self.batch_id.dim() == 2 or self.batch_id.dim() == 1
|
|
65
65
|
assert self.batch_id.size(0) == self.points.size(0)
|
|
66
|
-
assert self.batch_id.size(1) == 1
|
|
67
66
|
if self.batch_id.dim() == 1:
|
|
68
67
|
self.batch_id = self.batch_id.unsqueeze(1)
|
|
68
|
+
assert self.batch_id.size(1) == 1
|
|
69
69
|
|
|
70
70
|
@property
|
|
71
71
|
def npt(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ocnn
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.6
|
|
4
4
|
Summary: Octree-based Sparse Convolutional Neural Networks
|
|
5
5
|
Home-page: https://github.com/octree-nn/ocnn-pytorch
|
|
6
6
|
Author: Peng-Shuai Wang
|
|
@@ -28,30 +28,41 @@ Requires-Dist: packaging
|
|
|
28
28
|
|
|
29
29
|
This repository contains the **pure PyTorch**-based implementation of
|
|
30
30
|
[O-CNN](https://wang-ps.github.io/O-CNN.html). The code has been tested with
|
|
31
|
-
`Pytorch>=1.6.0`, and `Pytorch>=1.9.0` is preferred.
|
|
31
|
+
`Pytorch>=1.6.0`, and `Pytorch>=1.9.0` is preferred. The *original*
|
|
32
|
+
implementation of O-CNN is based on C++ and CUDA and can be found
|
|
33
|
+
[here](https://github.com/Microsoft/O-CNN), which has received
|
|
34
|
+
[](https://github.com/microsoft/O-CNN) and
|
|
35
|
+
[](https://github.com/microsoft/O-CNN).
|
|
32
36
|
|
|
33
|
-
O-CNN is an octree-based sparse convolutional neural network framework for 3D
|
|
34
|
-
deep learning. O-CNN constrains the CNN storage and computation into non-empty
|
|
35
|
-
sparse voxels for efficiency and uses the `octree` data structure to organize
|
|
36
|
-
and index these sparse voxels.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
O-CNN is an octree-based 3D convolutional neural network framework for 3D data.
|
|
39
|
+
O-CNN constrains the CNN storage and computation into non-empty sparse voxels
|
|
40
|
+
for efficiency and uses the `octree` data structure to organize and index these
|
|
41
|
+
sparse voxels. Currently, this type of 3D convolution is known as Sparse
|
|
42
|
+
Convolution in the research community.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
The concept of Sparse Convolution in O-CNN is the same with
|
|
40
46
|
[SparseConvNet](https://openaccess.thecvf.com/content_cvpr_2018/papers/Graham_3D_Semantic_Segmentation_CVPR_2018_paper.pdf),
|
|
41
|
-
and
|
|
42
|
-
[
|
|
43
|
-
The key difference is that our O-CNN uses
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
[MinkowskiNet](https://github.com/NVIDIA/MinkowskiEngine), and
|
|
48
|
+
[SpConv](https://github.com/traveller59/spconv).
|
|
49
|
+
The key difference is that our O-CNN uses `octrees` to index the sparse voxels,
|
|
50
|
+
while these works use `Hash Tables`. However, I believe that `octrees` may be
|
|
51
|
+
the right choice for Sparse Convolution. With `octrees`, I can implement the
|
|
52
|
+
Sparse Convolution with pure PyTorch. More importantly, with `octrees`, I can
|
|
53
|
+
also build efficient transformers for 3D data --
|
|
54
|
+
[OctFormer](https://github.com/octree-nn/octformer), which is extremely hard
|
|
55
|
+
with `Hash Tables`.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Our O-CNN is published in SIGGRAPH 2017, SparseConvNet is published in CVPR
|
|
59
|
+
2018, and MinkowskiNet is published in CVPR 2019. Actually, our O-CNN was
|
|
60
|
+
submitted to SIGGRAPH in the end of 2016 and was officially accepted in March,
|
|
61
|
+
2017. <!-- The camera-ready version of our O-CNN was submitted to SIGGRAPH in April, 2018. -->
|
|
62
|
+
We just did not post our paper on Arxiv during the review process of SIGGRAPH.
|
|
63
|
+
Therefore, **the idea of constraining CNN computation into sparse non-emtpry
|
|
64
|
+
voxels, i.e. Sparse Convolution, is first proposed by our O-CNN**.
|
|
65
|
+
|
|
55
66
|
|
|
56
67
|
## Key benefits of ocnn-pytorch
|
|
57
68
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
ocnn/__init__.py,sha256=
|
|
1
|
+
ocnn/__init__.py,sha256=Vek3w8YFUUmHO2aGzIHBD_ZUeKzWyJxAPS0ZDK1bUUM,582
|
|
2
2
|
ocnn/dataset.py,sha256=wvclvjlZs9qTeMXWLaO32K5d1VVY9XHSNuVVJEpVeeo,5266
|
|
3
3
|
ocnn/utils.py,sha256=XhykveOjHoQd94gjJ5-opzXs-9MOCAzZ34ArZ8mG4sE,6726
|
|
4
4
|
ocnn/models/__init__.py,sha256=F9PJRhOPHc1OrwkqcfywEBW0J6jmVW7-IHgWjGpY15U,724
|
|
5
|
-
ocnn/models/autoencoder.py,sha256=
|
|
5
|
+
ocnn/models/autoencoder.py,sha256=nkKMtSPPdKhQXRxFaRNZsPjRfWuQet5Gz9FQlyLUlEQ,5904
|
|
6
6
|
ocnn/models/hrnet.py,sha256=9W2fi7Fuw0JXDBiZtEoUW2K7ghtpWUm_BWd-mKoHLY0,6684
|
|
7
7
|
ocnn/models/image2shape.py,sha256=5djcOHJh2SQCwd5XdLPeL5vlQDNWnRU3tJY3ojRI8aQ,4589
|
|
8
8
|
ocnn/models/lenet.py,sha256=ujVBxnn8AKiIKqB4WHxuK728oJe4TZdqZUTTNy8y3zE,1754
|
|
9
|
-
ocnn/models/ounet.py,sha256=
|
|
9
|
+
ocnn/models/ounet.py,sha256=Z9bJqt_C8uHNw5IzD7q2vR1CH5bMkOrtI0UWSyp74TU,3306
|
|
10
10
|
ocnn/models/resnet.py,sha256=_bRaLBYK5yVqklYEvfPjcndWvMpOKaygnSl1pyjT-4w,2029
|
|
11
11
|
ocnn/models/segnet.py,sha256=A3KWF-kJQ1M-ByJKv88wfMsdZYccBzP_p9W_0EzNB6w,2575
|
|
12
12
|
ocnn/models/unet.py,sha256=1FZbTvmWg6sMYkcZyNxcSr_qN6bfOOag-tIwAoqIPKU,4123
|
|
@@ -26,11 +26,11 @@ ocnn/nn/octree_norm.py,sha256=XrSQ7oZKfepYqQIuPU4loaYNae_rgtPpekR0cqTvryg,4524
|
|
|
26
26
|
ocnn/nn/octree_pad.py,sha256=suV6Ftb-UlUuoJzKdQ9DCP9oqVQJq7vXb9_6hq-kUk4,1323
|
|
27
27
|
ocnn/nn/octree_pool.py,sha256=Zn2XLk5SFl6pqMhhKIvu1uZl5ebonFSlPcKr54fOIPA,6664
|
|
28
28
|
ocnn/octree/__init__.py,sha256=vKZFc5_r6Gxg5KsPWiCZCR-umWWfWPoE7qBx4PIrUGA,630
|
|
29
|
-
ocnn/octree/octree.py,sha256=
|
|
30
|
-
ocnn/octree/points.py,sha256=
|
|
29
|
+
ocnn/octree/octree.py,sha256=uFv0nNR_lIh6SgpDjlj4lraRbUolo2_gdfGVvyP5RxA,24711
|
|
30
|
+
ocnn/octree/points.py,sha256=TLlUGdguTkLDRxuEhC-1ejik6thuAWX3L-UiONbPLeM,11355
|
|
31
31
|
ocnn/octree/shuffled_key.py,sha256=UJZ4eKNA_7nLbf9FbEvS_3VyrAqnZCOzk1hsPtJianM,3936
|
|
32
|
-
ocnn-2.2.
|
|
33
|
-
ocnn-2.2.
|
|
34
|
-
ocnn-2.2.
|
|
35
|
-
ocnn-2.2.
|
|
36
|
-
ocnn-2.2.
|
|
32
|
+
ocnn-2.2.6.dist-info/LICENSE,sha256=YeOS0Plo8Uistv_8ZXdgddmN9GHJKnIiJ5FZ8zTW6Sw,1114
|
|
33
|
+
ocnn-2.2.6.dist-info/METADATA,sha256=pMj-GJiTUtxvjtjhBLQcBMi1CXZlU3NBiQKxHiPJR8M,4382
|
|
34
|
+
ocnn-2.2.6.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
35
|
+
ocnn-2.2.6.dist-info/top_level.txt,sha256=ayZdVOnxlOke3kgzAlrRh2IEL_qOudwOaEU3xhjtpZ0,5
|
|
36
|
+
ocnn-2.2.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|