PointNeXt
PointNeXt copied to clipboard
Enable OpenPoints to be installed as a package
Hi,
I want to use OpenPoints as a library within my project. It would be nice if OpenPoints was able to be installed in its entirety as a package. This would entail:
- Defining all non-cuda requirements in setup.py or setup.cfg
- Installing all c++ extension modules from setup.py
- Adding OpenPoints to pip (and in the future, Anaconda) to be installed by downstream libraries
Let me know your thoughts, thanks!
Thanks for this suggestion. But I have no experience in this. Could you kindly direct me to an example?
Hi!
I recommend taking a look at the following libraries for examples on setting up setup.py:
https://github.com/torch-points3d/torch-points-kernels/blob/master/setup.py https://github.com/mit-han-lab/torchsparse/blob/master/setup.py
Let me know if you have any questions, I am happy to help. I am one of the core contributors on torch-points3d and I'm looking to use OpenPoints as a basis for the next version of the framework. Feel free to reach out!
I would maybe recommend following the format of torch-points-kernels, where the cuda c++ code is in a "cuda" folder and then you can setup all of the extensions under the global setup.py, like so:
# /setup.py
setup(
name='openpoints',
ext_modules=[
CUDAExtension('openpoints.pointnet2_cuda', [
'cuda/pointnet2/pointnet2_api.cpp',
'cuda/pointnet2/ball_query.cpp',
'cuda/pointnet2/ball_query_gpu.cu',
'cuda/pointnet2/group_points.cpp',
'cuda/pointnet2/group_points_gpu.cu',
'cuda/pointnet2/interpolate.cpp',
'cuda/pointnet2/interpolate_gpu.cu',
'cuda/pointnet2/sampling.cpp',
'cuda/pointnet2/sampling_gpu.cu',
],
CUDAExtension('openpoints.chamfer_cuda', [
'cuda/chamfer/chamfer_cuda.cpp',
'cuda/chamfer/chamfer.cu',
])
],
cmdclass={'build_ext': BuildExtension}
)
And then, the convention is to have all of the python code under a folder same as the name of the package.
Project folder Structure:
+ cuda
+ openpoints
+ dataset
+ loss
+ models
+ optim
+ scheduler
+ transforms
+ utils
- setup.py
- README.md
This way, the code can be imported into a downstream dependency after being installed by doing something like:
import openpoints.dataset
@CCInc hi thanks for the input. I will do that in spare time.