PyTorch PointCloud¶

A PyTorch library for deep learning on point clouds. Production-ready models for classification, segmentation, and detection, with a create_model factory, pretrained-weight registry, and composable transforms in the style of
timm and
torch_geometric.
pointnet2-ssg.modelnet40.xu-yanpointnext-sm.shapenetpart.openpointsptv3-base.scannet20.pointceptspvcnn-119gmacs.semantickitti.mit-han-labsecond.kitti.openpcdetutonia-lp.scannet20.pointceptsonata-lp.scannet20.fairIn a few lines¶
import numpy as np
import torch
from plyfile import PlyData
import torch_pointcloud as tp
from torch_pointcloud.utils.data import collate
# Load pretrained checkpoint and sample cloud.
model, info = tp.create_model(
"pointnet2-ssg.modelnet40.xu-yan",
task="classification",
pretrained=True,
return_info=True,
)
model = model.eval()
# Get associated transform pipeline.
transform = info["transform"]
# Preprocess the input.
ply = PlyData.read("sample.ply")["vertex"]
pos = np.stack([ply["x"], ply["y"], ply["z"]], 1).astype("float32")
sample = {"pos": torch.from_numpy(pos)}
sample = transform(sample)
# Preprocess, pack into a batch, predict.
batch = collate([sample])
with torch.no_grad():
logits = model(None, batch["pos"], batch["batch"])
print(f"Prediction: {logits.argmax().item()}")
# Prediction: 0
What's inside¶
-
Install, run your first model, and learn the library's conventions in fifteen lines.
-
PointNet, PointNet++, RandLA-Net, KPConv, PointNeXt, OctFormer, Point Transformer, SPVCNN, and more.
-
ModelNet, ScanNet, S3DIS, ShapeNetPart, ScanObjectNN, SemanticKITTI, Semantic3D, and more.
-
Composable, non-mutating dict transforms inspired by MONAI.
-
Ready to use notebooks, from a first classification to survey-scale inference.
-
Auto-generated reference for every public class and function.
-
Browse the source, file issues, or contribute.
License¶
Apache 2.0. See LICENSE.