HuguesTHOMAS / KPConv-PyTorch

Kernel Point Convolution implemented in PyTorch
MIT License
778 stars 155 forks source link

Train a custom point cloud dataset with 50 more features #236

Closed aldinorizaldy closed 9 months ago

aldinorizaldy commented 11 months ago

Hi Thomas, thanks for the great works. I hope you are still around to answer my questions.

I am working on a point cloud data with hyperspectral features, so you can think about point with XYZ + RGB + 50 features. I know how you prepared S3DIS dataset by having 5 features (1 + RGB + height) for the in_features_dim. But how if I have more features? I would think of 1 + RGB + 1 height + 50 = 55. Is that correct?

If so, where should I change the code? I see there are several things to do:

  1. Change the in_features_dim to 55 https://github.com/HuguesTHOMAS/KPConv-PyTorch/blob/8ec7478cd6b5fa3c6f423b984d6817b5e90e057b/train_S3DIS.py#L146
  2. Add something similar to this but elif self.config.in_features_dim == 55: https://github.com/HuguesTHOMAS/KPConv-PyTorch/blob/8ec7478cd6b5fa3c6f423b984d6817b5e90e057b/datasets/S3DIS.py#L418-L419
  3. Then this is something that I don't understand. How does the input_colors collect the RGB features? If I have RGB + 50 more features, then how should I change this code? https://github.com/HuguesTHOMAS/KPConv-PyTorch/blob/8ec7478cd6b5fa3c6f423b984d6817b5e90e057b/datasets/S3DIS.py#L353-L372

Thanks!!

HuguesTHOMAS commented 11 months ago

Hi @aldinorizaldy,

Because S3DIS dataset is small enough to be loaded entirely in memory, we preload the point clouds and their colors in this function:

https://github.com/HuguesTHOMAS/KPConv-PyTorch/blob/8ec7478cd6b5fa3c6f423b984d6817b5e90e057b/datasets/S3DIS.py#L715-L715

More precisely here: https://github.com/HuguesTHOMAS/KPConv-PyTorch/blob/8ec7478cd6b5fa3c6f423b984d6817b5e90e057b/datasets/S3DIS.py#L757-L790

If you can do the same then great. If not you might have to load from file directly in the get_item function. Actually if your dataset consists of several small file (lets say various different rooms) It might be better to load it directly in the get_item function to avoid using to much memory by preloading everything

aldinorizaldy commented 11 months ago

Hi Thomas,

Perfect!! Thank you for answering my question. I had an error with the expected_N value, but I solved it by reducing the value into 1e4. Now I'm able to train my custom data.

It is an outdoor lidar with sparse point density. So I have to play around with the in_radiusand first_subsampling_dl. The average point spacing is 2 m, so I chose first_subsampling_dl = 2 and in_radius = 100, following your advice to have a consant ratio more or less 50x. Having less values for both parameters gave me worse results.

Thank you again for still being here and help the community. I do really appreciate it. Cheers!!

HuguesTHOMAS commented 11 months ago

Thanks for your kind message, and good luck with your problem!

Best, Hugues