chrischoy / DeepGlobalRegistration

[CVPR 2020 Oral] A differentiable framework for 3D registration
Other
468 stars 85 forks source link

IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (197,3) (197,) #22

Open zhanqx1024 opened 3 years ago

zhanqx1024 commented 3 years ago

when i run demo.py, i had the issue as following: /media/turing/C236399636398D03/hyx/yes/envs/dgr37/lib/python3.7/site-packages/MinkowskiEngine-0.5.0-py3.7-linux-x86_64.egg/MinkowskiEngine/init.py:210: UserWarning: The MinkowskiEngine was compiled with CPU_ONLY flag. If you want to compile with CUDA support, make sure torch.cuda.is_available() is True when you install MinkowskiEngine. "If you want to compile with CUDA support, make sure torch.cuda.is_available() is True when you install MinkowskiEngine.", => loading checkpoint 'ResUNetBN2C-feat32-kitti-v0.3.pth' => Setting voxel size to 0.3 => loading finished Traceback (most recent call last): File "demo.py", line 41, in T01 = dgr.register(pcd0, pcd1) File "/home/turing/hyx/DeepGlobalRegistration-MEv0.5/core/deep_global_registration.py", line 241, in register xyz0, coords0, feats0 = self.preprocess(xyz0) File "/home/turing/hyx/DeepGlobalRegistration-MEv0.5/core/deep_global_registration.py", line 151, in preprocess xyz = torch.from_numpy(xyz[sel]) IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (197,3) (197,)

can anybody helps me?

russellyq commented 3 years ago

Hi ! I have encountered the same problem.

Can you help us on this issue ?

Thanks in advance! @chrischoy

silencemm commented 3 years ago

Hi ! I have encountered the same problem. My environment is: pytorch1.7.0 python3.7 MinkowsEngine0.5 cuda11.0

errors info as follows:

Traceback (most recent call last): File "train.py", line 76, in main(config) File "train.py", line 55, in main trainer.train() File "/mnt/nfs-storage/limo/DeepGlobalRegistration/core/trainer.py", line 127, in train val_dict = self._valid_epoch() File "/mnt/nfs-storage/limo/DeepGlobalRegistration/core/trainer.py", line 380, in _valid_epoch input_dict = self.get_data(data_loader_iter) File "/mnt/nfs-storage/limo/DeepGlobalRegistration/core/trainer.py", line 554, in get_data input_data = iterator.next() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/mnt/nfs-storage/limo/DeepGlobalRegistration/dataloader/threedmatch_loader.py", line 82, in getitem pcd0 = make_open3d_point_cloud(xyz0[sel0]) IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (5758,3) (5758,)

Can you help us on this issue ?

Thanks in advance! @chrischoy

silencemm commented 3 years ago

@russellyq @zhanqx1024 hi,I have encountered the same problem too,are you solve it?

chalth commented 3 years ago

Hi ! I have encountered the same problem too.

Can you help us on this issue ?

Thanks! @chrischoy

hafizas101 commented 3 years ago

Hi, I have the same issue. Any solution ? @chrischoy

hafizas101 commented 3 years ago

@zhanqx1024 @russellyq @silencemm @chalth Please install MinkowskiEngine 0.4.3 and then run demo.py file. All errors are gone and it works perfectly fine with Minkowski Engine 0.4.3. Also after installing MinkowskiEngine, pip install open3d==0.10.0 because latest version does not work fine.

chrischoy commented 3 years ago

This is due to the API change. https://github.com/chrischoy/FCGF/issues/38 From MinkowskiEngine v0.5, the quantization function returns coordinates and indices. Replace sel0= ME.utils.sparse_quantize(xyz0 / voxel_size, return_index=True) with _, sel0= ME.utils.sparse_quantize(xyz0 / 0.05, return_index=True)

For a reference, check out https://github.com/chrischoy/FCGF/commit/cc5b70008fd1282d19ee60f6c022d4b5d059f4bc#diff-9ec6203a8552a65befc7ee92d7205a7d70b23de965b3e1bd41a7a2c5debd3f68R244

Vaishali-Nimilan commented 2 years ago

@hafizas101 hey, I am facing the same issue with MinkowskiEnginev0.5. Can you please say how you were able to degrade the version?. Thank you

hafizas101 commented 2 years ago

@Vaishali-Nimilan Yup install open3d==0.10.0 and install Minkowski 0.4.3. It worked perfectly fine then.

Vaishali-Nimilan commented 2 years ago

@hafizas101 Hey, I have downgraded both open3d and MinkowskiEngine. I still face the same error. Could you please help?

hafizas101 commented 2 years ago

@Vaishali-Nimilan Check your PyTorch and cuda version. Mine is PyTorch 1.7.1, Cuda 10.2, cudnn 7.6.5 with Python 3.8. That might help.

Vaishali-Nimilan commented 2 years ago

@hafizas101 hey, I am working with the 3D match dataset in DGR. But I don't understand the text file format they use for the input. eg: 7-scenes-chess@seq-01_000.npz 7-scenes-chess@seq-01_001.npz 0.886878

I can see the first two variables are the names of the clouds. I don't understand the context of 0.886878 here. I doubt if its intensity. Can you please let me know if you can? Thank you in advance.

AAUfoa commented 2 years ago

This is due to the API change. chrischoy/FCGF#38 From MinkowskiEngine v0.5, the quantization function returns coordinates and indices. Replace sel0= ME.utils.sparse_quantize(xyz0 / voxel_size, return_index=True) with _, sel0= ME.utils.sparse_quantize(xyz0 / 0.05, return_index=True)

For a reference, check out chrischoy/FCGF@cc5b700#diff-9ec6203a8552a65befc7ee92d7205a7d70b23de965b3e1bd41a7a2c5debd3f68R244

Thanks a lot, this works for MEv0.5