PGSR: Planar-based Gaussian Splatting for Efficient and High-Fidelity Surface Reconstruction (Python Package Version)
This repository contains the refactored Python package for PGSR. It is ported from commit de24f1a38b350387e8d8fe381b2cd70c1ae946e7. The original components have been reorganized into a standard Python package and adapted to the reusable APIs provided by gaussian-splatting.
Features
- Code organized as a standard Python package
-
gsplatandgsplat-2dgsrendering backends - Planar scale regularization
- Depth-normal consistency
- Multi-view photometric and geometric regularization
- Virtual-camera reprojection
- Multi-view trimming and opacity-reset densification
- Optional camera-pose optimization
- Rendering, mesh extraction, and interactive viewing
Prerequisites
- PyTorch with CUDA support
- A CUDA Toolkit version compatible with the installed PyTorch build
- Python 3.10 or later
Optional features can be installed through package extras:
pip install --upgrade "pgsr[mesh,viewer]"
If you have trouble installing gaussian-splatting, install it from source:
pip install wheel setuptools
pip install --upgrade git+https://github.com/yindaheng98/gaussian-splatting.git@master --no-build-isolation
PyPI Install
pip install --upgrade pgsr
Or install the latest version from source:
pip install wheel setuptools
pip install --upgrade git+https://github.com/yindaheng98/PGSR.git@main --no-build-isolation
Development Install
git clone https://github.com/yindaheng98/PGSR.git
cd PGSR
pip install --editable .
Quick Start
- Prepare a dataset in the COLMAP format used by
gaussian-splatting. For example, download the Tanks and Temples + Deep Blending dataset:
wget https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/input/tandt_db.zip -P ./data
unzip data/tandt_db.zip -d data/
- Train PGSR with densification:
python -m pgsr.train -s data/truck -d output/truck -i 30000 --mode densify --backend gsplat --no_image_mask --no_depth_data
- Render the trained model:
python -m pgsr.render -s data/truck -d output/truck -i 30000 --backend gsplat --no_image_mask
- Extract a mesh (requires the
meshextra):
python -m pgsr.mesh -s data/truck -d output/truck -i 30000 --backend gsplat --no_image_mask -o max_depth=10.0 -o voxel_size=0.01
- Open the interactive viewer (requires the
viewerextra):
python -m pgsr.viewer -d output/truck -i 30000 --backend gsplat --port 8080
💡 This package does not include dataset preprocessing or evaluation scripts. Refer to the original PGSR repository for the DTU, Tanks and Temples, and Mip-NeRF 360 workflows.
💡 See .vscode/launch.json for more examples. Run
python -m pgsr.train --help,python -m pgsr.render --help,python -m pgsr.mesh --help, orpython -m pgsr.viewer --helpfor all command-line options.
Backends and Training Modes
Two rendering backends are available:
gsplat(default)gsplat-2dgs
The training entry point supports the following modes:
base: PGSR regularization without densificationdensify(default): PGSR regularization with multi-view trimming, opacity reset, and densificationcamera:basewith trainable camera posescamera-densify:densifywith trainable camera poses
Use repeated -o key=value arguments to override trainer configuration values:
python -m pgsr.train -s data/truck -d output/truck -o densify_grad_threshold=0.0001 -o opacity_cull_threshold=0.05
API Usage
This project builds on gaussian-splatting and provides PGSR Gaussian models and composed trainers. Refer to that package for the core Gaussian model, dataset, trainer, and training-loop concepts.
The high-level factory prepares the dataset, Gaussian model, and trainer:
from pgsr.train import prepare_training
dataset, gaussians, trainer = prepare_training(
sh_degree=3,
source="data/truck",
device="cuda",
mode="densify",
backend="gsplat",
load_mask=False,
load_depth=False,
configs={"densify_grad_threshold": 0.0001},
)
The lower-level factories can also be used independently:
from gaussian_splatting.prepare import prepare_dataset
from pgsr.prepare import prepare_gaussians, prepare_trainer
dataset = prepare_dataset(
source="data/truck",
device="cuda",
load_mask=False,
load_depth=False,
)
gaussians = prepare_gaussians(
sh_degree=3,
source="data/truck",
device="cuda",
backend="gsplat",
)
trainer = prepare_trainer(
gaussians=gaussians,
dataset=dataset,
mode="densify",
configs={"densify_grad_threshold": 0.0001},
)
PGSR: Planar-based Gaussian Splatting for Efficient and High-Fidelity Surface Reconstruction
Danpeng Chen, Hai Li, Weicai Ye, Yifan Wang, Weijian Xie, Shangjin Zhai, Nan Wang, Haomin Liu, Hujun Bao, Guofeng Zhang
Project Page | arXiv
We present a Planar-based Gaussian Splatting Reconstruction representation for efficient and high-fidelity surface reconstruction from multi-view RGB images without any geometric prior (depth or normal from pre-trained model).
Updates
- [2024.07.18]: We fine-tuned the hyperparameters based on the original paper. The Chamfer Distance on the DTU dataset decreased to 0.47.
The Chamfer Distance↓ on the DTU dataset
| 24 | 37 | 40 | 55 | 63 | 65 | 69 | 83 | 97 | 105 | 106 | 110 | 114 | 118 | 122 | Mean | Time | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PGSR(Paper) | 0.34 | 0.58 | 0.29 | 0.29 | 0.78 | 0.58 | 0.54 | 1.01 | 0.73 | 0.51 | 0.49 | 0.69 | 0.31 | 0.37 | 0.38 | 0.53 | 0.6h |
| PGSR(Code_V1.0) | 0.33 | 0.51 | 0.29 | 0.28 | 0.75 | 0.53 | 0.46 | 0.92 | 0.62 | 0.48 | 0.45 | 0.55 | 0.29 | 0.33 | 0.31 | 0.47 | 0.5h |
| PGSR(Remove ICP) | 0.36 | 0.57 | 0.38 | 0.33 | 0.78 | 0.58 | 0.50 | 1.08 | 0.63 | 0.59 | 0.46 | 0.54 | 0.30 | 0.38 | 0.34 | 0.52 | 0.5h |
The F1 Score↑ on the TnT dataset
| PGSR(Paper) | PGSR(Code_V1.0) | |
|---|---|---|
| Barn | 0.66 | 0.65 |
| Caterpillar | 0.41 | 0.44 |
| Courthouse | 0.21 | 0.20 |
| Ignatius | 0.80 | 0.81 |
| Meetingroom | 0.29 | 0.32 |
| Truck | 0.60 | 0.66 |
| Mean | 0.50 | 0.51 |
| Time | 1.2h | 45m |
Acknowledgements
This project is built upon 3DGS. Densify is based on AbsGau and GOF. DTU and Tanks and Temples dataset preprocess are based on Neuralangelo scripts. Evaluation scripts for DTU and Tanks and Temples dataset are based on DTUeval-python and TanksAndTemples respectively. We thank all the authors for their great work and repos.
Citation
If you find this code useful for your research, please use the following BibTeX entry.
@article{chen2024pgsr,
title={PGSR: Planar-based Gaussian Splatting for Efficient and High-Fidelity Surface Reconstruction},
author={Chen, Danpeng and Li, Hai and Ye, Weicai and Wang, Yifan and Xie, Weijian and Zhai, Shangjin and Wang, Nan and Liu, Haomin and Bao, Hujun and Zhang, Guofeng},
journal={arXiv preprint arXiv:2406.06521},
year={2024}
}
Release files for pgsr 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pgsr-1.0.0.tar.gz | 27.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pgsr-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 64.0 kB
Release files / pgsr-1.0.0.tar.gz
| Download URL | pgsr-1.0.0.tar.gz |
|---|---|
| Size | 27.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2857829f83ae204fdd926c77db1a169b65f770b88bee4f53cff45a2cff0cfe35
|
|
BLAKE2b-256 checksum How to use checksums |
919ec068289ada5bf84c71c4190f4799f89dd9bd5c2c6aa446bb0c899b03d8e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / pgsr-1.0.0-py3-none-any.whl
| Download URL | pgsr-1.0.0-py3-none-any.whl |
|---|---|
| Size | 36.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43d4a2e71b4068715980e70393e0e4032a1e2c3595071a2b8c83a62e26894d8d
|
|
BLAKE2b-256 checksum How to use checksums |
c42da397bb378216a41e102c81b1b44d4daf0c594353b458785bba927779c8a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency log