andrearosasco / hyperpcr

4 stars 1 forks source link

Question about training #2

Closed rjfbupt closed 1 year ago

rjfbupt commented 1 year ago

Hello, thank you for your great work. I have a question about training. I found that training this network is difficult to converge, meaning that the loss decreases to around 0.6 and then remains largely unchanged. I am using the ShapeNetV2 dataset and training the network through pcr/ours/train.py. The network is configured using ours/configs/local_config.py, and the dataloader is generated through ours/datasets/ShapeNetPOVRemoval.py. I look forward to your response.

andrearosasco commented 1 year ago

Hi @rjfbupt thanks for taking interest in the work. I apologize for the codebase being quite messy. I'm afraid the code you were using wasn't really up to date (the most recent commits in the pcr repo are not in the main branch but in the mc_dropout branch).

Anyway, I just added the last version of the training code here https://github.com/andrearosasco/confidence_shape_completion so that it can be found more easily. I'll update the README too.

We ended up using the Columbia Grasp Database as ShapeNet wasn't much useful in our grasping setting. If you wanna train it on ShapeNet you can start with the code linked above and try to add the dataset (tell me if you need help). I remember there were two data loaders for ShapeNet:

There is also a version of ShapeNet with self-occluded input here: https://github.com/qinglew/PCN-PyTorch/tree/master and this is the data loader I was using for it https://github.com/andrearosasco/pcr/blob/mc_dropout/datasets/PCNDataset.py

rjfbupt commented 1 year ago

@andrearosasco Thanks for your reply,I will try it!

rjfbupt commented 1 year ago

@andrearosasco Hi! I have a question about converting partial point clouds to 3D list of points.Do I need to convert .pcd files read from train_test_dataset.json to .npy format? For example, if the path stored in data['train_models_train_views'][412][0] is ”training_data/grasp_database/vase_poisson_004/pointclouds/8_2_9“, then I just need to add the extension ".pcd" to the end of the path and convert it to ".npy" format?Looking forward to your reply!

andrearosasco commented 1 year ago

Hi @rjfbupt, are you trying to use this dataset?

I found that, at least at the time, using open3d to read the point clouds and meshes from inside the Pytorch data loader was causing some problems when using multiple workers. The workaround, as documented here, was to convert everything to npy and then load them using NumPy.

You can still try to load them in the original (.pcd ?) format and see if it works for you. You just need to correct the path here and here. Just change the file extension to the one used in the dataset, load the file with open3d and convert it to NumPy. For each mesh, there is gonna be a single file in the original dataset. Once you read it with open3d you should do something like:

vertices = np.array(o3d_mesh.vertices)
triangles = np.array(o3d_mesh.triangles)
partial = np.array(o3d_partial.points)

And if you wanna go for the second option and convert the dataset just add

np.save(vertices, path)
np.save(triangles, path)
np.save(points, path)
rjfbupt commented 1 year ago

@andrearosasco Thanks for your reply . I have successfully trained the network by converting partial point cloud (.pcd) to .npy form (similar to what you mentioned) a few days ago. Thanks for your reply and your excellent work!