junzhezhang / shape-inversion

[CVPR 2021] Unsupervised 3D Shape Completion through GAN Inversion
MIT License
131 stars 21 forks source link

Training on new class/dataset #2

Closed marcusabate closed 3 years ago

marcusabate commented 3 years ago

Hello, thank you for releasing this package. The work is very interesting.

I want to train the network for shape completion on my own data. I have partial and full point-clouds for a large number of samples, but don't understand how the currently supported formats are generated. For example, CRN seems to come as .h5 files.

What is the best way to go from partial and full point clouds (.ply or .obj or other) to the proper input format? After that point I'd presumably run the trainer and point it to my new class choice and dataset location.

marcusabate commented 3 years ago

I am able to create h5 files now, but it seems like the code makes the assumption that all point clouds are 2048 points in size. Is this true? The paper mentions that k-mask is robust to partial scans of other resolutions and densities; how was this tested? Is there a way to have variable sizes for each sample? And have different sizes for ground truth and measured?

junzhezhang commented 3 years ago

Hi, thanks for your interest in our work!

You can adapt from data.ply_dataset. PlyDataset. Depends on your canonical frame, you may not need to conduct swap_axis. You can also write your own dataset as long as you make sure __getitem__ return a tuple of (partial, gt, idx).

You may want to start from pretraining the tree-GAN using your own data (train split), by calling pretrain_treegan.py, where you only need the gt point clouds. Then, you can use your pretrained model to do shape completion on the test split, by calling trainer.py, where you only need the partial point clouds for training, and the gt point clouds are for evaluation and visualization only.

Let me know if you need more help.

Best, Junzhe

junzhezhang commented 3 years ago

Due to the architecture of tree-GAN, the generated complete shape is of 2048 points. However, the input partial shape can be of any resolution. You can verify the robustness of k-mask with different resolution of partial shapes, either by modifying the input directly, or specify 'target_downsample_method' in the arguments.

marcusabate commented 3 years ago

Thank you, I was able to write my own dataset following PLYDataset.

Regarding canonical orientation; all I have to do is ensure that the gt and input meshes are oriented in the same way when I generate them and I won't have to reorient when I load the dataset using your package, correct?

junzhezhang commented 3 years ago

@marcusabate yes you are write. If your canonical frame is different from CRN, then you would need to pretrain the tree-GAN on your own.

nama1arpit commented 3 years ago

Hi @junzhezhang, I wanted to pretrain the tree-GAN on the well known ScanNet dataset. Can I directly use the ply_dataset.py file for it, with the dataset_path being the path to the originally downloaded ScanNet dataset form their website?