Diffusion Point Transformer (DiPT) is built upon the Pointcept codebase, extending it with diffusion model engines.
This repo also includes the methods to calculate evaluation metrics for point clouds generative models, including Surface Normal Concordance (SNC), as introduced in Rethinking Metrics and Diffusion Architecture for 3D Point Cloud Generation → [ arXiv ] [ Bib ] [ Project ].
If you find DiPT or the Metrics Calculation useful to your research, please cite our work as encouragement. (੭ˊ꒳ˋ)੭✧
@misc{DiPT,
title={Rethinking Metrics and Diffusion Architecture for 3D Point Cloud Generation},
author={Matteo Bastico and David Ryckelynck and Laurent Corté and Yannick Tillier and Etienne Decencière},
year={2025},
eprint={2511.05308},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2511.05308},
}
- Ubuntu: 22.04 and above.
- CUDA: 12.1 and above.
- PyTorch: 2.3.1 and above.
Example using CUDA 12.1 and PyTorch 2.3.1
conda create -n dipt python=3.9 -y
conda activate dipt
pip install ninja
# Choose version you want here: https://pytorch.org/get-started/previous-versions/
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121
pip install h5py PyYAML
pip install tensorboard tensorboardx yapf addict einops scipy plyfile termcolor timm yapf==0.40.1
pip install torch-cluster torch-scatter torch-sparse torch-geometric
pip install scikit-learn
conda install sharedarray -c conda-forge -y
# spconv
# refer https://github.com/traveller59/spconv
pip install spconv-cu121
# PPT (clip)
pip install ftfy regex tqdm
pip install git+https://github.com/openai/CLIP.git
# PTv3 & FPS
cd libs/pointops
# usual
python setup.py install
# docker & multi GPU arch
TORCH_CUDA_ARCH_LIST="ARCH LIST" python setup.py install
# e.g. 7.0: V100; 8.0:A100; 9.0: H100 More available in: https://developer.nvidia.com/cuda-gpus
TORCH_CUDA_ARCH_LIST="7.0 8.0 9.0" python setup.py install
cd ../..
# Visualization
pip install open3d mitsuba
# Diffusers
pip install diffusers==0.30.2
# Chamfer Distance
pip install chamferdist
# Earth Mover Distance
cd pointcept/utils/metrics/PyTorchEMD/
python setup.py installPlease refer to PointFlow for dataset details.
- Download ShapeNetCore.v2.PC15k.zip and unzip
- Create the
datafolder and copy the unzipped dataset into it or - (Optional) Link dataset to the codebase.
mkdir -p data ln -s ${SHAPENET_DIR} ${CODEBASE_DIR}/data/ShapeNetCore.v2.PC15k
Train from scratch. The training processing is based on configs in configs folder.
The training script will generate an experiment folder in exp folder and backup essential code in the experiment folder.
Training config, log, tensorboard, and checkpoints will also be saved into the experiment folder during the training process.
export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}
# Script (Strongly Recommended)
sh scripts/train.sh -p ${INTERPRETER_PATH} -g ${NUM_GPU} -d ${DATASET_NAME} -c ${CONFIG_NAME} -n ${EXP_NAME}
# Direct
export PYTHONPATH=./
python tools/train.py --config-file ${CONFIG_PATH} --num-gpus ${NUM_GPU} --options save_path=${SAVE_PATH}For example:
# By script (Strongly Recommended)
# -p is default set as python and can be ignored
sh scripts/train.sh -p python -d shapenet -c DiPT-S-airplane -n DiPT-S-airplane -g 32
# Direct
export PYTHONPATH=./
python tools/train.py --config-file configs/shapenet/DiPT-S-airplane.py --options save_path=exp/shapenet/DiPT-S-airplaneResume training from checkpoint. If the training process is interrupted by accident, the following script can resume training from a given checkpoint.
export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}
# Script (Strongly Recommended)
# simply add "-r true"
sh scripts/train.sh -p ${INTERPRETER_PATH} -g ${NUM_GPU} -d ${DATASET_NAME} -c ${CONFIG_NAME} -n ${EXP_NAME} -r true
# Direct
export PYTHONPATH=./
python tools/train.py --config-file ${CONFIG_PATH} --num-gpus ${NUM_GPU} --options save_path=${SAVE_PATH} resume=True weight=${CHECKPOINT_PATH}During training, generation evaluation is performed on a reduced number of denoising samples (defined by timesteps in DiffusionSampleEvaluator), providing an initial assessment of model performance. However, to obtain precise evaluation results, testing is essential. The testing process involves performing the whole chain of diffusion denoising steps (generally 1000), generating higher quality samples.
# By script (Based on experiment folder created by training script)
sh scripts/test.sh -p ${INTERPRETER_PATH} -g ${NUM_GPU} -d ${DATASET_NAME} -n ${EXP_NAME} -w ${CHECKPOINT_NAME}
# Direct
export PYTHONPATH=./
python tools/test.py --config-file ${CONFIG_PATH} --num-gpus ${NUM_GPU} --options save_path=${SAVE_PATH} weight=${CHECKPOINT_PATH}For example:
# By script (Based on experiment folder created by training script)
# -p is default set as python and can be ignored
# -w is default set as model_best and can be ignored
sh scripts/test.sh -p python -d shapenet -n DiPT-S-airplane -w model_last
# Direct
export PYTHONPATH=./
python tools/test.py --config-file configs/shapenet/DiPT-S-airplane.py --options save_path=exp/shapenet/DiPT-S-airplane weight=exp/shapenet/DiPT-S-airplane/model/model_last.pthAll the metrics are calculated and logged during testing after the samples generation.
If samples have already been generated and the test script is run, the metrics will be computed using the available samples.
The functions for the metrics calculation are located in utils/metrics/generative_metrics.py. Note that COV, 1-NNA and JSD calculations are adapted from DiT-3D and PointFlow. The calculation of Density-Aware Chamfer Distance (DCD) is borrowed from this repo and Earth Mover Distance (EMD) from PyTorchEMD.
We strongly recommend the use compute_all_metrics:
pointcept.utils.metrics.generative_metrics.compute_all_metrics(
sample_pcs,
ref_pcs,
batch=None,
align_barycenter=True,
normal_fn=partial(normal_knn, knn=20)
)
Parameters
- sample_pcs (List[Tensor]) - Generated point clouds
- ref_pcs (List[Tensor]) - Reference point clouds
- batch (int, optional) - Batch size for computing pairwise point cloud distances to speed up the operation. Default:
None - align_barycenter (bool, optional) - Aligns point cloud barycenters before calculating their distance. Default:
True - normal_estimator (dict) - Normal estimator configs for SNC calculation. Please refer to
pointcept.utils.metrics.normal_estimators. Default:None. Recommended:dict(type='KnnNormalEstimator', k=20)
Returns
- results (dict): A dictionary containing the computed metrics:
dcd1nn = results['1-NN-DCD-acc']
emd1nn = results['1-NN-EMD-acc']
dcdcov = results['lgan_cov-DCD']
emdcov = results['lgan_cov-EMD']
dcdmmd = results['lgan_mmd-DCD']
emdmmd = results['lgan_mmd-EMD']
dcdsnc = results['SNC-DCD']
emdsnc = results['SNC-EMD']
For legacy compatibility we also provide the function compute_all_metrics_cd, which computes generative metrics using Chamfer Distance (CD) and jsd_between_point_cloud_sets for Jensen Shannon Divergence (JSD) computation. In the latter, the center (bool, optional) parameter is included to align all point clouds before computing JSD.
We provide built-in classes and builder for point cloud normal estimation in pointcept.utils.metrics.normal_estimators
- KnnNormalEstimator(k): 3D plane fitting on a set of neighbouring points defined by the k nearest neighbours.
- BallNormalEstimator(r): 3D plane fitting on a set of neighbouring points defined by a sphere of radius r.
User-specific normal estimator can be implemented and added.
For any issue related to external modules, such as DCD and PyTorchEMD please refer to the original repos.
We highly recommend verifying the environment variables TORCH_CUDA_ARCH_LIST, TORCH_EXTENSIONS_DIR and MAX_JOBS (for Ninja) in case of issues with the module chamfer3D (here) as part of DCD. Its original implementation can be found in ChamferDistancePytorch.
Pre-trained model weights are available here for the following experiments.
| Category | Model Size | Num GPUs | SNC-DCD | Config | Tensorboard | Exp Record |
|---|---|---|---|---|---|---|
| Chair | XS | 32 | 75.54% | link | link | link |
| Chair | S | 32 | 77.29% | link | link | link |
| Chair | B | 32 | 77.53% | link | link | link |
| Chair | L | 32 | 76.66% | link | link | link |
| Airplane | S | 32 | 87.50% | link | link | link |
| Car | S | 32 | 82.69% | link | link | link |
| 10 Mix Categories | S | 32 | 81.12% | link | link | link |
Example running scripts are as follows:
# Tab. 1
# Chair category
sh scripts/train.sh -p python -d shapenet -c DiPT-S-chair -n DiPT-S-chair -g 32
# Airplane category
sh scripts/train.sh -p python -d shapenet -c DiPT-S-airplane -n DiPT-S-airplane -g 32
# Car category
sh scripts/train.sh -p python -d shapenet -c DiPT-S-car -n DiPT-S-car -g 32
# Tab. 3
sh scripts/train.sh -p python -d shapenet -c DiPT-S-10cat -n DiPT-S-10cat -g 32
# Tab. 6
# Extra-Small
sh scripts/train.sh -p python -d shapenet -c DiPT-XS-chair -n DiPT-XS-chair -g 32
# Small
sh scripts/train.sh -p python -d shapenet -c DiPT-S-chair -n DiPT-S-chair -g 32
# Big
sh scripts/train.sh -p python -d shapenet -c DiPT-B-chair -n DiPT-B-chair -g 32
# Large
sh scripts/train.sh -p python -d shapenet -c DiPT-L-chair -n DiPT-L-chair -g 32
For comparison, generated samples used to calculate the results of Tab.1 and Tab. 2 for all the models are available here.