mit-han-lab / spvnas

[ECCV 2020] Searching Efficient 3D Architectures with Sparse Point-Voxel Convolution
http://spvnas.mit.edu/
MIT License
582 stars 109 forks source link

couldn't find methods, modules , functions etc #110

Closed antonyvan closed 1 year ago

antonyvan commented 1 year ago

Hi, I am reproducing your semantickitti result.

when I run the train.py. I got these issues as asked by this link [https://github.com/mit-han-lab/torchsparse/issues/219]

train.py # 65 F.set_conv_mode(2) => module 'torchsparse.nn.functional' has no attribute 'set_conv_mode'

core.models.utils.py # 9 from torchsparse.utils.tensor_cache import TensorCache there is no tensor_cache

core.models.utils.py # 38 hashmap = torchsparse.backend.GPUHashTable(hashmap_keys, hashmap_vals) => AttributeError: module 'torchsparse.backend' has no attribute 'GPUHashTable'

core.models.utils.py # 26 self._caches.idx_query = dict() => AttributeError: 'PointTensor' object has no attribute '_caches'

core.models.utils.py # 40, 41 make_tensor has no definitions.

I have downloaded all torchsparse source codes: version 1.0.0, 1.1.0, 1.2.0, 1.4.0, 2.0.0, 2.1.0, but cannot find clues about these issues.

Could you please help to take a look at the problem?

Thanks a lot

aldipiroli commented 1 year ago

Facing the same problem. Before the last commit commit, I could run training with torchsparse v1.4.0

antonyvan commented 1 year ago

@aldipiroli Thanks a lot, I see, after changing back to original version of initial_voxelize(), voxel_to_point(). voxel_to_point(), it works, the training and tutorial are able to run. By the way, In the trainers.py there are some segments: old :
for idx in range(invs.C[:, -1].max() + 1): cur_scene_pts = (inputs.C[:, -1] == idx).cpu().numpy() cur_inv = invs.F[invs.C[:, -1] == idx].cpu().numpy() cur_label = (all_labels.C[:, -1] == idx).cpu().numpy() new: for idx in range(invs.C[:, 0].max() + 1): cur_scene_pts = (inputs.C[:, 0] == idx).cpu().numpy() cur_inv = invs.F[invs.C[:, 0] == idx].cpu().numpy() cur_label = (all_labels.C[:, 0] == idx).cpu().numpy()

These are quite different. which one do you think is correct ? Thanks for discussion.

Regards

aldipiroli commented 1 year ago

Hi, from the docs, it seems like for torchsparse <= 2.0.0 the coords are (x,y,z,batch_id), whereas for torchsparse > 2.0.0 (batch_id, x,y,z).

So, if you are using torchsparse <= 2.0.0 the first one:

for idx in range(invs.C[:, -1].max() + 1):
  cur_scene_pts = (inputs.C[:, -1] == idx).cpu().numpy()
  cur_inv = invs.F[invs.C[:, -1] == idx].cpu().numpy()
  cur_label = (all_labels.C[:, -1] == idx).cpu().numpy()

should be the correct one, since you are iterating trough the batches.

antonyvan commented 1 year ago

@aldipiroli This is an awesome finding 💯 . I never know it have this document. Thanks a lot !!.

zhijian-liu commented 1 year ago

Please install the latest version (v2.1.0) of TorchSparse with

python -c "$(curl -fsSL https://raw.githubusercontent.com/mit-han-lab/torchsparse/master/install.py)"
antonyvan commented 1 year ago

@zhijian-liu , Thanks, I got you.