Planar-based Gaussian Splatting Reconstruction utilities built on gaussian-splatting.
Project description
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}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pgsr-1.0.0.tar.gz.
File metadata
- Download URL: pgsr-1.0.0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2857829f83ae204fdd926c77db1a169b65f770b88bee4f53cff45a2cff0cfe35
|
|
| MD5 |
e4de303d1582c17fd2259ce7b7dc516c
|
|
| BLAKE2b-256 |
919ec068289ada5bf84c71c4190f4799f89dd9bd5c2c6aa446bb0c899b03d8e3
|
Provenance
The following attestation bundles were made for pgsr-1.0.0.tar.gz:
Publisher:
build-release.yml on yindaheng98/PGSR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgsr-1.0.0.tar.gz -
Subject digest:
2857829f83ae204fdd926c77db1a169b65f770b88bee4f53cff45a2cff0cfe35 - Sigstore transparency entry: 2342189707
- Sigstore integration time:
-
Permalink:
yindaheng98/PGSR@497f926782753558c2f0d5d19c0234088c52a058 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yindaheng98
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@497f926782753558c2f0d5d19c0234088c52a058 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgsr-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pgsr-1.0.0-py3-none-any.whl
- Upload date:
- Size: 36.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43d4a2e71b4068715980e70393e0e4032a1e2c3595071a2b8c83a62e26894d8d
|
|
| MD5 |
1b52ca796b3c0e9c1a9737112274da6d
|
|
| BLAKE2b-256 |
c42da397bb378216a41e102c81b1b44d4daf0c594353b458785bba927779c8a3
|
Provenance
The following attestation bundles were made for pgsr-1.0.0-py3-none-any.whl:
Publisher:
build-release.yml on yindaheng98/PGSR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgsr-1.0.0-py3-none-any.whl -
Subject digest:
43d4a2e71b4068715980e70393e0e4032a1e2c3595071a2b8c83a62e26894d8d - Sigstore transparency entry: 2342189710
- Sigstore integration time:
-
Permalink:
yindaheng98/PGSR@497f926782753558c2f0d5d19c0234088c52a058 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yindaheng98
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@497f926782753558c2f0d5d19c0234088c52a058 -
Trigger Event:
push
-
Statement type: