Skip to content

PyTorch PointCloud

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.

Classify objectspointnet2-ssg.modelnet40.xu-yan
Segment partspointnext-sm.shapenetpart.openpoints
Understand a sceneptv3-base.scannet20.pointcept
Drivespvcnn-119gmacs.semantickitti.mit-han-lab
second.kitti.openpcdet
Embed a surveyutonia-lp.scannet20.pointcept
Search by similaritysonata-lp.scannet20.fair

In 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

  • Get Started

    Install, run your first model, and learn the library's conventions in fifteen lines.

  • Models

    PointNet, PointNet++, RandLA-Net, KPConv, PointNeXt, OctFormer, Point Transformer, SPVCNN, and more.

  • Datasets

    ModelNet, ScanNet, S3DIS, ShapeNetPart, ScanObjectNN, SemanticKITTI, Semantic3D, and more.

  • Transforms

    Composable, non-mutating dict transforms inspired by MONAI.

  • Tutorials

    Ready to use notebooks, from a first classification to survey-scale inference.

  • API Reference

    Auto-generated reference for every public class and function.

  • Source

    Browse the source, file issues, or contribute.

License

Apache 2.0. See LICENSE.