Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ PGSR Public
forked from zju3dv/PGSR

[TVCG2024] PGSR: Planar-based Gaussian Splatting for Efficient and High-Fidelity Surface Reconstruction

License

TATP-233/PGSR

 
 

Repository files navigation

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

Teaser image

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

Installation

The repository contains submodules, thus please check it out with

# SSH
git clone [email protected]:zju3dv/PGSR.git
cd PGSR

conda create -n pgsr python=3.8
conda activate pgsr

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 #replace your cuda version
pip install -r requirements.txt
pip install submodules/diff-plane-rasterization
pip install submodules/simple-knn

Dataset Preprocess

Please download the preprocessed DTU dataset from 2DGS, the Tanks and Temples dataset from official webiste, the Mip-NeRF 360 dataset from the official webiste. You need to download the ground truth point clouds from the DTU dataset. For the Tanks and Temples dataset, you need to download the reconstruction, alignment and cropfiles from the official webiste.

The data folder should like this:

data
├── dtu_dataset
│   ├── dtu
│   │   ├── scan24
│   │   │   ├── images
│   │   │   ├── mask
│   │   │   ├── sparse
│   │   │   ├── cameras_sphere.npz
│   │   │   └── cameras.npz
│   │   └── ...
│   ├── dtu_eval
│   │   ├── Points
│   │   │   └── stl
│   │   └── ObsMask
├── tnt_dataset
│   ├── tnt
│   │   ├── Ignatius
│   │   │   ├── images_raw
│   │   │   ├── Ignatius_COLMAP_SfM.log
│   │   │   ├── Ignatius_trans.txt
│   │   │   ├── Ignatius.json
│   │   │   ├── Ignatius_mapping_reference.txt
│   │   │   └── Ignatius.ply
│   │   └── ...
└── MipNeRF360
    ├── bicycle
    └── ...

Then run the scripts to preprocess Tanks and Temples dataset:

# Install COLMAP
Refer to https://colmap.github.io/install.html

# Tanks and Temples dataset
python scripts/preprocess/convert_tnt.py --tnt_path your_tnt_path

Training and Evaluation

# Fill in the relevant parameters in the script, then run it.

# DTU dataset
python scripts/run_dtu.py

# Tanks and Temples dataset
python scripts/run_tnt.py

# Mip360 dataset
python scripts/run_mip360.py

Custom Dataset

The data folder should like this:

data
├── data_name1
│   └── input
│       ├── *.jpg/*.png
│       └── ...
├── data_name2
└── ...

Then run the following script to preprocess the dataset and to train and test:

# Preprocess dataset
python scripts/preprocess/convert.py --data_path your_data_path

Some Suggestions:

  • Adjust the threshold for selecting the nearest frame in ModelParams based on the dataset;
  • -r n: Downsample the images by a factor of n to accelerate the training speed;
  • --max_abs_split_points 0: For weakly textured scenes, to prevent overfitting in areas with weak textures, we recommend disabling this splitting strategy by setting it to 0;
  • --opacity_cull_threshold 0.05: To reduce the number of Gaussian point clouds in a simple way, you can set this threshold.
# Training
python train.py -s data_path -m out_path --max_abs_split_points 0 --opacity_cull_threshold 0.05

Some Suggestions:

  • Adjust max_depth and voxel_size based on the dataset;
  • --use_depth_filter: Enable depth filtering to remove potentially inaccurate depth points using single-view and multi-view techniques. For scenes with floating points or insufficient viewpoints, it is recommended to turn this on.
# Rendering and Extract Mesh
python render.py -m out_path --max_depth 10.0 --voxel_size 0.01

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}
}

LiDAR-PGSR

基于PGSR和LiDAR-RT的高精度LiDAR模拟项目

🎯 项目概述

本项目旨在结合PGSR (Planar Gaussian Splatting Reconstruction) 和 LiDAR-RT 的优势,实现高精度的LiDAR传感器模拟。通过PGSR的平面化高斯约束解决LiDAR-RT中高斯基元"飘在空中"的问题,显著提升几何精度和物理真实性。

✨ 核心特性

  • 🔬 平面化高斯约束: 基于PGSR的几何正则化,确保高斯基元贴合真实表面
  • 🌊 LiDAR物理建模: 使用球谐函数建模intensity和ray-drop的方向相关性
  • 📊 多通道渲染: 同时输出深度、强度、ray-drop等多维LiDAR信息
  • ⚙️ 配置化管理: 层次化YAML配置系统,支持复杂实验管理
  • 🚀 高效训练: 优化的训练管线,支持大规模场景重建

🏗️ 项目架构

PGSR/
├── configs/                    # 配置文件系统
│   ├── base.yaml              # 基础配置
│   ├── kitti360/              # KITTI-360数据集配置
│   │   ├── kitti360_base.yaml # 数据集基础配置
│   │   └── static/            # 静态场景配置
│   │       └── seq00.yaml     # 序列00配置
│   └── quick_test.yaml        # 快速测试配置
├── utils/
│   ├── config_utils.py        # 配置解析工具
│   └── lidar_loss_utils.py    # LiDAR损失函数
├── gaussian_renderer/
│   └── lidar_renderer.py      # LiDAR渲染器
├── scene/
│   ├── gaussian_model.py      # 扩展的高斯模型(支持LiDAR)
│   └── kitti360_dataset.py    # KITTI-360数据加载器
├── train_lidar_config.py      # 配置化训练脚本
└── agent/                     # 项目文档
    ├── guide.md               # 项目指南
    ├── tasks.md               # 任务清单
    ├── log.md                 # 工作日志
    ├── pgsr_simplified.md     # PGSR技术要点
    └── lidar_rt_simplified.md # LiDAR-RT技术要点

🚀 快速开始

环境要求

# 创建conda环境
conda create -n pgsr python=3.8
conda activate pgsr

# 安装依赖
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 -f https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.txt

# 编译CUDA扩展
cd submodules/diff-gaussian-rasterization
pip install -e .
cd ../simple-knn
pip install -e .

配置化训练

# 快速测试 (1000轮训练)
python train_lidar_config.py -c configs/quick_test.yaml

# KITTI-360完整训练
python train_lidar_config.py -c configs/kitti360/static/seq00.yaml

# 自定义实验名称
python train_lidar_config.py -c configs/quick_test.yaml --exp_name my_experiment

# 命令行参数覆盖
python train_lidar_config.py -c configs/base.yaml --exp_name test_5k opt.iterations 5000

📁 配置文件系统

层次化配置设计

本项目采用层次化的YAML配置系统,支持配置继承和参数覆盖:

# configs/quick_test.yaml
parent_config: "kitti360/kitti360_base.yaml"  # 继承KITTI-360配置

scene_id: "quick_test"
exp_name: "quick_debug"

opt:
  iterations: 1000                # 覆盖父配置的训练轮数
  densification_interval: 50      # 更频繁的密化

配置文件说明

  • base.yaml: 包含所有PGSR和LiDAR参数的基础配置
  • kitti360/kitti360_base.yaml: KITTI-360数据集特化参数
  • kitti360/static/seq00.yaml: 序列00的具体场景配置
  • quick_test.yaml: 开发调试用的快速测试配置

核心参数说明

# 模型参数
model:
  sh_degree: 3                   # 球谐函数阶数
  enable_lidar: true             # 启用LiDAR模式
  planar_constraint: true        # PGSR平面约束
  geometric_regularization: true # 几何正则化

# LiDAR损失权重
opt:
  lambda_depth_l1: 0.1          # 深度L1损失
  lambda_intensity_l1: 0.85     # 强度L1损失  
  lambda_raydrop_bce: 0.01      # Ray-drop BCE损失
  lambda_planar: 100.0          # PGSR平面化损失

📊 技术特点

PGSR几何约束

  • 平面化损失: 约束高斯基元的最小scale接近0,形成平面结构
  • 无偏深度渲染: 基于平面参数计算精确深度,避免curved surface问题
  • 多视图几何约束: 确保多视角几何一致性

LiDAR物理建模

  • 球谐函数建模: 使用球谐函数表示intensity和ray-drop的方向相关性
  • 概率遮挡模型: 基于Sigmoid函数的ray-drop概率建模
  • 360度支持: 完整支持360度LiDAR视场角

🚀 项目状态

当前进度: 85% 完成

✅ 已完成阶段

  • 阶段1: 项目设置和环境准备 (100%完成)
  • 阶段2: 核心功能迁移 (100%完成)
  • 配置文件系统: 实验管理标准化 (100%完成)
  • 阶段3: PGSR几何约束集成 (100%完成) 🆕

🚧 当前阶段

  • 阶段4: 系统优化和测试 (进行中)
    • 无偏深度渲染优化
    • 损失函数权重平衡调优
    • KITTI-360完整训练测试
    • 性能基准测试和对比

🆕 阶段3新增功能

PGSR几何约束集成

  • 平面化约束: 通过compute_planar_loss()约束高斯基元为平面状
  • 单视图几何正则化: 确保渲染法向量与深度法向量一致性
  • 边缘感知约束: 在图像边缘区域减少几何约束强度
  • 完整PGSR损失工具: utils/pgsr_loss_utils.py提供完整几何约束功能
  • 配置化管理: 所有PGSR参数通过YAML配置文件管理

核心改进

  • 解决了LiDAR-RT中高斯基元"飘在空中"的问题
  • 显著提升了几何渲染精度和真实性
  • 实现了完整的PGSR+LiDAR联合训练管线

📈 项目进度

  • 阶段1: 环境搭建和代码分析 (已完成)
  • 阶段2: LiDAR-RT核心功能迁移 (已完成)
  • 配置系统: 实验管理标准化 (已完成)
  • 🚧 阶段3: PGSR几何约束集成 (进行中)
  • 阶段4: 系统集成和测试
  • 阶段5: 文档和发布

详细进度请查看 任务清单工作日志

🔧 开发指南

添加新的配置

  1. configs/目录下创建新的YAML文件
  2. 使用parent_config指定继承的父配置
  3. 只覆盖需要修改的参数

扩展LiDAR属性

  1. GaussianModel中添加新的球谐系数属性
  2. lidar_renderer.py中实现对应的渲染逻辑
  3. 在损失函数中添加对应的监督信号

调试和测试

# 使用快速配置进行开发测试
python train_lidar_config.py -c configs/quick_test.yaml --exp_name debug_test

# 启用异常检测
python train_lidar_config.py -c configs/quick_test.yaml --detect_anomaly

📖 相关论文

  • PGSR: Planar Gaussian Splatting for High-Quality Surface Reconstruction
  • LiDAR-RT: Real-time LiDAR Point Cloud Simulation using Gaussian Splatting

🤝 贡献指南

  1. Fork 项目
  2. 创建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

📄 许可证

本项目基于 MIT 许可证开源 - 查看 LICENSE 文件了解详情。

🙏 致谢

感谢PGSR和LiDAR-RT项目的开源贡献,为本项目提供了重要的技术基础。

About

[TVCG2024] PGSR: Planar-based Gaussian Splatting for Efficient and High-Fidelity Surface Reconstruction

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 77.2%
  • Cuda 18.2%
  • C++ 4.2%
  • Other 0.4%