How graphdeco-inria/reduced-3dgs works
Project type and purpose
• This is a research-oriented, full-stack 3D graphics and machine-learning codebase for “Reducing the Memory Footprint of 3D Gaussian Splatting.”
• It combines a Python/CUDA training pipeline (PyTorch + custom C++ extensions), data-conversion utilities, evaluation scripts, and two interactive viewer applications (built with SIBR in C++/OpenGL).
File structure
• Top-level scripts:
• train.py, full_eval.py, render.py, metrics.py — orchestrate training, evaluation, rendering, metrics.
• convert.py, update_old_ply_format.py — data conversion (COLMAP→undistorted images, legacy PLY→new quantized PLY).
• Core modules:
• scene/ — dataset loaders (COLMAP, NeRF), camera models, Gaussian model.
• gaussian_renderer/ — Python interface + network GUI to the differentiable rasterizer.
• lpipsPyTorch/ — LPIPS perceptual-loss module.
• utils/ — camera, image, graphics, loss, profiling, system, visualization helpers.
• submodules/diff-gaussian-rasterization — C++/CUDA PyTorch extension for rasterizing Gaussians.
• submodules/simple-knn — CUDA extension for nearest-neighbor search.
• Viewer code: SIBR_viewers/ contains two C++ applications built with CMake; one for remote network viewing, one for local real-time viewing.
• Configuration: environment.yml, CMakeLists.txt under submodules, .gitmodules, scripts for building submodules.
Extract architectural insights from the README
• Data flow: raw images + COLMAP data → convert.py → structured dataset → train.py →
• uses scene loaders + differentiable rasterizer extension + PyTorch optimizer →
• outputs trained model (directory with .ply files + checkpoints + codebooks) →
• evaluation (render.py + metrics.py + full_eval.py)
• interactive monitoring via gaussian_renderer/network_gui.py ← train.py (opens TCP server on port 6009).
• Quantization pipeline: PLY format manipulation, codebook entries appended to files, half-float storage.
• Viewer apps connect to the training pipeline or read final models for visualization.
Main components and their interactions
a. Data Ingestion & Conversion
• convert.py reads raw images & COLMAP outputs → produces undistorted/resized images + camera metadata.
• update_old_ply_format.py transforms legacy PLY to new quantized format.
b. Training Pipeline
• train.py (Python)
• Imports scene/, gaussian_renderer/, lpipsPyTorch/, utils/
• Builds and calls C++ CUDA extensions (diff-gaussian-rasterization, simple-knn) via PyTorch’s extension mechanism
• Launches network GUI server (gaussian_renderer/network_gui.py) for real-time training visualization.
• Saves model state (.ply + codebooks + checkpoints) and logs.
c. Evaluation & Results
• render.py: loads trained model → uses same CUDA rasterizer → renders novel views → saves images.
• metrics.py: loads rendered images → computes L1, PSNR, LPIPS.
• full_eval.py: orchestrates train/render/metrics over multiple datasets and experiments.
• generate_results.py: collates final numbers and plots.
d. Interactive Viewers (Presentation Layer)
• SIBR_remoteGaussian_app: connects to the network GUI server on training machine → displays splats.
• SIBR_gaussianViewer_app: standalone real-time viewer reading a saved model → OpenGL + CUDA interop.
e. Third-party services & dependencies
• PyTorch (with CUDA), COLMAP, ImageMagick, OpenGL 4.5, CMake, Visual Studio/g++, Conda.
Architectural patterns & design principles
• Layered separation:
• Data layer (datasets, conversions)
• Compute layer (Python orchestration + C++/CUDA extensions)
• Presentation layer (network GUI, C++ viewers)
• Extension modules: clean separation of CUDA-accelerated rasterizer and K-NN as PyTorch extensions.
• Modular CLI: each Python script focuses on a single concern (train, render, metrics, convert).
• Clear data formats: PLY files with appended codebooks, half-float quantization.
Detailed elements to capture
• Python scripts: train.py, render.py, metrics.py, full_eval.py, convert.py, update_old_ply_format.py
• Modules: scene/, gaussian_renderer/, utils/, lpipsPyTorch/
• Submodules: diff-gaussian-rasterization, simple-knn
• Data: raw images + COLMAP sparse, converted dataset, trained model directory (.ply + codebooks), rendered images, metric logs
• Viewers: network GUI server (Python), SIBR_remoteGaussian_app, SIBR_gaussianViewer_app
• External: PyTorch/CUDA, COLMAP, ImageMagick, OpenGL, CMake/compilers, Conda environment