SplaTAM

SplaTAM: Splat, Track & Map 3D Gaussians for Dense RGB-D SLAM (CVPR 2024)

1577
174
Python

SplaTAM: Splat, Track & Map 3D Gaussians for Dense RGB-D SLAM

CVPR 2024

Nikhil Keetha · Jay Karhade · Krishna Murthy Jatavallabhula · Gengshan Yang · Sebastian Scherer
Deva Ramanan · Jonathon Luiten

Paper | Video | Project Page

Logo


Stay Tuned for a Faster and Better Variant of SplaTAM!

Table of Contents
  1. Installation
  2. Online Demo
  3. Usage
  4. Downloads
  5. Benchmarking
  6. Acknowledgement
  7. Citation
  8. Developers

Installation

(Recommended)

SplaTAM has been benchmarked with Python 3.10, Torch 1.12.1 & CUDA=11.6. However, Torch 1.12 is not a hard requirement and the code has also been tested with other versions of Torch and CUDA such as Torch 2.3.0 & CUDA 12.1.

The simplest way to install all dependences is to use anaconda and pip in the following steps:

conda create -n splatam python=3.10
conda activate splatam
conda install -c "nvidia/label/cuda-11.6.0" cuda-toolkit
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
pip install -r requirements.txt

Windows

For installation on Windows using Git bash, please refer to the instructions shared in Issue#9.

Docker and Singularity Setup

We also provide a docker image. We recommend using a venv to run the code inside a docker image:

docker pull nkeetha/splatam:v1
bash bash_scripts/start_docker.bash
cd /SplaTAM/
pip install virtualenv --user
mkdir venv
cd venv
virtualenv --system-site-packages splatam
source ./splatam/bin/activate
pip install -r venv_requirements.txt

Setting up a singularity container is similar:

cd </path/to/singularity/folder/>
singularity pull splatam.sif docker://nkeetha/splatam:v1
singularity instance start --nv splatam.sif splatam
singularity run --nv instance://splatam
cd <path/to/SplaTAM/>
pip install virtualenv --user
mkdir venv
cd venv
virtualenv --system-site-packages splatam
source ./splatam/bin/activate
pip install -r venv_requirements.txt

Demo

Online

You can SplaTAM your own environment with an iPhone or LiDAR-equipped Apple device by downloading and using the NeRFCapture app.

Make sure that your iPhone and PC are connected to the same WiFi network, and then run the following command:

bash bash_scripts/online_demo.bash configs/iphone/online_demo.py

On the app, keep clicking send for successive frames. Once the capturing of frames is done, the app will disconnect from the PC and check out SplaTAM’s interactive rendering of the reconstruction on your PC! Here are some cool example results:

Logo

Offline

You can also first capture the dataset and then run SplaTAM offline on the dataset with the following command:

bash bash_scripts/nerfcapture.bash configs/iphone/nerfcapture.py

Dataset Collection

If you would like to only capture your own iPhone dataset using the NeRFCapture app, please use the following command:

bash bash_scripts/nerfcapture2dataset.bash configs/iphone/dataset.py

Usage

We will use the iPhone dataset as an example to show how to use SplaTAM. The following steps are similar for other datasets.

To run SplaTAM, please use the following command:

python scripts/splatam.py configs/iphone/splatam.py

To visualize the final interactive SplaTAM reconstruction, please use the following command:

python viz_scripts/final_recon.py configs/iphone/splatam.py

To visualize the SplaTAM reconstruction in an online fashion, please use the following command:

python viz_scripts/online_recon.py configs/iphone/splatam.py

To export the splats to a .ply file, please use the following command:

python scripts/export_ply.py configs/iphone/splatam.py

PLY format Splats can be visualized in viewers such as SuperSplat & PolyCam.

To run 3D Gaussian Splatting on the SplaTAM reconstruction, please use the following command:

python scripts/post_splatam_opt.py configs/iphone/post_splatam_opt.py

To run 3D Gaussian Splatting on a dataset using ground truth poses, please use the following command:

python scripts/gaussian_splatting.py configs/iphone/gaussian_splatting.py

Downloads

DATAROOT is ./data by default. Please change the input_folder path in the scene-specific config files if datasets are stored somewhere else on your machine.

Replica

Download the data as below, and the data is saved into the ./data/Replica folder. Note that the Replica data is generated by the authors of iMAP (but hosted by the authors of NICE-SLAM). Please cite iMAP if you use the data.

bash bash_scripts/download_replica.sh

TUM-RGBD

bash bash_scripts/download_tum.sh

ScanNet

Please follow the data downloading procedure on the ScanNet website, and extract color/depth frames from the .sens file using this code.

[Directory structure of ScanNet (click to expand)]
  DATAROOT
  └── scannet
        └── scene0000_00
            └── frames
                ├── color
                │   ├── 0.jpg
                │   ├── 1.jpg
                │   ├── ...
                │   └── ...
                ├── depth
                │   ├── 0.png
                │   ├── 1.png
                │   ├── ...
                │   └── ...
                ├── intrinsic
                └── pose
                    ├── 0.txt
                    ├── 1.txt
                    ├── ...
                    └── ...

We use the following sequences:

scene0000_00
scene0059_00
scene0106_00
scene0181_00
scene0207_00

ScanNet++

Please follow the data downloading and image undistortion procedure on the ScanNet++ website.
Additionally for undistorting the DSLR depth images, we use our own variant of the official ScanNet++ processing code. We will open a pull request to the official ScanNet++ repository soon.

We use the following sequences:

8b5caf3398
b20a261fdf

For b20a261fdf, we use the first 360 frames, due to an abrupt jump/teleportation in the trajectory post frame 360. Please note that ScanNet++ was primarily intended as a NeRF Training & Novel View Synthesis dataset.

Replica-V2

We use the Replica-V2 dataset from vMAP to evaluate novel view synthesis. Please download the pre-generated replica sequences from vMAP.

Benchmarking

For running SplaTAM, we recommend using weights and biases for the logging. This can be turned on by setting the wandb flag to True in the configs file. Also make sure to specify the path wandb_folder. If you don’t have a wandb account, first create one. Please make sure to change the entity config to your wandb account. Each scene has a config folder, where the input_folder and output paths need to be specified.

Below, we show some example run commands for one scene from each dataset. After SLAM, the trajectory error will be evaluated along with the rendering metrics. The results will be saved to ./experiments by default.

Replica

To run SplaTAM on the room0 scene, run the following command:

python scripts/splatam.py configs/replica/splatam.py

To run SplaTAM-S on the room0 scene, run the following command:

python scripts/splatam.py configs/replica/splatam_s.py

For other scenes, please modify the configs/replica/splatam.py file or use configs/replica/replica.bash.

TUM-RGBD

To run SplaTAM on the freiburg1_desk scene, run the following command:

python scripts/splatam.py configs/tum/splatam.py

For other scenes, please modify the configs/tum/splatam.py file or use configs/tum/tum.bash.

ScanNet

To run SplaTAM on the scene0000_00 scene, run the following command:

python scripts/splatam.py configs/scannet/splatam.py

For other scenes, please modify the configs/scannet/splatam.py file or use configs/scannet/scannet.bash.

ScanNet++

To run SplaTAM on the 8b5caf3398 scene, run the following command:

python scripts/splatam.py configs/scannetpp/splatam.py

To run Novel View Synthesis on the 8b5caf3398 scene, run the following command:

python scripts/eval_novel_view.py configs/scannetpp/eval_novel_view.py

For other scenes, please modify the configs/scannetpp/splatam.py file or use configs/scannetpp/scannetpp.bash.

ReplicaV2

To run SplaTAM on the room0 scene, run the following command:

python scripts/splatam.py configs/replica_v2/splatam.py

To run Novel View Synthesis on the room0 scene post SplaTAM, run the following command:

python scripts/eval_novel_view.py configs/replica_v2/eval_novel_view.py

For other scenes, please modify the config files.

Acknowledgement

We thank the authors of the following repositories for their open-source code:

Citation

If you find our paper and code useful, please cite us:

@inproceedings{keetha2024splatam,
        title={SplaTAM: Splat, Track & Map 3D Gaussians for Dense RGB-D SLAM},
        author={Keetha, Nikhil and Karhade, Jay and Jatavallabhula, Krishna Murthy and Yang, Gengshan and Scherer, Sebastian and Ramanan, Deva and Luiten, Jonathon},
        booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
        year={2024}
      }

Developers