openpoints 0.1.0__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.
Files changed (184) hide show
  1. openpoints/__init__.py +3 -0
  2. openpoints/cpp/__init__.py +6 -0
  3. openpoints/cpp/chamfer_dist/__init__.py +110 -0
  4. openpoints/cpp/chamfer_dist/setup.py +19 -0
  5. openpoints/cpp/chamfer_dist/test.py +34 -0
  6. openpoints/cpp/emd/__init__.py +3 -0
  7. openpoints/cpp/emd/emd.py +88 -0
  8. openpoints/cpp/emd/setup.py +27 -0
  9. openpoints/cpp/emd/test_emd_loss.py +45 -0
  10. openpoints/cpp/pointnet2_batch/__init__.py +24 -0
  11. openpoints/cpp/pointnet2_batch/setup.py +23 -0
  12. openpoints/cpp/pointops/__init__.py +0 -0
  13. openpoints/cpp/pointops/functions/__init__.py +0 -0
  14. openpoints/cpp/pointops/functions/pointops.py +314 -0
  15. openpoints/cpp/pointops/setup.py +37 -0
  16. openpoints/cpp/pointops/src/__init__.py +0 -0
  17. openpoints/dataset/__init__.py +10 -0
  18. openpoints/dataset/atom3d/__init__.py +1 -0
  19. openpoints/dataset/atom3d/psr.py +38 -0
  20. openpoints/dataset/build.py +98 -0
  21. openpoints/dataset/data_util.py +192 -0
  22. openpoints/dataset/datalist.py +67 -0
  23. openpoints/dataset/dataset_base.py +96 -0
  24. openpoints/dataset/graph_dataset/__init__.py +3 -0
  25. openpoints/dataset/graph_dataset/graph_dataset.py +93 -0
  26. openpoints/dataset/graph_dataset/stack_with_pad.py +91 -0
  27. openpoints/dataset/graph_dataset/structural_dataset.py +73 -0
  28. openpoints/dataset/graph_dataset/svd_encodings_dataset.py +110 -0
  29. openpoints/dataset/grid_sample.py +21 -0
  30. openpoints/dataset/matterport3d/__init__.py +1 -0
  31. openpoints/dataset/matterport3d/category_mapping.tsv +1660 -0
  32. openpoints/dataset/matterport3d/matterport3d.py +210 -0
  33. openpoints/dataset/matterport3d/matterport3d_dataprocessing.py +105 -0
  34. openpoints/dataset/modelnet/__init__.py +3 -0
  35. openpoints/dataset/modelnet/modelnet40_normal_resampled_loader.py +124 -0
  36. openpoints/dataset/modelnet/modelnet40_ply_2048_loader.py +160 -0
  37. openpoints/dataset/molhiv/__init__.py +1 -0
  38. openpoints/dataset/molhiv/data.py +59 -0
  39. openpoints/dataset/molpcba/__init__.py +1 -0
  40. openpoints/dataset/molpcba/data.py +59 -0
  41. openpoints/dataset/parsers/__init__.py +1 -0
  42. openpoints/dataset/parsers/class_map.py +19 -0
  43. openpoints/dataset/parsers/constants.py +1 -0
  44. openpoints/dataset/parsers/parser.py +17 -0
  45. openpoints/dataset/parsers/parser_factory.py +29 -0
  46. openpoints/dataset/parsers/parser_image_folder.py +69 -0
  47. openpoints/dataset/parsers/parser_image_in_tar.py +222 -0
  48. openpoints/dataset/parsers/parser_image_tar.py +72 -0
  49. openpoints/dataset/parsers/parser_tfds.py +297 -0
  50. openpoints/dataset/pcqm4m/__init__.py +1 -0
  51. openpoints/dataset/pcqm4m/data.py +62 -0
  52. openpoints/dataset/pcqm4mv2/__init__.py +1 -0
  53. openpoints/dataset/pcqm4mv2/data.py +87 -0
  54. openpoints/dataset/s3dis/__init__.py +2 -0
  55. openpoints/dataset/s3dis/s3dis.py +156 -0
  56. openpoints/dataset/s3dis/s3dis_block.py +96 -0
  57. openpoints/dataset/s3dis/s3dis_sphere.py +349 -0
  58. openpoints/dataset/scannetv2/__init__.py +1 -0
  59. openpoints/dataset/scannetv2/scannet.py +176 -0
  60. openpoints/dataset/scanobjectnn/__init__.py +3 -0
  61. openpoints/dataset/scanobjectnn/scanobjectnn.py +110 -0
  62. openpoints/dataset/semantic_kitti/__init__.py +1 -0
  63. openpoints/dataset/semantic_kitti/helper_tool.py +286 -0
  64. openpoints/dataset/semantic_kitti/label_mapping.yaml +211 -0
  65. openpoints/dataset/semantic_kitti/semantickitti.py +229 -0
  66. openpoints/dataset/semantic_kitti/utils/meta/anno_paths.txt +272 -0
  67. openpoints/dataset/semantic_kitti/utils/meta/class_names.txt +13 -0
  68. openpoints/dataset/semantic_kitti/utils/semantic-kitti.yaml +211 -0
  69. openpoints/dataset/shapenet/__init__.py +1 -0
  70. openpoints/dataset/shapenet/shapenet55.py +76 -0
  71. openpoints/dataset/shapenet/shapenetpart.py +121 -0
  72. openpoints/dataset/shapenetpart/__init__.py +1 -0
  73. openpoints/dataset/shapenetpart/shapenet55.py +75 -0
  74. openpoints/dataset/shapenetpart/shapenetpart.py +388 -0
  75. openpoints/dataset/vis2d.py +17 -0
  76. openpoints/dataset/vis3d.py +153 -0
  77. openpoints/loss/__init__.py +3 -0
  78. openpoints/loss/build.py +281 -0
  79. openpoints/loss/cross_entropy.py +38 -0
  80. openpoints/loss/distill_loss.py +76 -0
  81. openpoints/models/__init__.py +10 -0
  82. openpoints/models/backbone/Stratified_transformer.py +558 -0
  83. openpoints/models/backbone/__init__.py +11 -0
  84. openpoints/models/backbone/baafnet.py +527 -0
  85. openpoints/models/backbone/ball_dgcnn.py +123 -0
  86. openpoints/models/backbone/curvenet.py +793 -0
  87. openpoints/models/backbone/debug_invvit.py +114 -0
  88. openpoints/models/backbone/deepgcn.py +143 -0
  89. openpoints/models/backbone/dgcnn.py +119 -0
  90. openpoints/models/backbone/graphvit3d.py +134 -0
  91. openpoints/models/backbone/grouppointnet.py +100 -0
  92. openpoints/models/backbone/pct.py +163 -0
  93. openpoints/models/backbone/pointmlp.py +417 -0
  94. openpoints/models/backbone/pointnet.py +199 -0
  95. openpoints/models/backbone/pointnetv2.py +511 -0
  96. openpoints/models/backbone/pointnext.py +663 -0
  97. openpoints/models/backbone/pointnextPyG.py +555 -0
  98. openpoints/models/backbone/pointtransformer.py +293 -0
  99. openpoints/models/backbone/pointvector.py +853 -0
  100. openpoints/models/backbone/pointvit.py +392 -0
  101. openpoints/models/backbone/pointvit_inv.py +942 -0
  102. openpoints/models/backbone/pointvit_inv_old.py +784 -0
  103. openpoints/models/backbone/randlenet.py +318 -0
  104. openpoints/models/backbone/resnet.py +342 -0
  105. openpoints/models/backbone/simpleview.py +153 -0
  106. openpoints/models/backbone/simpleview_util.py +292 -0
  107. openpoints/models/build.py +13 -0
  108. openpoints/models/classification/__init__.py +5 -0
  109. openpoints/models/classification/cls_base.py +136 -0
  110. openpoints/models/classification/point_bert.py +154 -0
  111. openpoints/models/layers/__init__.py +14 -0
  112. openpoints/models/layers/activation.py +57 -0
  113. openpoints/models/layers/attention.py +103 -0
  114. openpoints/models/layers/conv.py +167 -0
  115. openpoints/models/layers/drop.py +164 -0
  116. openpoints/models/layers/graph_conv.py +122 -0
  117. openpoints/models/layers/group.py +415 -0
  118. openpoints/models/layers/group_embed.py +286 -0
  119. openpoints/models/layers/helpers.py +43 -0
  120. openpoints/models/layers/kmeans.py +119 -0
  121. openpoints/models/layers/knn.py +110 -0
  122. openpoints/models/layers/local_aggregation.py +286 -0
  123. openpoints/models/layers/mlp.py +129 -0
  124. openpoints/models/layers/norm.py +106 -0
  125. openpoints/models/layers/padding.py +56 -0
  126. openpoints/models/layers/patch_embed.py +37 -0
  127. openpoints/models/layers/registry.py +168 -0
  128. openpoints/models/layers/subsample.py +185 -0
  129. openpoints/models/layers/upsampling.py +106 -0
  130. openpoints/models/layers/weight_init.py +89 -0
  131. openpoints/models/reconstruction/__init__.py +8 -0
  132. openpoints/models/reconstruction/base_recontruct.py +216 -0
  133. openpoints/models/reconstruction/maskedpoint.py +116 -0
  134. openpoints/models/reconstruction/maskedpointgroup.py +168 -0
  135. openpoints/models/reconstruction/maskedpointvit.py +253 -0
  136. openpoints/models/reconstruction/nodeshuffle.py +11 -0
  137. openpoints/models/registry.py +149 -0
  138. openpoints/models/segmentation/__init__.py +6 -0
  139. openpoints/models/segmentation/base_seg.py +278 -0
  140. openpoints/models/segmentation/vit_seg.py +126 -0
  141. openpoints/optim/__init__.py +15 -0
  142. openpoints/optim/adabelief.py +201 -0
  143. openpoints/optim/adafactor.py +167 -0
  144. openpoints/optim/adahessian.py +156 -0
  145. openpoints/optim/adamp.py +105 -0
  146. openpoints/optim/adamw.py +122 -0
  147. openpoints/optim/lamb.py +192 -0
  148. openpoints/optim/lars.py +135 -0
  149. openpoints/optim/lookahead.py +61 -0
  150. openpoints/optim/madgrad.py +184 -0
  151. openpoints/optim/nadam.py +92 -0
  152. openpoints/optim/nvnovograd.py +120 -0
  153. openpoints/optim/optim_factory.py +306 -0
  154. openpoints/optim/radam.py +89 -0
  155. openpoints/optim/rmsprop_tf.py +139 -0
  156. openpoints/optim/sgdp.py +70 -0
  157. openpoints/scheduler/__init__.py +8 -0
  158. openpoints/scheduler/cosine_lr.py +124 -0
  159. openpoints/scheduler/multistep_lr.py +65 -0
  160. openpoints/scheduler/plateau_lr.py +113 -0
  161. openpoints/scheduler/poly_lr.py +116 -0
  162. openpoints/scheduler/scheduler.py +110 -0
  163. openpoints/scheduler/scheduler_factory.py +118 -0
  164. openpoints/scheduler/step_lr.py +65 -0
  165. openpoints/scheduler/tanh_lr.py +117 -0
  166. openpoints/transforms/__init__.py +7 -0
  167. openpoints/transforms/point_transform_cpu.py +332 -0
  168. openpoints/transforms/point_transformer_gpu.py +764 -0
  169. openpoints/transforms/transforms_factory.py +60 -0
  170. openpoints/utils/__init__.py +8 -0
  171. openpoints/utils/ckpt_util.py +438 -0
  172. openpoints/utils/config.py +113 -0
  173. openpoints/utils/dist_utils.py +54 -0
  174. openpoints/utils/logger.py +170 -0
  175. openpoints/utils/metrics.py +311 -0
  176. openpoints/utils/random.py +16 -0
  177. openpoints/utils/registry.py +294 -0
  178. openpoints/utils/str2bool.py +11 -0
  179. openpoints/utils/wandb.py +88 -0
  180. openpoints-0.1.0.dist-info/METADATA +150 -0
  181. openpoints-0.1.0.dist-info/RECORD +184 -0
  182. openpoints-0.1.0.dist-info/WHEEL +5 -0
  183. openpoints-0.1.0.dist-info/licenses/LICENSE +21 -0
  184. openpoints-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,294 @@
1
+ # Acknowledgement: built upon mmcv
2
+ import inspect
3
+ import warnings
4
+ from functools import partial
5
+ import copy
6
+
7
+
8
+ class Registry:
9
+ """A registry to map strings to classes.
10
+ Registered object could be built from registry.
11
+ Example:
12
+ >>> MODELS = Registry('models')
13
+ >>> @MODELS.register_module()
14
+ >>> class ResNet:
15
+ >>> pass
16
+ >>> resnet = MODELS.build(dict(NAME='ResNet'))
17
+ Please refer to https://mmcv.readthedocs.io/en/latest/registry.html for
18
+ advanced useage.
19
+ Args:
20
+ name (str): Registry name.
21
+ build_func(func, optional): Build function to construct instance from
22
+ Registry, func:`build_from_cfg` is used if neither ``parent`` or
23
+ ``build_func`` is specified. If ``parent`` is specified and
24
+ ``build_func`` is not given, ``build_func`` will be inherited
25
+ from ``parent``. Default: None.
26
+ parent (Registry, optional): Parent registry. The class registered in
27
+ children registry could be built from parent. Default: None.
28
+ scope (str, optional): The scope of registry. It is the key to search
29
+ for children registry. If not specified, scope will be the name of
30
+ the package where class is defined, e.g. mmdet, mmcls, mmseg.
31
+ Default: None.
32
+ """
33
+
34
+ def __init__(self, name, build_func=None, parent=None, scope=None):
35
+ self._name = name
36
+ self._module_dict = dict()
37
+ self._children = dict()
38
+ self._scope = self.infer_scope() if scope is None else scope
39
+
40
+ # self.build_func will be set with the following priority:
41
+ # 1. build_func
42
+ # 2. parent.build_func
43
+ # 3. build_from_cfg
44
+ if build_func is None:
45
+ if parent is not None:
46
+ self.build_func = parent.build_func
47
+ else:
48
+ self.build_func = build_from_cfg
49
+ else:
50
+ self.build_func = build_func
51
+ if parent is not None:
52
+ assert isinstance(parent, Registry)
53
+ parent._add_children(self)
54
+ self.parent = parent
55
+ else:
56
+ self.parent = None
57
+
58
+ def __len__(self):
59
+ return len(self._module_dict)
60
+
61
+ def __contains__(self, key):
62
+ return self.get(key) is not None
63
+
64
+ def __repr__(self):
65
+ format_str = self.__class__.__name__ + \
66
+ f'(name={self._name}, ' \
67
+ f'items={self._module_dict})'
68
+ return format_str
69
+
70
+ @staticmethod
71
+ def infer_scope():
72
+ """Infer the scope of registry.
73
+ The name of the package where registry is defined will be returned.
74
+ Example:
75
+ # in mmdet/models/backbone/resnet.py
76
+ >>> MODELS = Registry('models')
77
+ >>> @MODELS.register_module()
78
+ >>> class ResNet:
79
+ >>> pass
80
+ The scope of ``ResNet`` will be ``mmdet``.
81
+ Returns:
82
+ scope (str): The inferred scope name.
83
+ """
84
+ # inspect.stack() trace where this function is called, the index-2
85
+ # indicates the frame where `infer_scope()` is called
86
+ filename = inspect.getmodule(inspect.stack()[2][0]).__name__
87
+ split_filename = filename.split('.')
88
+ return split_filename[0]
89
+
90
+ @staticmethod
91
+ def split_scope_key(key):
92
+ """Split scope and key.
93
+ The first scope will be split from key.
94
+ Examples:
95
+ >>> Registry.split_scope_key('mmdet.ResNet')
96
+ 'mmdet', 'ResNet'
97
+ >>> Registry.split_scope_key('ResNet')
98
+ None, 'ResNet'
99
+ Return:
100
+ scope (str, None): The first scope.
101
+ key (str): The remaining key.
102
+ """
103
+ split_index = key.find('.')
104
+ if split_index != -1:
105
+ return key[:split_index], key[split_index + 1:]
106
+ else:
107
+ return None, key
108
+
109
+ @property
110
+ def name(self):
111
+ return self._name
112
+
113
+ @property
114
+ def scope(self):
115
+ return self._scope
116
+
117
+ @property
118
+ def module_dict(self):
119
+ return self._module_dict
120
+
121
+ @property
122
+ def children(self):
123
+ return self._children
124
+
125
+ def get(self, key):
126
+ """Get the registry record.
127
+ Args:
128
+ key (str): The class name in string format.
129
+ Returns:
130
+ class: The corresponding class.
131
+ """
132
+ scope, real_key = self.split_scope_key(key)
133
+ if scope is None or scope == self._scope:
134
+ # get from self
135
+ if real_key in self._module_dict:
136
+ return self._module_dict[real_key]
137
+ else:
138
+ # get from self._children
139
+ if scope in self._children:
140
+ return self._children[scope].get(real_key)
141
+ else:
142
+ # goto root
143
+ parent = self.parent
144
+ while parent.parent is not None:
145
+ parent = parent.parent
146
+ return parent.get(key)
147
+
148
+ def build(self, *args, **kwargs):
149
+ return self.build_func(*args, **kwargs, registry=self)
150
+
151
+ def _add_children(self, registry):
152
+ """Add children for a registry.
153
+ The ``registry`` will be added as children based on its scope.
154
+ The parent registry could build objects from children registry.
155
+ Example:
156
+ >>> models = Registry('models')
157
+ >>> mmdet_models = Registry('models', parent=models)
158
+ >>> @mmdet_models.register_module()
159
+ >>> class ResNet:
160
+ >>> pass
161
+ >>> resnet = models.build(dict(NAME='mmdet.ResNet'))
162
+ """
163
+
164
+ assert isinstance(registry, Registry)
165
+ assert registry.scope is not None
166
+ assert registry.scope not in self.children, \
167
+ f'scope {registry.scope} exists in {self.name} registry'
168
+ self.children[registry.scope] = registry
169
+
170
+ def _register_module(self, module_class, module_name=None, force=False):
171
+ if not inspect.isclass(module_class):
172
+ raise TypeError('module must be a class, '
173
+ f'but got {type(module_class)}')
174
+
175
+ if module_name is None:
176
+ module_name = module_class.__name__
177
+ if isinstance(module_name, str):
178
+ module_name = [module_name]
179
+ for name in module_name:
180
+ if not force and name in self._module_dict:
181
+ raise KeyError(f'{name} is already registered '
182
+ f'in {self.name}')
183
+ self._module_dict[name] = module_class
184
+
185
+ def deprecated_register_module(self, cls=None, force=False):
186
+ warnings.warn(
187
+ 'The old API of register_module(module, force=False) '
188
+ 'is deprecated and will be removed, please use the new API '
189
+ 'register_module(name=None, force=False, module=None) instead.')
190
+ if cls is None:
191
+ return partial(self.deprecated_register_module, force=force)
192
+ self._register_module(cls, force=force)
193
+ return cls
194
+
195
+ def register_module(self, name=None, force=False, module=None):
196
+ """Register a module.
197
+ A record will be added to `self._module_dict`, whose key is the class
198
+ name or the specified name, and value is the class itself.
199
+ It can be used as a decorator or a normal function.
200
+ Example:
201
+ >>> backbones = Registry('backbone')
202
+ >>> @backbones.register_module()
203
+ >>> class ResNet:
204
+ >>> pass
205
+ >>> backbones = Registry('backbone')
206
+ >>> @backbones.register_module(name='mnet')
207
+ >>> class MobileNet:
208
+ >>> pass
209
+ >>> backbones = Registry('backbone')
210
+ >>> class ResNet:
211
+ >>> pass
212
+ >>> backbones.register_module(ResNet)
213
+ Args:
214
+ name (str | None): The module name to be registered. If not
215
+ specified, the class name will be used.
216
+ force (bool, optional): Whether to override an existing class with
217
+ the same name. Default: False.
218
+ module (type): Module class to be registered.
219
+ """
220
+ if not isinstance(force, bool):
221
+ raise TypeError(f'force must be a boolean, but got {type(force)}')
222
+ # NOTE: This is a walkaround to be compatible with the old api,
223
+ # while it may introduce unexpected bugs.
224
+ if isinstance(name, type):
225
+ return self.deprecated_register_module(name, force=force)
226
+
227
+ # raise the error ahead of time
228
+ if not (name is None or isinstance(name, str) or misc.is_seq_of(name, str)):
229
+ raise TypeError(
230
+ 'name must be either of None, an instance of str or a sequence'
231
+ f' of str, but got {type(name)}')
232
+
233
+ # use it as a normal method: x.register_module(module=SomeClass)
234
+ if module is not None:
235
+ self._register_module(
236
+ module_class=module, module_name=name, force=force)
237
+ return module
238
+
239
+ # use it as a decorator: @x.register_module()
240
+ def _register(cls):
241
+ self._register_module(
242
+ module_class=cls, module_name=name, force=force)
243
+ return cls
244
+
245
+ return _register
246
+
247
+
248
+ def build_from_cfg(cfg, registry, default_args=None):
249
+ """Build a module from config dict.
250
+ Args:
251
+ cfg (edict): Config dict. It should at least contain the key "NAME".
252
+ registry (:obj:`Registry`): The registry to search the type from.
253
+ Returns:
254
+ object: The constructed object.
255
+ """
256
+ if not isinstance(cfg, dict):
257
+ raise TypeError(f'cfg must be a dict, but got {type(cfg)}')
258
+ if 'NAME' not in cfg:
259
+ if default_args is None or 'NAME' not in default_args:
260
+ raise KeyError(
261
+ '`cfg` or `default_args` must contain the key "NAME", '
262
+ f'but got {cfg}\n{default_args}')
263
+ if not isinstance(registry, Registry):
264
+ raise TypeError('registry must be an mmcv.Registry object, '
265
+ f'but got {type(registry)}')
266
+
267
+ if not (isinstance(default_args, dict) or default_args is None):
268
+ raise TypeError('default_args must be a dict or None, '
269
+ f'but got {type(default_args)}')
270
+
271
+ # if default_args is not None:
272
+ # cfg = config.merge_new_config(cfg, default_args)
273
+
274
+ obj_type = cfg.get('NAME')
275
+
276
+ if isinstance(obj_type, str):
277
+ obj_cls = registry.get(obj_type)
278
+ if obj_cls is None:
279
+ raise KeyError(
280
+ f'{obj_type} is not in the {registry.name} registry')
281
+ elif inspect.isclass(obj_type):
282
+ obj_cls = obj_type
283
+ else:
284
+ raise TypeError(
285
+ f'type must be a str or valid type, but got {type(obj_type)}')
286
+ try:
287
+ obj_cfg = copy.deepcopy(cfg)
288
+ if default_args is not None:
289
+ obj_cfg.update(default_args)
290
+ obj_cfg.pop('NAME')
291
+ return obj_cls(**obj_cfg)
292
+ except Exception as e:
293
+ # Normal TypeError does not print class name.
294
+ raise type(e)(f'{obj_cls.__name__}: {e}')
@@ -0,0 +1,11 @@
1
+ import argparse
2
+
3
+ def str2bool(v):
4
+ if isinstance(v, bool):
5
+ return v
6
+ if v.lower() in ('yes', 'true', 't', 'y', '1'):
7
+ return True
8
+ elif v.lower() in ('no', 'false', 'f', 'n', '0'):
9
+ return False
10
+ else:
11
+ raise argparse.ArgumentTypeError('Boolean value expected.')
@@ -0,0 +1,88 @@
1
+ import shutil
2
+ import os
3
+ import subprocess
4
+
5
+
6
+ class WandbUrls:
7
+ def __init__(self, url):
8
+
9
+ hash = url.split("/")[-2]
10
+ project = url.split("/")[-3]
11
+ entity = url.split("/")[-4]
12
+
13
+ self.weight_url = url
14
+ self.log_url = "https://app.wandb.ai/{}/{}/runs/{}/logs".format(entity, project, hash)
15
+ self.chart_url = "https://app.wandb.ai/{}/{}/runs/{}".format(entity, project, hash)
16
+ self.overview_url = "https://app.wandb.ai/{}/{}/runs/{}/overview".format(entity, project, hash)
17
+ self.config_url = "https://app.wandb.ai/{}/{}/runs/{}/files/hydra-config.yaml".format(
18
+ entity, project, hash
19
+ )
20
+ self.overrides_url = "https://app.wandb.ai/{}/{}/runs/{}/files/overrides.yaml".format(entity, project, hash)
21
+
22
+ def __repr__(self):
23
+ msg = "=================================================== WANDB URLS ===================================================================\n"
24
+ for k, v in self.__dict__.items():
25
+ msg += "{}: {}\n".format(k.upper(), v)
26
+ msg += "=================================================================================================================================\n"
27
+ return msg
28
+
29
+
30
+ class Wandb:
31
+ IS_ACTIVE = False
32
+
33
+ @staticmethod
34
+ def set_urls_to_model(model, url):
35
+ wandb_urls = WandbUrls(url)
36
+ model.wandb = wandb_urls
37
+
38
+ @staticmethod
39
+ def _set_to_wandb_args(wandb_args, cfg, name):
40
+ var = getattr(cfg.wandb, name, None)
41
+ if var:
42
+ if name == 'name':
43
+ var = var[:64]
44
+ wandb_args[name] = var
45
+
46
+ @staticmethod
47
+ def launch(cfg, launch: bool):
48
+ if launch:
49
+ import wandb
50
+
51
+ Wandb.IS_ACTIVE = True
52
+
53
+ wandb_args = {}
54
+ wandb_args["resume"] = "allow"
55
+ Wandb._set_to_wandb_args(wandb_args, cfg, "tags")
56
+ Wandb._set_to_wandb_args(wandb_args, cfg, "project")
57
+ Wandb._set_to_wandb_args(wandb_args, cfg, "name")
58
+ Wandb._set_to_wandb_args(wandb_args, cfg, "entity")
59
+ Wandb._set_to_wandb_args(wandb_args, cfg, "notes")
60
+ Wandb._set_to_wandb_args(wandb_args, cfg, "config")
61
+ Wandb._set_to_wandb_args(wandb_args, cfg, "id")
62
+ print(wandb_args)
63
+
64
+ try:
65
+ commit_sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip()
66
+ gitdiff = subprocess.check_output(["git", "diff", "--", "':!notebooks'"]).decode()
67
+ except:
68
+ commit_sha = "n/a"
69
+ gitdiff = ""
70
+
71
+ config = wandb_args.get("config", {})
72
+ wandb_args["config"] = {
73
+ **config,
74
+ "run_path": os.getcwd(),
75
+ "commit": commit_sha,
76
+ "gitdiff": gitdiff
77
+ }
78
+ wandb.init(**wandb_args, sync_tensorboard=True)
79
+ wandb.save(os.path.join(os.getcwd(), cfg.cfg_path))
80
+
81
+ @staticmethod
82
+ def add_file(file_path: str):
83
+ if not Wandb.IS_ACTIVE:
84
+ raise RuntimeError("wandb is inactive, please launch first.")
85
+ import wandb
86
+
87
+ filename = os.path.basename(file_path)
88
+ shutil.copyfile(file_path, os.path.join(wandb.run.dir, filename))
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: openpoints
3
+ Version: 0.1.0
4
+ Summary: OpenPoints: point cloud understanding models, layers, datasets, transforms, optimizers, and training utilities.
5
+ Author: Guocheng Qian
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/guochengqian/openpoints
8
+ Project-URL: Repository, https://github.com/guochengqian/openpoints
9
+ Project-URL: Issues, https://github.com/guochengqian/PointNeXt/issues
10
+ Keywords: point cloud,deep learning,pytorch,3d vision,PointNeXt
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: torch>=1.10
25
+ Requires-Dist: numpy>=1.20
26
+ Requires-Dist: scipy>=1.7
27
+ Requires-Dist: PyYAML>=5.4
28
+ Requires-Dist: multimethod>=1.8
29
+ Requires-Dist: termcolor>=1.1
30
+ Requires-Dist: shortuuid>=1.0
31
+ Requires-Dist: scikit-learn>=1.0
32
+ Requires-Dist: tqdm>=4
33
+ Requires-Dist: easydict>=1.9
34
+ Requires-Dist: h5py>=3
35
+ Requires-Dist: pandas>=1.3
36
+ Requires-Dist: torchvision>=0.11
37
+ Provides-Extra: data
38
+ Requires-Dist: easydict>=1.9; extra == "data"
39
+ Requires-Dist: h5py>=3; extra == "data"
40
+ Requires-Dist: pandas>=1.3; extra == "data"
41
+ Requires-Dist: torchvision>=0.11; extra == "data"
42
+ Provides-Extra: viz
43
+ Requires-Dist: matplotlib>=3.5; extra == "viz"
44
+ Requires-Dist: pyvista>=0.38; extra == "viz"
45
+ Provides-Extra: graph
46
+ Requires-Dist: numba>=0.56; extra == "graph"
47
+ Requires-Dist: ogb>=1.3; extra == "graph"
48
+ Requires-Dist: atom3d>=0.2; extra == "graph"
49
+ Requires-Dist: fast-pytorch-kmeans>=0.1; extra == "graph"
50
+ Provides-Extra: tfds
51
+ Requires-Dist: Pillow>=8; extra == "tfds"
52
+ Requires-Dist: tensorflow>=2; extra == "tfds"
53
+ Requires-Dist: tensorflow-datasets>=4; extra == "tfds"
54
+ Provides-Extra: wandb
55
+ Requires-Dist: wandb>=0.13; extra == "wandb"
56
+ Provides-Extra: dev
57
+ Requires-Dist: build>=1; extra == "dev"
58
+ Requires-Dist: twine>=4; extra == "dev"
59
+ Requires-Dist: pytest>=7; extra == "dev"
60
+ Provides-Extra: all
61
+ Requires-Dist: easydict>=1.9; extra == "all"
62
+ Requires-Dist: h5py>=3; extra == "all"
63
+ Requires-Dist: pandas>=1.3; extra == "all"
64
+ Requires-Dist: torchvision>=0.11; extra == "all"
65
+ Requires-Dist: matplotlib>=3.5; extra == "all"
66
+ Requires-Dist: pyvista>=0.38; extra == "all"
67
+ Requires-Dist: numba>=0.56; extra == "all"
68
+ Requires-Dist: ogb>=1.3; extra == "all"
69
+ Requires-Dist: atom3d>=0.2; extra == "all"
70
+ Requires-Dist: fast-pytorch-kmeans>=0.1; extra == "all"
71
+ Requires-Dist: Pillow>=8; extra == "all"
72
+ Requires-Dist: tensorflow>=2; extra == "all"
73
+ Requires-Dist: tensorflow-datasets>=4; extra == "all"
74
+ Requires-Dist: wandb>=0.13; extra == "all"
75
+ Dynamic: license-file
76
+
77
+ # OpenPoints
78
+
79
+ OpenPoints is a library built for fairly benchmarking and easily reproducing point-based methods for point cloud understanding. It is born in the course of [PointNeXt](https://github.com/guochengqian/PointNeXt) project and is used as an engine therein.
80
+
81
+ **For any question related to OpenPoints, please open an issue in [PointNeXt](https://github.com/guochengqian/PointNeXt) repo.**
82
+
83
+ OpenPoints currently supports reproducing the following models:
84
+ - PointNet
85
+ - DGCNN
86
+ - DeepGCN
87
+ - PointNet++
88
+ - ASSANet
89
+ - PointMLP
90
+ - PointNeXt
91
+ - Pix4Point
92
+ - PointVector
93
+
94
+
95
+
96
+ ## Features
97
+
98
+ 1. **Extensibility**: supports many representative networks for point cloud understanding, such as *PointNet, DGCNN, DeepGCN, PointNet++, ASSANet, PointMLP*, and our ***PointNeXt***. More networks can be built easily based on our framework since **OpenPoints support a wide range of basic operations including graph convolutions, self-attention, farthest point sampling, ball query, *e.t.c***.
99
+
100
+ 2. **Ease of Use**: *Build* model, optimizer, scheduler, loss function, and data loader *easily from cfg*. Train and validate different models on various tasks by simply changing the `cfg\*\*.yaml` file.
101
+
102
+ ```
103
+ model = build_model_from_cfg(cfg.model)
104
+ criterion = build_criterion_from_cfg(cfg.criterion_args)
105
+ ```
106
+
107
+
108
+
109
+ ## Installation
110
+
111
+ OpenPoints can be installed as the `openpoints` Python package:
112
+
113
+ ```bash
114
+ pip install openpoints
115
+ ```
116
+
117
+ The PyPI package installs the Python library (`import openpoints`) and the files needed by the datasets and configs. CUDA/C++ operators such as `pointnet2_batch_cuda`, `pointops_cuda`, `chamfer`, and `emd_cuda` are still built from a source checkout or source distribution for now because PyTorch/CUDA wheels must match the user's Python, PyTorch, CUDA, and platform versions.
118
+
119
+ For full training/evaluation with CUDA ops, install from source after installing PyTorch:
120
+
121
+ ```bash
122
+ git clone --recursive https://github.com/guochengqian/openpoints.git
123
+ cd openpoints
124
+ pip install -e .[data,viz,wandb]
125
+ cd cpp/pointnet2_batch && python setup.py install && cd ../..
126
+ cd cpp/pointops && python setup.py install && cd ../..
127
+ cd cpp/chamfer_dist && python setup.py install && cd ../..
128
+ cd cpp/emd && python setup.py install && cd ../..
129
+ ```
130
+
131
+ If the `openpoints` name is unavailable on a package index mirror, the same code can be published as `openpoints-torch`; the import name remains `openpoints`.
132
+
133
+ ## Usage
134
+
135
+ OpenPoints serves as the engine for PointNeXt. Please refer to [PointNeXt](https://github.com/guochengqian/PointNeXt) for complete training, evaluation, and model-zoo examples.
136
+
137
+
138
+
139
+ ## Citation
140
+
141
+ If you use this library, please kindly acknowledge our work:
142
+ ```tex
143
+ @Article{qian2022pointnext,
144
+ author = {Qian, Guocheng and Li, Yuchen and Peng, Houwen and Mai, Jinjie and Hammoud, Hasan and Elhoseiny, Mohamed and Ghanem, Bernard},
145
+ title = {PointNeXt: Revisiting PointNet++ with Improved Training and Scaling Strategies},
146
+ journal = {arXiv:2206.04670},
147
+ year = {2022},
148
+ }
149
+ ```
150
+