J3PA-Tiny
J3PA is a family of self-supervised LiDAR point cloud encoders from Zenseact. They produce general-purpose features for every point of a LiDAR scan, for downstream tasks such as semantic or panoptic segmentation and 3D object detection, and can be used either frozen or fine-tuned. J3PA-Tiny is distilled from J3PA-1B and, like the other distilled models, takes the voxel size as an input, so one model serves voxel sizes from 4 to 20 cm. Larger voxel sizes result in higher throughput at only a minor cost in downstream task performance.
See our paper for more details.
Paper: arXiv link coming soon · Code: GitHub link coming soon
Model family
| Model | Parameters |
|---|---|
| J3PA-Tiny | 9.8M |
| J3PA-Small | 42.4M |
| J3PA-Large | 134.6M |
| J3PA-1B | 1.01B |
How to use
The model runs custom GPU kernels that ship with this repository, so loading needs trust_remote_code=True.
Usage example:
import numpy as np
import torch
from transformers import AutoModel
model = AutoModel.from_pretrained("Zenseact/j3pa-tiny", trust_remote_code=True, revision="v1.0").cuda()
# A nuScenes sweep: x, y, z, intensity, ring index -> [age, x, y, z, intensity].
xyzi = np.fromfile("n015-...__LIDAR_TOP__....pcd.bin", dtype=np.float32).reshape(-1, 5)[:, :4]
points = torch.from_numpy(np.concatenate([np.zeros((len(xyzi), 1), np.float32), xyzi], axis=1)).cuda()
with torch.inference_mode():
out = model(points)
features = out.point_features() # (N, 896): one feature per input point
Batches. Pass a list of point clouds and split the features back per cloud:
with torch.inference_mode():
out = model([cloud_a, cloud_b])
features_a, features_b = out.point_features().split([len(cloud_a), len(cloud_b)])
Voxel size. voxel_size is the voxel size of the first encoder stage in meters, 0.05 by default. J3PA-Tiny was
trained with 4 to 20 cm. Use a float for all clouds or a tensor with one value per cloud:
out = model(points, voxel_size=0.1)
out = model([cloud_a, cloud_b], voxel_size=torch.tensor([0.05, 0.1], device="cuda"))
Input
One float32 CUDA tensor of shape (N, 5) per point cloud, with columns:
- age: seconds from the point's sweep to the newest sweep of the cloud (0 for a single sweep). Stack several sweeps into one cloud by concatenating their points with their ages.
- x, y, z: meters, with x pointing forward, y left and z up.
- intensity: 0 to 255. Multiply sensors' 0–1 intensities by 255.
Output
The encoder voxelizes the points and processes them in five stages, the voxels of stage s being 2^s times the voxel size. The output gives:
point_features(stages=None): one feature per input point, in input order. By default the features of the point's voxels in all five stages are concatenated, the deepest stage first: 256 + 256 + 192 + 128 + 64 = 896 channels, as in our linear-probing evaluation.point_features(0)gives only the finest stage (64 channels).point_features([0, -1])gives a chosen list of stages, negative indices counting from the deepest.voxel_features(stages=None): the same per voxel of the first stage, which is cheaper for dense tasks.- Per stage s:
features[s](N_s, C_s),positions[s](N_s, 3; the mean position of the points in each voxel),batch_indices[s]andup_indices[s].
Fine-tuning
The model trains like any PyTorch module. In train mode it randomizes the order of the space-filling-curves making attention groups as in pretraining.
License
Apache 2.0, see LICENSE.
Citation
The BibTeX will follow with the arXiv paper (coming soon).