humanpose1 / MS-SVConv

Compute descriptors for 3D point cloud registration using a multi scale sparse voxel architecture
MIT License
63 stars 7 forks source link

Error when using other 3D data #3

Closed trinhnhut-gif closed 3 years ago

trinhnhut-gif commented 3 years ago

hi humanpose1 Thank you a lot for your update. It's running with your data but when I try to run with my 3D point loud data and use your model :MS_SVCONV_2cm_X2_3head_3dm.pt I have some problems like that:

INFO - 2021-06-15 11:01:11,212 - model_checkpoint - Loading checkpoint from models/MS_SVCONV_2cm_X2_3head_3dm.pt INFO - 2021-06-15 11:01:11,566 - modelfactory - The config will be used to build the model INFO - 2021-06-15 11:01:11,750 - model_checkpoint - Available weights : ['latest', 'loss', 'hit_ratio', 'feat_match_ratio', 'trans_error', 'rot_error', 'rre', 'rte', 'sr_err'] INFO - 2021-06-15 11:01:11,751 - model_checkpoint - Model loaded from MS_SVCONV_2cm_X2_3head_3dm.pt:latest

invalid syntax (, line 1) [Open3D WARNING] Read PCD failed: unable to open file: Dt/4sm.pcd0;m


RuntimeError Traceback (most recent call last)

in () 21 model = PretainedRegistry.from_file(pcd_model[choice_model], mock_property={}) 22 ---> 23 data_s = pcd_DA[choice_model](read_pcd(pcd_path[choice_data][0])) 24 data_t = pcd_DA[choice_model](read_pcd(pcd_path[choice_data][1])) 25 3 frames /usr/local/lib/python3.7/dist-packages/torch_geometric/transforms/compose.py in __call__(self, data) 12 def __call__(self, data): 13 for t in self.transforms: ---> 14 data = t(data) 15 return data 16 /usr/local/lib/python3.7/dist-packages/torch_points3d/core/data_transform/grid_transform.py in __call__(self, data) 133 data = [self._process(d) for d in data] 134 else: --> 135 data = self._process(data) 136 return data 137 /usr/local/lib/python3.7/dist-packages/torch_points3d/core/data_transform/grid_transform.py in _process(self, data) 119 cluster = grid_cluster(coords, torch.tensor([1, 1, 1])) 120 else: --> 121 cluster = voxel_grid(coords, data.batch, 1) 122 cluster, unique_pos_indices = consecutive_cluster(cluster) 123 /usr/local/lib/python3.7/dist-packages/torch_geometric/nn/pool/voxel_grid.py in voxel_grid(pos, batch, size, start, end) 53 end = torch.tensor(end, dtype=pos.dtype, device=pos.device) 54 ---> 55 return grid_cluster(pos, size, start, end) RuntimeError: The following operation failed in the TorchScript interpreter. Traceback of TorchScript (most recent call last): File "/usr/local/lib/python3.7/dist-packages/torch_cluster/grid.py", line 32, in grid_cluster cluster = grid_cluster(pos, size) """ return torch.ops.torch_cluster.grid(pos, size, start, end) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1] because the unspecified dimension size -1 can be any value and is ambiguous. Could you have some suggests ? Thank you so much
humanpose1 commented 3 years ago

The problem comes from the GridSampling3D transform. It means that probably the shape of the tensor (contained in the attribute pos of your object data) is not correct. The code should look like this:

pos = read_point_cloud(...) #pos is of shape N x 3
data = Data(pos=pos, batch=torch.zeros(len(pos)).long())
data = transform(data)
model.set_input(data, "cuda")
output = model.forward()

please can you check the size of pos in your case ?

trinhnhut-gif commented 3 years ago

Hi. Thank you for your help.. I have solved this problem with my data ( blue one is a simulation and yellow one is a real point cloud ). point cloud But both of them are too big (4 million points) so google colab could not enough RAM to run in registration part with error WARNING WARNING:root:kernel b48211a4-a3e6-44f4-8082-89f69da39d21 restarted. So I think I will try with other smaller data or use local computer. Again, thank you so much for your support

humanpose1 commented 3 years ago

Thanks for testing my code !