Home

Awesome

Trim 3D Gaussian Splatting for Accurate Geometry Representation

Teaser image

More demonstrations can be found on our project page and arXiv paper.

Updates

Installation

git clone git@github.com:YuxueYang1204/TrimGS.git --recursive
# Here we comment out the pip install Trim2DGS/submodules/simple-knn in environment.yml, since it is the same as the one in Trim3DGS
conda env create -f environment.yml
conda activate trimgs

Note: We modify the differentiable rasterization kernel to support contribution-based trimming, which can be found in diff-gaussian-rasterization (for Trim3DGS) and diff-surfel-rasterization (for Trim2DGS).

Dataset Preparation

DTU

For geometry reconstruction on DTU dataset, please download the preprocessed data (only dtu.tar.gz is needed). You also need to download the ground truth DTU point cloud SampleSet.zip and Points.zip from the DTU official website.

mkdir data && cd data
mkdir dtu_dataset
# prepare the dtu dataset
tar -xvf dtu.tar.gz -C dtu_dataset
# prepare the ground truth
unzip SampleSet.zip
# remove the incomplete points and unzip the complete points
rm -r SampleSet/MVS\ Data/Points
unzip Points.zip -d SampleSet/MVS\ Data
mv SampleSet/MVS\ Data dtu_dataset/Official_DTU_Dataset

MipNeRF360

For novel view synthesis on MipNeRF360, please download the 360_v2.zip and 360_extra_scenes.zip from MipNeRF360.

cd data
mkdir MipNeRF360
unzip 360_v2.zip -d MipNeRF360
unzip 360_extra_scenes.zip -d MipNeRF360

TnT

For geometry reconstruction on TnT dataset, please download the preprocessed TnT_data. You also need to download the ground truth Results on training set.

cd data
unzip TNT_GOF.zip
unzip trainingdata.zip -d TNT_GOF/ground_truth

Due to the requirement conflict of open3d, we need to create a new environment for TnT evaluation:

conda create -n tnt_eval python=3.8 -y
conda activate tnt_eval
pip install open3d==0.10
pip install trimesh

Now the data folder should look like this:

data
├── dtu_dataset
│   ├── DTU
│   │   ├── scan24
│   │   ├── ...
│   │   └── scan122
│   └── Official_DTU_Dataset
│       ├── Points
│       │   └── stl
│       └── ObsMask
├── MipNeRF360
│   ├── bicycle
│   └── ...
└── TNT_GOF
    ├── ground_truth
    │   ├── Barn
    │   └── ...
    └── TrainingSet
        ├── Barn
        └── ...

Then link the data folder to the Trim3DGS and Trim2DGS:

ln -s data Trim3DGS/data
ln -s data Trim2DGS/data

Training and Evaluation

Trim3DGS

cd Trim3DGS
# train DTU dataset
python scripts/run_dtu.py
# print the evaluation results
python print_results.py -o output/DTU_Trim3DGS --dataset dtu
# the extracted mesh of DTU dataset can be found in `output/DTU_Trim3DGS/scan${scene_id}/tsdf/ours_7000/mesh_post.ply`

# MiNeRF360
python scripts/run_Mipnerf360.py
# print the evaluation results
python print_results.py -o output/MipNeRF360_Trim3DGS --dataset mipnerf360

Trim2DGS

cd Trim2DGS
# DTU dataset
# train 2DGS 30K and finetune Trim2DGS 7K
python scripts/run_dtu.py
# or you can train Trim2DGS from scratch
python Trim2DGS/scripts/train_from_scratch/run_dtu.py
# print the evaluation results
python print_results.py -o output/DTU_Trim2DGS --dataset dtu
# the extracted mesh of DTU dataset can be found in `output/DTU_Trim2DGS/scan${scene_id}/train/ours_7000/fuse_post.ply`

# MiNeRF360
# train 2DGS 30K and finetune Trim2DGS 7K
python scripts/run_Mipnerf360.py
# or you can train Trim2DGS from scratch
python Trim2DGS/scripts/train_from_scratch/run_Mipnerf360.py
# print the evaluation results
python print_results.py -o output/MipNeRF360_Trim2DGS --dataset mipnerf360

# TnT
python scripts/run_TNT.py
# evaluate the results
conda activate tnt_eval
python scripts/eval_TNT.py
python print_results.py -o output/TNT_Trim2DGS --dataset tnt

We provide the meshes of DTU dataset from Trim3DGS and Trim2DGS for evaluation.

Thank hbb1 for his kind suggestion on Trim2DGS in https://github.com/YuxueYang1204/TrimGS/issues/1, resulting in a better performance.

<details> <summary><span style="font-weight: bold;">Table Results</span></summary>

Chamfer distance on DTU dataset (lower is better)

243740556365698397105106110114118122Mean
2DGS (Paper)0.480.910.390.391.010.830.811.361.270.760.701.400.400.760.520.80
2DGS (Reproduce)0.460.800.330.370.950.860.801.251.240.670.671.240.390.640.470.74
Trim2DGS (Paper)0.480.820.440.450.950.750.741.181.130.720.700.990.420.620.500.72
Trim2DGS (Reproduce)0.450.720.330.400.970.720.731.211.140.610.671.010.410.600.440.69
</details>

We provide geometry evaluation results of Trim2DGS on TnT dataset test-set.

<details> <summary><span style="font-weight: bold;">Table Results</span></summary>

F1 scores on TnT dataset (higher is better)

BarnCaterpillarIgnatiusTruckMeetingroomCourthouseMean
2DGS0.300.250.540.500.190.130.32
Trim2DGS0.310.300.610.560.200.180.36
</details>

Todo

Acknowledgements

We sincerely thank the authors of the great works 3D Gaussian Splatting and 2D Gaussian Splatting. Our Trim3DGS and Trim2DGS are built upon these foundations.

The running scripts are adapted from GOF and the evaluation scripts for DTU and Tanks and Temples dataset are taken from DTUeval-python and TanksAndTemples respectively.

We thank all the authors for their great work and repos.

Citation

Please consider citing our work as follows if it is helpful.

@article{fan2024trim,
  author    = {Fan, Lue and Yang, Yuxue and Li, Minxing and Li, Hongsheng and Zhang, Zhaoxiang},
  title     = {Trim 3D Gaussian Splatting for Accurate Geometry Representation},
  journal   = {arXiv preprint arXiv:2406.07499},
  year      = {2024},
}