README¶
Point Cloud Tools¶
Fast point cloud tools implemented in C++ and in Pytorch3d.
These tools are used in point cloud models like RandLA-Net or KP-Conv.
Actually, the library contains 2 modules:
nearest_neighbors: for knn operationsgrid_subsampling: for subsampling operations
Installation¶
The library is only compatible with Linux / WSL. The supported Python versions are: 3.9, 3.10, 3.11
There is CPU only version and a GPU compatible version:
For the CPU only version:
pip install pctools
for running the notebooks, clone the repository:
git clone git@ssh.dev.azure.com:v3/altametris/DEV-IA/pctools
pip install -e .[dev]
For the GPU compatible version:
pip install pctools && pctools-setup-gpu -y
The pctools-setup-gpu command will install the required conda dependencies (CUDA toolkit, PyTorch, PyTorch3D).
Use pctools-setup-gpu --help to see available options (--dry-run, --yes).
To test GPU installation and to know the system’s performance:
pctools-benchmark
Usage¶
import numpy as np
import torch
from altametris.pctools.nearest_neighbors import nn_cpu, nn_gpu
from altametris.pctools.grid_subsampling import cpu as gs
# create a random point cloud
pc = np.random.rand(1000, 3)
# compute knn on CPU
idx = nn_cpu.knn(pc, pc, K=2)
# compute knn on GPU
pc_tensor = torch.from_numpy(pc)
idx = nn_gpu.knn(pc, pc, K=2)
# subsample
subpoints, _, _ = gs.subsample(points, grid_size=0.01)