gaussian-splatting/README.md

479 lines
30 KiB
Markdown
Raw Normal View History

2023-07-04 08:00:48 +00:00
# 3D Gaussian Splatting for Real-Time Radiance Field Rendering
Bernhard Kerbl*, Georgios Kopanas*, Thomas Leimkühler, George Drettakis (* indicates equal contribution)<br>
2023-07-04 15:48:37 +00:00
| [Webpage](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/) | [Full Paper](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/3d_gaussian_splatting_high.pdf) |
2023-07-09 13:42:15 +00:00
[Video](https://youtu.be/T_kXY43VZnk) | [Other GRAPHDECO Publications](http://www-sop.inria.fr/reves/publis/gdindex.php) | [FUNGRAPH project page](https://fungraph.inria.fr) |
2023-07-04 15:48:37 +00:00
2023-07-10 16:14:40 +00:00
| [T&T+DB COLMAP (650MB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/input/tandt_db.zip) | [Pre-trained Models (14 GB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/pretrained/models.zip) | [Viewers for Windows (60MB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/binaries/viewers.zip) | [Evaluation Images (7 GB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/evaluation/images.zip) | <br>
2023-07-04 08:00:48 +00:00
![Teaser image](assets/teaser.png)
2023-07-09 15:30:28 +00:00
This repository contains the official authors implementation associated with the paper "3D Gaussian Splatting for Real-Time Radiance Field Rendering", which can be found [here](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/). We further provide the reference images used to create the error metrics reported in the paper, as well as recently created, pre-trained models.
2023-07-04 08:00:48 +00:00
<a href="https://www.inria.fr/"><img height="100" src="assets/logo_inria.png"> </a>
<a href="https://univ-cotedazur.eu/"><img height="100" src="assets/logo_uca.png"> </a>
2023-07-04 09:31:42 +00:00
<a href="https://www.mpi-inf.mpg.de"><img height="100" src="assets/logo_mpi.png"> </a>
<a href="https://team.inria.fr/graphdeco/"> <img style="width:100%;" src="assets/logo_graphdeco.png"></a>
2023-07-04 08:00:48 +00:00
Abstract: *Radiance Field methods have recently revolutionized novel-view synthesis of scenes captured with multiple photos or videos. However, achieving high visual quality still requires neural networks that are costly to train and render, while recent faster methods inevitably trade off speed for quality. For unbounded and complete scenes (rather than isolated objects) and 1080p resolution rendering, no current method can achieve real-time display rates. We introduce three key elements that allow us to achieve state-of-the-art visual quality while maintaining competitive training times and importantly allow high-quality real-time (≥ 30 fps) novel-view synthesis at 1080p resolution. First, starting from sparse points produced during camera calibration, we represent the scene with 3D Gaussians that preserve desirable properties of continuous volumetric radiance fields for scene optimization while avoiding unnecessary computation in empty space; Second, we perform interleaved optimization/density control of the 3D Gaussians, notably optimizing anisotropic covariance to achieve an accurate representation of the scene; Third, we develop a fast visibility-aware rendering algorithm that supports anisotropic splatting and both accelerates training and allows realtime rendering. We demonstrate state-of-the-art visual quality and real-time rendering on several established datasets.*
<section class="section" id="BibTeX">
<div class="container is-max-desktop content">
<h2 class="title">BibTeX</h2>
<pre><code>@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/}
}</code></pre>
</div>
</section>
## Funding and Acknowledgments
This research was funded by the ERC Advanced grant FUNGRAPH No 788065. The authors are grateful to Adobe for generous donations, the OPAL infrastructure from Université Côte dAzur and for the HPC resources from GENCIIDRIS (Grant 2022-AD011013409). The authors thank the anonymous reviewers for their valuable feedback, P. Hedman and A. Tewari for proofreading earlier drafts also T. Müller, A. Yu and S. Fridovich-Keil for helping with the comparisons.
## Cloning the Repository
2023-07-07 16:36:17 +00:00
The repository contains submodules, thus please check it out with
2023-07-04 09:31:42 +00:00
```shell
2023-07-07 16:36:17 +00:00
# SSH
git clone git@github.com:graphdeco-inria/gaussian-splatting.git --recursive
```
or
```shell
# HTTPS
2023-07-04 09:31:42 +00:00
git clone https://github.com/graphdeco-inria/gaussian-splatting --recursive
2023-07-04 08:00:48 +00:00
```
## Overview
The codebase has 4 main components:
- A PyTorch-based optimizer to produce a 3D Gaussian model from SfM inputs
- A network viewer that allows to connect to and visualize the optimization process
- An OpenGL-based real-time viewer to render trained models in real-time.
- A script to help you turn your own images into optimization-ready SfM data sets
2023-07-10 16:12:34 +00:00
The components have different requirements w.r.t. both hardware and software. They have been tested on Windows 10 and Ubuntu Linux 22.04. Instructions for setting up and running each of them are found in the sections below.
2023-07-04 08:00:48 +00:00
## Optimizer
The optimizer uses PyTorch and CUDA extensions in a Python environment to produce trained models.
### Hardware Requirements
- CUDA-ready GPU with Compute Capability 7.0+
2023-07-06 11:08:49 +00:00
- 24 GB VRAM (to train to paper evaluation quality)
- Please see FAQ for smaller VRAM configurations
2023-07-04 08:00:48 +00:00
2023-07-04 08:59:45 +00:00
### Software Requirements
- Conda (recommended for easy setup)
2023-07-11 18:05:11 +00:00
- C++ Compiler for PyTorch extensions (we used Visual Studio 2019 for Windows)
2023-07-14 19:09:46 +00:00
- CUDA SDK 11 for PyTorch extensions (we used 11.8, **known issues with 11.6**)
2023-07-06 17:42:28 +00:00
- C++ Compiler and CUDA SDK must be compatible
2023-07-04 08:00:48 +00:00
2023-07-04 08:59:45 +00:00
### Setup
2023-07-04 08:00:48 +00:00
2023-07-04 08:59:45 +00:00
Our provided install method is based on Conda package and environment management:
2023-07-04 08:00:48 +00:00
```shell
2023-07-04 21:53:02 +00:00
SET DISTUTILS_USE_SDK=1 # Windows only
2023-07-04 09:04:42 +00:00
conda env create --file environment.yml
2023-07-04 08:00:48 +00:00
conda activate gaussian_splatting
```
2023-07-14 19:09:46 +00:00
Please note that this process assumes that you have CUDA SDK **11** installed, not **12**. For modifications, see below.
2023-07-04 08:00:48 +00:00
Tip: Downloading packages and creating a new environment with Conda can require a significant amount of disk space. By default, Conda will use the main system hard drive. You can avoid this by specifying a different package download location and an environment on a different drive:
2023-07-04 08:00:48 +00:00
```shell
conda config --add pkgs_dirs <Drive>/<pkg_path>
2023-07-04 08:59:45 +00:00
conda env create --file environment.yml --prefix <Drive>/<env_path>/gaussian_splatting
2023-07-04 08:00:48 +00:00
conda activate <Drive>/<env_path>/gaussian_splatting
```
2023-07-14 19:09:46 +00:00
#### Modifications
If you can afford the disk space, we recommend using our environment files for setting up a training environment identical to ours. If you want to make modifications, please note that major version changes might affect the results of our method. However, our (limited) experiments suggest that the codebase works just fine inside a more up-to-date environment (Python 3.8, PyTorch 2.0.0, CUDA 12). Make sure to create an environment where PyTorch and its CUDA runtime version match and the installed CUDA SDK has no major version difference with PyTorch's CUDA version.
2023-07-04 08:00:48 +00:00
### Running
To run the optimizer, simply use
```shell
2023-07-06 16:46:58 +00:00
python train.py -s <path to COLMAP or NeRF Synthetic dataset>
2023-07-04 08:00:48 +00:00
```
2023-07-05 13:42:08 +00:00
<details>
2023-07-05 13:49:13 +00:00
<summary><span style="font-weight: bold;">Command Line Arguments for train.py</span></summary>
2023-07-05 13:42:08 +00:00
2023-07-05 13:58:51 +00:00
#### --source_path / -s
2023-07-05 13:42:08 +00:00
Path to the source directory containing a COLMAP or Synthetic NeRF data set.
2023-07-05 13:58:51 +00:00
#### --model_path / -m
2023-07-05 13:42:08 +00:00
Path where the trained model should be stored (```output/<random>``` by default).
2023-07-05 13:58:51 +00:00
#### --images / -i
2023-07-05 13:42:08 +00:00
Alternative subdirectory for COLMAP images (```images``` by default).
2023-07-05 13:58:51 +00:00
#### --eval
2023-07-05 13:42:08 +00:00
Add this flag to use a MipNeRF360-style training/test split for evaluation.
2023-07-05 13:58:51 +00:00
#### --resolution / -r
2023-07-09 14:08:01 +00:00
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.**
2023-07-12 19:25:21 +00:00
#### --data_device
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.
2023-07-05 13:58:51 +00:00
#### --white_background / -w
2023-07-05 13:42:08 +00:00
Add this flag to use white background instead of black (default), e.g., for evaluation of NeRF Synthetic dataset.
2023-07-05 13:58:51 +00:00
#### --sh_degree
2023-07-05 13:42:08 +00:00
Order of spherical harmonics to be used (no larger than 3). ```3``` by default.
2023-07-05 13:58:51 +00:00
#### --convert_SHs_python
2023-07-05 13:42:08 +00:00
Flag to make pipeline compute forward and backward of SHs with PyTorch instead of ours.
2023-07-05 13:58:51 +00:00
#### --convert_cov3D_python
2023-07-05 13:42:08 +00:00
Flag to make pipeline compute forward and backward of the 3D covariance with PyTorch instead of ours.
2023-07-05 13:58:51 +00:00
#### --iterations
2023-07-05 13:42:08 +00:00
Number of total iterations to train for, ```30_000``` by default.
2023-07-14 19:34:59 +00:00
#### --ip
IP to start GUI server on, ```127.0.0.1``` by default.
#### --port
Port to use for GUI server, ```6009``` by default.
#### --test_iterations
Space-separated iterations at which the training script computes L1 and PSNR over test set, ```7000 30000``` by default.
#### --save_iterations
Space-separated iterations at which the training script saves the Gaussian model, ```7000 30000 <iterations>``` by default.
#### --checkpoint_iterations
Space-separated iterations at which to store a checkpoint for continuing later, saved in the model directory.
#### --start_checkpoint
Path to a saved checkpoint to continue training from.
#### --quiet
Flag to omit any text written to standard out pipe.
2023-07-05 13:58:51 +00:00
#### --feature_lr
2023-07-05 13:42:08 +00:00
Spherical harmonics features learning rate, ```0.0025``` by default.
2023-07-05 13:58:51 +00:00
#### --opacity_lr
2023-07-05 13:42:08 +00:00
Opacity learning rate, ```0.05``` by default.
2023-07-05 13:58:51 +00:00
#### --scaling_lr
2023-07-05 13:42:08 +00:00
Scaling learning rate, ```0.001``` by default.
2023-07-05 13:58:51 +00:00
#### --rotation_lr
2023-07-05 13:42:08 +00:00
Rotation learning rate, ```0.001``` by default.
2023-07-05 13:58:51 +00:00
#### --position_lr_max_steps
2023-07-05 13:42:08 +00:00
Number of steps (from 0) where position learning rate goes from ```initial``` to ```final```. ```30_000``` by default.
2023-07-05 13:58:51 +00:00
#### --position_lr_init
2023-07-05 13:42:08 +00:00
Initial 3D position learning rate, ```0.00016``` by default.
2023-07-05 13:58:51 +00:00
#### --position_lr_final
2023-07-05 13:42:08 +00:00
Final 3D position learning rate, ```0.0000016``` by default.
2023-07-05 13:58:51 +00:00
#### --position_lr_delay_mult
2023-07-05 13:42:08 +00:00
Position learning rate multiplier (cf. Plenoxels), ```0.01``` by default.
2023-07-05 13:58:51 +00:00
#### --densify_from_iter
2023-07-05 13:42:08 +00:00
Iteration where densification starts, ```500``` by default.
2023-07-05 13:58:51 +00:00
#### --densify_until_iter
2023-07-05 13:42:08 +00:00
Iteration where densification stops, ```15_000``` by default.
2023-07-05 13:58:51 +00:00
#### --densify_grad_threshold
2023-07-05 13:42:08 +00:00
Limit that decides if points should be densified based on 2D position gradient, ```0.0002``` by default.
2023-07-05 13:58:51 +00:00
#### --densification_interal
2023-07-05 13:42:08 +00:00
How frequently to densify, ```100``` (every 100 iterations) by default.
2023-07-05 13:58:51 +00:00
#### --opacity_reset_interval
2023-07-05 13:42:08 +00:00
How frequently to reset opacity, ```3_000``` by default.
2023-07-05 13:58:51 +00:00
#### --lambda_dssim
2023-07-05 13:42:08 +00:00
Influence of SSIM on total loss from 0 to 1, ```0.2``` by default.
2023-07-05 13:58:51 +00:00
#### --percent_dense
2023-07-05 13:42:08 +00:00
Percentage of scene extent (0--1) a point must exceed to be forcibly densified, ```0.1``` by default.
</details>
<br>
2023-07-09 17:17:29 +00:00
Note that similar to MipNeRF360, we target images at resolutions in the 1-1.6K pixel range. For convenience, arbitrary-size inputs can be passed and will be automatically resized if their width exceeds 1600 pixels. We recommend to keep this behavior, but you may force training to use your higher-resolution images by setting ```-r 1```.
2023-07-04 08:00:48 +00:00
The MipNeRF360 scenes are hosted by the paper authors [here](https://jonbarron.info/mipnerf360/). You can find our SfM data sets for Tanks&Temples and Deep Blending [here](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/input/tandt+db.zip). If you do not provide an output model directory (```-m```), trained models are written to folders with randomized unique names inside the ```output``` directory. At this point, the trained models may be viewed with the real-time viewer (see further below).
2023-07-05 13:42:08 +00:00
2023-07-04 08:00:48 +00:00
### Evaluation
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:
```shell
2023-07-06 16:46:58 +00:00
python train.py -s <path to COLMAP or NeRF Synthetic dataset> --eval # Train with train/test split
2023-07-04 08:00:48 +00:00
python render.py -m <path to trained model> # Generate renderings
python metrics.py -m <path to trained model> # Compute error metrics on renderings
```
2023-07-10 18:10:42 +00:00
If you want to evaluate our [pre-trained models](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/pretrained/models.zip), you will have to download the corresponding source data sets and indicate their location to ```render.py``` with an additional ```--source_path/-s``` flag. Note: The pre-trained models were created with the release codebase. This code base has been cleaned up and includes bugfixes, hence the metrics you get from evaluating them will differ from those in the paper.
2023-07-05 23:49:18 +00:00
```shell
python render.py -m <path to pre-trained model> -s <path to COLMAP dataset>
python metrics.py -m <path to pre-trained model>
```
2023-07-05 13:42:08 +00:00
<details>
2023-07-05 13:58:51 +00:00
<summary><span style="font-weight: bold;">Command Line Arguments for render.py</span></summary>
2023-07-05 13:42:08 +00:00
2023-07-05 13:58:51 +00:00
#### --model_path / -m
2023-07-05 23:49:18 +00:00
Path to the trained model directory you want to create renderings for.
2023-07-05 13:58:51 +00:00
#### --skip_train
2023-07-05 13:42:08 +00:00
Flag to skip rendering the training set.
2023-07-05 13:58:51 +00:00
#### --skip_test
2023-07-05 13:42:08 +00:00
Flag to skip rendering the test set.
2023-07-05 13:58:51 +00:00
#### --quiet
2023-07-05 13:42:08 +00:00
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.**
2023-07-05 13:58:51 +00:00
#### --source_path / -s
2023-07-05 13:42:08 +00:00
Path to the source directory containing a COLMAP or Synthetic NeRF data set.
2023-07-05 13:58:51 +00:00
#### --images / -i
2023-07-05 13:42:08 +00:00
Alternative subdirectory for COLMAP images (```images``` by default).
2023-07-05 13:58:51 +00:00
#### --eval
2023-07-05 13:42:08 +00:00
Add this flag to use a MipNeRF360-style training/test split for evaluation.
2023-07-05 13:58:51 +00:00
#### --resolution / -r
2023-07-05 13:42:08 +00:00
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.
2023-07-05 13:58:51 +00:00
#### --white_background / -w
2023-07-05 13:42:08 +00:00
Add this flag to use white background instead of black (default), e.g., for evaluation of NeRF Synthetic dataset.
2023-07-05 13:58:51 +00:00
#### --convert_SHs_python
2023-07-05 13:42:08 +00:00
Flag to make pipeline render with computed SHs from PyTorch instead of ours.
2023-07-05 13:58:51 +00:00
#### --convert_cov3D_python
2023-07-05 13:42:08 +00:00
Flag to make pipeline render with computed 3D covariance from PyTorch instead of ours.
</details>
<details>
2023-07-05 13:58:51 +00:00
<summary><span style="font-weight: bold;">Command Line Arguments for metrics.py</span></summary>
2023-07-05 13:42:08 +00:00
2023-07-05 14:00:25 +00:00
#### --model_paths / -m
2023-07-05 13:42:08 +00:00
Space-separated list of model paths for which metrics should be computed.
</details>
<br>
2023-07-04 08:00:48 +00:00
We further provide the ```full_eval.py``` script. This script specifies the routine used in our evaluation and demonstrates the use of some additional parameters, e.g., ```--images (-i)``` to define alternative image directories within COLMAP data sets. If you have downloaded and extracted all the training data, you can run it like this:
2023-07-04 17:32:03 +00:00
```shell
python full_eval.py -m360 <mipnerf360 folder> -tat <tanks and temples folder> -db <deep blending folder>
2023-07-04 08:00:48 +00:00
```
2023-07-05 23:49:18 +00:00
In the current version, this process takes about 7h on our reference machine containing an A6000. If you want to do the full evaluation on our pre-trained models, you can specify their download location and skip training.
```shell
python full_eval.py -o <directory with pretrained models> --skip_training -m360 <mipnerf360 folder> -tat <tanks and temples folder> -db <deep blending folder>
```
2023-07-04 08:00:48 +00:00
2023-07-10 16:11:03 +00:00
If you want to compute the metrics on our paper's [evaluation images](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/evaluation/images.zip), you can also skip rendering. In this case it is not necessary to provide the source datasets. You can compute metrics for multiple image sets at a time.
```shell
python full_eval.py -m <directory with evaluation images>/garden ... --skip_training --skip_rendering
```
2023-07-05 23:49:18 +00:00
<details>
<summary><span style="font-weight: bold;">Command Line Arguments for full_eval.py</span></summary>
#### --skip_training
Flag to skip training stage.
#### --skip_rendering
Flag to skip rendering stage.
#### --skip_metrics
Flag to skip metrics calculation stage.
#### --output_path
Directory to put renderings and results in, ```./eval``` by default, set to pre-trained model location if evaluating them.
#### --mipnerf360 / -m360
Path to MipNeRF360 source datasets, required if training or rendering.
#### --tanksandtemples / -tat
Path to Tanks&Temples source datasets, required if training or rendering.
#### --deepblending / -db
Path to Deep Blending source datasets, required if training or rendering.
</details>
<br>
2023-07-04 08:00:48 +00:00
2023-07-05 23:49:18 +00:00
## Interactive Viewers
2023-07-09 13:21:30 +00:00
We provide two interactive iewers for our method: remote and real-time. Our viewing solutions are based on the [SIBR](https://sibr.gitlabpages.inria.fr/) framework, developed by the GRAPHDECO group for several novel-view synthesis projects.
2023-07-04 08:00:48 +00:00
### Hardware Requirements
- OpenGL 4.5-ready GPU
2023-07-06 11:08:49 +00:00
- 4 GB VRAM recommended
2023-07-08 15:36:57 +00:00
- CUDA-ready GPU with Compute Capability 7.0+ (only for Real-Time Viewer)
2023-07-04 08:00:48 +00:00
2023-07-04 08:59:45 +00:00
### Software Requirements
2023-07-11 18:58:19 +00:00
- Visual Studio or g++, **not Clang** (we used Visual Studio 2019 for Windows)
2023-07-11 18:05:11 +00:00
- CUDA SDK 11 (we used 11.8)
2023-07-04 11:47:38 +00:00
- CMake (recent version, we used 3.24)
2023-07-05 23:49:18 +00:00
- 7zip (only on Windows)
2023-07-04 08:59:45 +00:00
2023-07-06 11:08:49 +00:00
### Pre-built Windows Binaries
2023-07-06 16:46:58 +00:00
We provide pre-built binaries for Windows [here](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/binaries/viewers.zip). We recommend using them on Windows for an efficient setup, since the building of SIBR involves several external dependencies that must be downloaded and compiled on-the-fly.
2023-07-06 11:08:49 +00:00
### Installation from Source
2023-07-08 13:41:19 +00:00
If you cloned with submodules (e.g., using ```--recursive```), the source code for the viewers is found in ```SIBR_viewers```. The network viewer runs within the SIBR framework for Image-based Rendering applications.
2023-07-04 08:00:48 +00:00
#### Windows
2023-07-05 23:49:18 +00:00
CMake should take care of your dependencies.
2023-07-04 08:00:48 +00:00
```shell
2023-07-08 13:41:19 +00:00
cd SIBR_viewers
2023-07-04 08:00:48 +00:00
cmake -Bbuild .
cmake --build build --target install --config RelWithDebInfo
```
You may specify a different configuration, e.g. ```Debug``` if you need more control during development.
2023-07-11 17:35:24 +00:00
#### Ubuntu 22.04
2023-07-05 23:49:18 +00:00
You will need to install a few dependencies before running the project setup.
2023-07-04 08:00:48 +00:00
```shell
# Dependencies
sudo apt install -y libglew-dev libassimp-dev libboost-all-dev libgtk-3-dev libopencv-dev libglfw3-dev libavdevice-dev libavcodec-dev libeigen3-dev libxxf86vm-dev libembree-dev
# Project setup
2023-07-08 13:41:19 +00:00
cd SIBR_viewers
2023-07-13 12:21:16 +00:00
cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release # add -G Ninja to build faster
cmake --build build -j24 --target install
2023-07-06 14:59:35 +00:00
```
2023-07-04 08:00:48 +00:00
2023-07-11 17:35:24 +00:00
#### Ubuntu 20.04
2023-07-12 10:11:57 +00:00
Backwards compatibility with Focal Fossa is not fully tested, but building SIBR with CMake should still work after invoking
2023-07-11 17:35:24 +00:00
```shell
git checkout fossa_compatibility
```
2023-07-05 23:49:18 +00:00
### Navigation in SIBR Viewers
2023-07-10 00:18:28 +00:00
The SIBR interface provides several methods of navigating the scene. By default, you will be started with an FPS navigator, which you can control with ```W, A, S, D, Q, E``` for camera translation and ```I, K, J, L, U, O``` for rotation. Alternatively, you may want to use a Trackball-style navigator (select from the floating menu). You can also snap to a camera from the data set with the ```Snap to``` button or find the closest camera with ```Snap to closest```. The floating menues also allow you to change the navigation speed. You can use the ```Scaling Modifier``` to control the size of the displayed Gaussians, or show the initial point cloud.
2023-07-05 23:49:18 +00:00
### Running the Network Viewer
2023-07-09 16:52:10 +00:00
2023-07-09 18:14:27 +00:00
https://github.com/graphdeco-inria/gaussian-splatting/assets/40643808/90a2e4d3-cf2e-4633-b35f-bfe284e28ff7
2023-07-09 16:52:10 +00:00
2023-07-06 15:55:46 +00:00
After extracting or installing the viewers, you may run the compiled ```SIBR_remoteGaussian_app[_config]``` app in ```<SIBR install dir>/bin```, e.g.:
2023-07-04 08:00:48 +00:00
```shell
2023-07-06 11:08:49 +00:00
./<SIBR install dir>/bin/SIBR_remoteGaussian_app
2023-07-04 08:00:48 +00:00
```
2023-07-09 16:11:09 +00:00
The network viewer allows you to connect to a running training process on the same or a different machine. If you are training on the same machine and OS, no command line parameters should be required: the optimizer communicates the location of the training data to the network viewer. By default, optimizer and network viewer will try to establish a connection on **localhost** on port **6009**. You can change this behavior by providing matching ```--ip``` and ```--port``` parameters to both the optimizer and the network viewer. If for some reason the path used by the optimizer to find the training data is not reachable by the network viewer (e.g., due to them running on different (virtual) machines), you may specify an override location to the viewer by using ```-s <source path>```.
<details>
<summary><span style="font-weight: bold;">Primary Command Line Arguments for Network Viewer</span></summary>
2023-07-10 15:58:17 +00:00
#### --path / -s
2023-07-09 16:11:09 +00:00
Argument to override model's path to source dataset.
2023-07-10 15:58:17 +00:00
#### --ip
2023-07-09 16:11:09 +00:00
IP to use for connection to a running training script.
2023-07-10 15:58:17 +00:00
#### --port
2023-07-09 16:11:09 +00:00
Port to use for connection to a running training script.
2023-07-10 15:58:17 +00:00
#### --rendering-size
2023-07-09 16:11:09 +00:00
Takes two space separated numbers to define the resolution at which network rendering occurs, ```1200``` width by default.
2023-07-09 17:43:29 +00:00
Note that to enforce an aspect that differs from the input images, you need ```--force-aspect-ratio``` too.
2023-07-10 15:58:17 +00:00
#### --load_images
2023-07-09 16:11:09 +00:00
Flag to load source dataset images to be displayed in the top view for each camera.
</details>
<br>
2023-07-04 08:00:48 +00:00
2023-07-05 23:49:18 +00:00
### Running the Real-Time Viewer
2023-07-09 17:05:05 +00:00
2023-07-09 18:14:27 +00:00
https://github.com/graphdeco-inria/gaussian-splatting/assets/40643808/0940547f-1d82-4c2f-a616-44eabbf0f816
2023-07-09 17:05:05 +00:00
2023-07-06 15:55:46 +00:00
After extracting or installing the viewers, you may run the compiled ```SIBR_gaussianViewer_app[_config]``` app in ```<SIBR install dir>/bin```, e.g.:
2023-07-04 08:00:48 +00:00
```shell
2023-07-08 12:56:07 +00:00
./<SIBR install dir>/bin/SIBR_gaussianViewer_app -m <path to trained model>
2023-07-04 08:00:48 +00:00
```
2023-07-10 00:51:34 +00:00
It should suffice to provide the ```-m``` parameter pointing to a trained model directory. Alternatively, you can specify an override location for training input data using ```-s```. To use a specific resolution other than the auto-chosen one, specify ```--rendering-size <width> <height>```. Combine it with ```--force-aspect-ratio``` if you want the exact resolution and don't mind image distortion.
2023-07-08 15:36:57 +00:00
2023-07-12 12:03:28 +00:00
**To unlock the full frame rate, please disable V-Sync on your machine and also in the application (Menu &rarr; Display). In a multi-GPU system (e.g., laptop) your OpenGL/Display GPU should be the same as your CUDA GPU (e.g., by setting the application's GPU preference on Windows, see below) for maximum performance.**
![Teaser image](assets/select.png)
2023-07-04 08:00:48 +00:00
2023-07-05 23:49:18 +00:00
In addition to the intial point cloud and the splats, you also have the option to visualize the Gaussians by rendering them as ellipsoids from the floating menu.
2023-07-10 00:18:28 +00:00
SIBR has many other functionalities, please see the [documentation](https://sibr.gitlabpages.inria.fr/) for more details on the viewer, navigation options etc. There is also a Top View (available from the menu) that shows the placement of the input cameras and the original SfM point cloud; please note that Top View slows rendering when enabled. The real-time viewer also uses slightly more aggressive, fast culling, which can be toggled in the floating menu. If you ever encounter an issue that can be solved by turning fast culling off, please let us know.
2023-07-09 16:11:09 +00:00
<details>
<summary><span style="font-weight: bold;">Primary Command Line Arguments for Real-Time Viewer</span></summary>
2023-07-10 15:58:17 +00:00
#### --model-path / -m
2023-07-09 16:11:09 +00:00
Path to trained model.
2023-07-10 15:58:17 +00:00
#### --iteration
2023-07-09 16:11:09 +00:00
Specifies which of state to load if multiple are available. Defaults to latest available iteration.
2023-07-10 15:58:17 +00:00
#### --path / -s
2023-07-09 16:11:09 +00:00
Argument to override model's path to source dataset.
2023-07-10 15:58:17 +00:00
#### --rendering-size
2023-07-09 17:43:29 +00:00
Takes two space separated numbers to define the resolution at which real-time rendering occurs, ```1200``` width by default. Note that to enforce an aspect that differs from the input images, you need ```--force-aspect-ratio``` too.
2023-07-10 15:58:17 +00:00
#### --load_images
2023-07-09 16:11:09 +00:00
Flag to load source dataset images to be displayed in the top view for each camera.
2023-07-10 15:58:17 +00:00
#### --device
2023-07-09 16:11:09 +00:00
Index of CUDA device to use for rasterization if multiple are available, ```0``` by default.
2023-07-13 17:29:54 +00:00
#### --no_interop
Disables CUDA/GL interop forcibly. Use on systems that may not behave according to spec (e.g., WSL2 with MESA GL 4.5 software rendering).
2023-07-09 16:11:09 +00:00
</details>
<br>
2023-07-04 08:00:48 +00:00
2023-07-11 18:32:09 +00:00
## Processing your own Scenes
2023-07-04 08:00:48 +00:00
2023-07-11 18:32:09 +00:00
Our COLMAP loaders expect the following dataset structure in the source path location:
```
<location>
|---images
| |---<image 0>
| |---<image 1>
| |---...
|---sparse
|---0
2023-07-12 09:51:34 +00:00
|---cameras.bin
|---images.bin
|---points3D.bin
2023-07-11 18:32:09 +00:00
```
For rasterization, the camera models must be either a SIMPLE_PINHOLE or PINHOLE camera. We provide a converter script ```convert.py```, to extract undistorted images and SfM information from input images. Optionally, you can use ImageMagick to resize the undistorted images. This rescaling is similar to MipNeRF360, i.e., it creates images with 1/2, 1/4 and 1/8 the original resolution in corresponding folders. To use them, please first install a recent version of COLMAP (ideally CUDA-powered) and ImageMagick. Put the images you want to use in a directory ```<location>/input```.
2023-07-10 15:58:17 +00:00
```
<location>
|---input
2023-07-10 18:18:51 +00:00
|---<image 0>
|---<image 1>
|---...
2023-07-10 15:58:17 +00:00
```
If you have COLMAP and ImageMagick on your system path, you can simply run
2023-07-04 08:00:48 +00:00
```shell
python convert.py -s <location> [--resize] #If not resizing, ImageMagick is not needed
```
2023-07-10 15:58:17 +00:00
Alternatively, you can use the optional parameters ```--colmap_executable``` and ```--magick_executable``` to point to the respective paths. Please note that on Windows, the executable should point to the COLMAP ```.bat``` file that takes care of setting the execution environment. Once done, ```<location>``` will contain the expected COLMAP data set structure with undistorted, resized input images, in addition to your original images and some temporary (distorted) data in the directory ```distorted```.
If you have your own COLMAP dataset without undistortion (e.g., using ```OPENCV``` camera), you can try to just run the last part of the script: Put the images in ```input``` and the COLMAP info in a subdirectory ```distorted```:
```
<location>
|---input
| |---<image 0>
| |---<image 1>
| |---...
|---distorted
2023-07-10 18:18:51 +00:00
|---database.db
|---sparse
|---0
|---...
2023-07-10 15:58:17 +00:00
```
Then run
```shell
python convert.py -s <location> --skip_matching [--resize] #If not resizing, ImageMagick is not needed
```
<details>
<summary><span style="font-weight: bold;">Command Line Arguments for convert.py</span></summary>
#### --no_gpu
Flag to avoid using GPU in COLMAP.
#### --skip_matching
Flag to indicate that COLMAP info is available for images.
#### --source_path / -s
Location of the inputs.
#### --camera
Which camera model to use for the early matching steps, ```OPENCV``` by default.
#### --resize
Flag for creating resized versions of input images.
#### --colmap_executable
Path to the COLMAP executable (```.bat``` on Windows).
#### --magick_executable
Path to the ImageMagick executable.
</details>
<br>
2023-07-04 08:00:48 +00:00
## FAQ
2023-07-04 15:48:37 +00:00
- *Where do I get data sets, e.g., those referenced in ```full_eval.py```?* The MipNeRF360 data set is provided by the authors of the original paper on the project site. Note that two of the data sets cannot be openly shared and require you to consult the authors directly. For Tanks&Temples and Deep Blending, please use the download links provided at the top of the page.
2023-07-04 08:00:48 +00:00
2023-07-10 00:51:34 +00:00
- *I don't have 24 GB of VRAM for training, what do I do?* The VRAM consumption is determined by the number of points that are being optimized, which increases over time. If you only want to train to 7k iterations, you will need significantly less. To do the full training routine and avoid running out of memory, you can increase the ```--densify_grad_threshold```, ```--densification_interval``` or reduce the value of ```--densify_until_iter```. Note however that this will affect the quality of the result. Also try setting ```--test_iterations``` to ```-1``` to avoid memory spikes during testing. If ```--densify_grad_threshold``` is very high, no densification should occur and training should complete if the scene itself loads successfully.
2023-07-06 11:08:49 +00:00
- *24 GB of VRAM for reference quality training is still a lot! Can't we do it with less?* Yes, most likely. By our calculations it should be possible with **way** less memory (~8GB). If we can find the time we will try to achieve this. If some PyTorch veteran out there wants to tackle this, we look forward to your pull request!
2023-07-04 08:00:48 +00:00
2023-07-10 09:12:54 +00:00
- *How can I use this for a much larger dataset, like a city district?* Given enough memory, this should work out fine, but it will require to adapt the ```--scaling_lr``` and ```--position_lr_init/final```. To avoid manual tuning, a suggestion is to check the loss: if it diverges early on, reset and use a lower scaling / position learning rate.
2023-07-09 16:11:09 +00:00
- *How can I use the differentiable Gaussian rasterizer for my own project?* Easy, it is included in this repo as a submodule ```diff-gaussian-rasterization```. Feel free to check out and install the package. It's not really documented, but using it from the Python side is very straightforward (cf. ```gaussian_renderer/__init__.py```).
2023-07-09 14:18:54 +00:00
2023-07-10 13:50:38 +00:00
- *Wait, but ```<insert feature>``` isn't optimized and could be much better?* There are several parts we didn't even have time to think about improving (yet). The performance you get with this prototype is probably a rather slow baseline for what is physically possible.
2023-07-09 18:14:27 +00:00
- *Something is broken, how did this happen?* We tried hard to provide a solid and comprehensible basis to make use of the paper's method. We have refactored the code quite a bit, but we have limited capacity to test all possible usage scenarios. Thus, if part of the website, the code or the performance is lacking, please create an issue. If we find the time, we will do our best to address it.