This repository based on the official authors implementation associated with the paper "3D Gaussian Splatting for Real-Time Radiance Field Rendering", which can be found here.
@Article{kerbl3Dgaussians,
author = {Kerbl, Bernhard and Kopanas, Georgios and Leimk{\"u}hler, Thomas and Drettakis, George},
title = {3D Gaussian Splatting for Real-Time Radiance Field Rendering},
journal = {ACM Transactions on Graphics},
number = {4},
volume = {42},
month = {July},
year = {2023},
url = {https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/}
}The repository contains submodules, thus please check it out with
# HTTPS
git clone https://github.com/Kwak-MJ/gaussian-splatting --recursiveIf you need to create colmap data yourself, you can use convert.py . To perform convert.py , you must configure the data directory as follows.
<location>
|---input
|---<image 0>
|---<image 1>
|---...
If you have COLMAP on your system path, now you can simply run
python convert.py -s <location>Command Line Arguments for convert.py
Flag to avoid using GPU in COLMAP.
Flag to indicate that COLMAP info is available for images.
Location of the inputs.
Which camera model to use for the early matching steps, OPENCV by default.
Flag for creating resized versions of input images.
Path to the COLMAP executable (.bat on Windows).
Path to the ImageMagick executable.
Our COLMAP loaders expect the following dataset structure in the source path location:
<location>
|---images
| |---<image 0>
| |---<image 1>
| |---...
|---sparse
|---0
|---cameras.bin
|---images.bin
|---points3D.bin
If you have mirror mask dataset and want to get mirror plane equation by using these mask datasets, just add the "masks" directory like below. (Mask dataset should represent mirror plane by "white" and the other part by "black"):
<location>
|---images
| |---<image 0>
| |---<image 1>
| |---...
|---masks
| |---<image 0>
| |---<image 1>
| |---...
|---sparse
|---0
|---cameras.bin
|---images.bin
|---points3D.bin
To run the train.py, use one out of two below
python train.py -s <path to COLMAP or NeRF Synthetic dataset> --render_mask True # if you have mirror mask datasets, and you want to get mirror plane equation
python train.py -s <path to COLMAP or NeRF Synthetic dataset> # when you don't have mask datasets or don't need to get mirror plane equation (render_mask=False is default)
Command Line Arguments for train.py
Path to the source directory containing a COLMAP or Synthetic NeRF data set.
Path where the trained model should be stored (output/<random> by default).
Make it True, if you want to get the mirror mask rendering and the mirror plane equation (False by default)
Alternative subdirectory for COLMAP images (images by default).
Add this flag to use a MipNeRF360-style training/test split for evaluation.
Specifies resolution of the loaded images before training. If provided 1, 2, 4 or 8, uses original, 1/2, 1/4 or 1/8 resolution, respectively. For all other values, rescales the width to the given number while maintaining image aspect. If not set and input image width exceeds 1.6K pixels, inputs are automatically rescaled to this target.
Specifies where to put the source image data, cuda by default, recommended to use cpu if training on large/high-resolution dataset, will reduce VRAM consumption, but slightly slow down training. Thanks to HrsPythonix.
Add this flag to use white background instead of black (default), e.g., for evaluation of NeRF Synthetic dataset.
Order of spherical harmonics to be used (no larger than 3). 3 by default.
Flag to make pipeline compute forward and backward of SHs with PyTorch instead of ours.
Flag to make pipeline compute forward and backward of the 3D covariance with PyTorch instead of ours.
Enables debug mode if you experience erros. If the rasterizer fails, a dump file is created that you may forward to us in an issue so we can take a look.
Debugging is slow. You may specify an iteration (starting from 0) after which the above debugging becomes active.
Number of total iterations to train for, 30_000 by default.
IP to start GUI server on, 127.0.0.1 by default.
Port to use for GUI server, 6009 by default.
Space-separated iterations at which the training script computes L1 and PSNR over test set, 7000 30000 by default.
Space-separated iterations at which the training script saves the Gaussian model, 7000 30000 <iterations> by default.
Space-separated iterations at which to store a checkpoint for continuing later, saved in the model directory.
Path to a saved checkpoint to continue training from.
Flag to omit any text written to standard out pipe.
Spherical harmonics features learning rate, 0.0025 by default.
Opacity learning rate, 0.05 by default.
Scaling learning rate, 0.005 by default.
Rotation learning rate, 0.001 by default.
Number of steps (from 0) where position learning rate goes from initial to final. 30_000 by default.
Initial 3D position learning rate, 0.00016 by default.
Final 3D position learning rate, 0.0000016 by default.
Position learning rate multiplier (cf. Plenoxels), 0.01 by default.
Iteration where densification starts, 500 by default.
Iteration where densification stops, 15_000 by default.
Limit that decides if points should be densified based on 2D position gradient, 0.0002 by default.
How frequently to densify, 100 (every 100 iterations) by default.
How frequently to reset opacity, 3_000 by default.
Influence of SSIM on total loss from 0 to 1, 0.2 by default.
Percentage of scene extent (0--1) a point must exceed to be forcibly densified, 0.01 by default.
To run the render.py, use one out of two below
python render.py -m <path to trained model> --render_mask True # if you trained with render_mask=True, it can be also set True in render.py (you will get rendered mirror mask)
python render.py -m <path to trained model> # if you trained with render_mask=False, you must set False in render.py (Although you trained with render_mask=True, you can set False if you want to)
Command Line Arguments for render.py
Path to the trained model directory you want to create renderings for.
Make it True, if you want to get rendered mirror mask. But only when you train with "render_mask=True" (False by default)
Flag to skip rendering the training set.
Flag to skip rendering the test set.
Flag to omit any text written to standard out pipe.
The below parameters will be read automatically from the model path, based on what was used for training. However, you may override them by providing them explicitly on the command line.
Path to the source directory containing a COLMAP or Synthetic NeRF data set.
Alternative subdirectory for COLMAP images (images by default).
Add this flag to use a MipNeRF360-style training/test split for evaluation.
Changes the resolution of the loaded images before training. If provided 1, 2, 4 or 8, uses original, 1/2, 1/4 or 1/8 resolution, respectively. For all other values, rescales the width to the given number while maintaining image aspect. 1 by default.
Add this flag to use white background instead of black (default), e.g., for evaluation of NeRF Synthetic dataset.
Flag to make pipeline render with computed SHs from PyTorch instead of ours.
Flag to make pipeline render with computed 3D covariance from PyTorch instead of ours.
By default, the trained models use all available images in the dataset. To train them while withholding a test set for evaluation, use the --eval flag. This way, you can render training/test sets and produce error metrics as follows:
python train.py -s <path to COLMAP or NeRF Synthetic dataset> -- --render_mask True # Train with train/test split, Set render_mask True if needed
python render.py -m <path to trained model> --render_mask True # Generate renderings, Set render_mask True if needed
python metrics.py -m <path to trained model> # Compute error metrics on renderingsCommand Line Arguments for metrics.py
Space-separated list of model paths for which metrics should be computed.
We provide two interactive viewers for our method: remote and real-time. Our viewing solutions are based on the SIBR framework, developed by the GRAPHDECO group for several novel-view synthesis projects.
realtimeviewer.mp4
After extracting or installing the viewers, you may run the compiled SIBR_gaussianViewer_app[_config] app in <SIBR install dir>/bin, e.g.:
./<SIBR install dir>/bin/SIBR_gaussianViewer_app -m <path to trained model>