yewzijian / 3DFeatNet

3DFeat-Net: Weakly Supervised Local 3D Features for Point Cloud Registration
MIT License
220 stars 46 forks source link

Datagenerator.py error while reshaping pointcloud data #2

Closed ClaudioCimarelli closed 5 years ago

ClaudioCimarelli commented 5 years ago

I am starting the training on the oxford dataset. Unfortunately, I received this error while reshaping the numpy array of the read point cloud. I performed all the described preprocessing on the pointclouds, could something have gone wrong in the process? I imagine you supposed that the data should have that dimension before training.

Thanks in advance for your help.

Traceback (most recent call last): File "/mnt/gaiagpfs/users/homedirs/ccimarelli/opt/pycharm-community-2018.2.3/helpers/pydev/pydevd.py", line 1664, in main() File "/mnt/gaiagpfs/users/homedirs/ccimarelli/opt/pycharm-community-2018.2.3/helpers/pydev/pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "/mnt/gaiagpfs/users/homedirs/ccimarelli/opt/pycharm-community-2018.2.3/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/mnt/gaiagpfs/users/homedirs/ccimarelli/opt/pycharm-community-2018.2.3/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/work/users/ccimarelli/git/3DFeatNet/train.py", line 327, in train() File "/work/users/ccimarelli/git/3DFeatNet/train.py", line 151, in train augmentation=train_augmentations) File "/mnt/gaiagpfs/users/workdirs/ccimarelli/git/3DFeatNet/data/datagenerator.py", line 74, in next_triplet anchor = self.get_point_cloud(i_anchor) File "/mnt/gaiagpfs/users/workdirs/ccimarelli/git/3DFeatNet/data/datagenerator.py", line 112, in get_point_cloud num_cols=self.num_cols) File "/mnt/gaiagpfs/users/workdirs/ccimarelli/git/3DFeatNet/data/datagenerator.py", line 175, in load_point_cloud model = np.reshape(model, (-1, num_cols)) File "/opt/apps/resif/data/production/v1.1-20180718/default/software/lib/TensorFlow/1.8.0-foss-2018a-Python-3.6.4-CUDA-9.1.85/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 279, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "/opt/apps/resif/data/production/v1.1-20180718/default/software/lib/TensorFlow/1.8.0-foss-2018a-Python-3.6.4-CUDA-9.1.85/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 51, in _wrapfunc return getattr(obj, method)(*args, **kwds) ValueError: cannot reshape array of size 100120 into shape (6)

JuanDuGit commented 5 years ago

@ClaudioCimarelli Hi, I encountered the same problem when I was trying to train the model. I checked the precessing code and I figured that the error was because that they were using two different ways to save the preprocessed PointCloud data and to get the same data when training. In the function called savePointCloud in the file 'BuildPointclouds.m", it's xyzi that's being saved, which means the shape of the data should be num_points 4. However, in Datagenerator.py, they assumed the data is like num_points 6. They way I got around this problem : keep the first 3 dimensions of the pointcould and modify the data_dim to 3. The paper mentioned that what they actually used was the coordinate information.

PS: I guess that the default value of data_dim 6 probably comes from xyz+normals :)

ClaudioCimarelli commented 5 years ago

Hello @JDcodeing, thanks for the quick answer. I will check carefully the procedure to store the data. It is strange though that i tried with data_dim=4 and it didn't work either.

yewzijian commented 5 years ago

Hi. @JDcodeing is absolutely right. Sorry about the mistake, I have corrected the relevant parts of the code to save out the normals so that the data is num_points * 6.