SDFStudio is a unified and modular framework for neural implicit surface reconstruction, built on top of the awesome nerfstudio project. We provide a unified implementation of three major implicit surface reconstruction methods: UniSurf, VolSDF, and NeuS. SDFStudio also supports various scene representions, such as MLPs, Tri-plane, and Multi-res. feature grids, and multiple point sampling strategies such as surface-guided sampling as in UniSurf, and Voxel-surface guided sampling from NeuralReconW. It further integrates recent advances in the area such as the utillization of monocular cues (MonoSDF), geometry regularization (UniSurf) and multi-view consistency (Geo-NeuS). Thanks to the unified and modular implementation, SDFStudio makes it easy to transfer ideas from one method to another. For example, Mono-NeuS applies the idea from MonoSDF to NeuS, and Geo-VolSDF applies the idea from Geo-NeuS to VolSDF.
2023.03.12: Support BakedSDF.
2022.12.28: Support Neural RGB-D Surface Reconstruction.
SDFStudio is built on top of nerfstudio. If you have already installed the nerfstudio environment, you can skip the following steps.
CUDA must be installed on the system. This library has been tested with version 11.3. You can find more information about installing CUDA here.
SDFStudio requires python >= 3.7
. We recommend using conda to manage dependencies. Make sure to install Conda before proceeding.
conda create --name sdfstudio -y python=3.8
conda activate sdfstudio
python -m pip install --upgrade pip
Install pytorch with CUDA (this repo has been tested with CUDA 11.3) and tiny-cuda-nn
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
git clone https://github.com/autonomousvision/sdfstudio.git
cd sdfstudio
pip install --upgrade pip setuptools
pip install -e .
# install tab completion
ns-install-cli
The following will train a NeuS-facto model,
# Download some test data: you might need to install curl if your system don't have that
ns-download-data sdfstudio
# Train model on the dtu dataset scan65
ns-train neus-facto --pipeline.model.sdf-field.inside-outside False --vis viewer --experiment-name neus-facto-dtu65 sdfstudio-data --data data/sdfstudio-demo-data/dtu-scan65
# Or you could also train model on the Replica dataset room0 with monocular priors
ns-train neus-facto --pipeline.model.sdf-field.inside-outside True --pipeline.model.mono-depth-loss-mult 0.1 --pipeline.model.mono-normal-loss-mult 0.05 --vis viewer --experiment-name neus-facto-replica1 sdfstudio-data --data data/sdfstudio-demo-data/replica-room0 --include_mono_prior True
If everything works, you should see the following training progress:
Navigating to the link at the end of the terminal will load the webviewer (developled by nerfstudio). If you are running on a remote machine, you will need to port forward the websocket port (defaults to 7007). With an RTX3090 GPU, it takes ~15 mins for 20K iterations but you can already see reasonable reconstruction results after 2K iterations in the webviewer.
It is also possible to load a pretrained model by running
ns-train neus-facto sdfstudio-data --data data/sdfstudio-demo-data/dtu-scan65 --trainer.load-dir {outputs/neus-facto-dtu65/neus-facto/XXX/sdfstudio_models}
Note that this will automatically resume training. If you do not want to resume training, add --viewer.start-train False
to your training command.
Once you have a trained model you can export mesh and render the mesh.
ns-extract-mesh --load-config outputs/neus-facto-dtu65/neus-facto/XXX/config.yml --output-path meshes/neus-facto-dtu65.ply
ns-render-mesh --meshfile meshes/neus-facto-dtu65.ply --traj interpolate --output-path renders/neus-facto-dtu65.mp4 sdfstudio-data --data data/sdfstudio-demo-data/dtu-scan65
You will get the following video if everything works properly.
neus-facto-dtu65.mp4
First we must create a path for the camera to follow. This can be done in the viewer under the "RENDER" tab. Orient your 3D view to the location where you wish the video to start, then press "ADD CAMERA". This will set the first camera key frame. Continue to new viewpoints adding additional cameras to create the camera path. We provide other parameters to further refine your camera path. Once satisfied, press "RENDER" which will display a modal that contains the command needed to render the video. Kill the training job (or create a new terminal if you have lots of compute) and the command to generate the video.
To view all video export options run:
ns-render --help
We provide many other models than NeuS-facto, see the documentation. For example, if you want to train the original NeuS model, use the following command:
ns-train neus --pipeline.model.sdf-field.inside-outside False sdfstudio-data --data data/sdfstudio-demo-data/dtu-scan65
For a full list of included models run ns-train --help
. Please refer to the documentation for a more detailed explanation for each method.
Each model contains many parameters that can be changed, too many to list here. Use the --help
command to see the full list of configuration options.
Note, that order of parameters matters! For example, you cannot set --machine.num-gpus
after the --data
parameter
ns-train neus-facto --help
Nerfstudio supports three different methods to track training progress, using the viewer, tensorboard, and Weights and Biases. These visualization tools can also be used in SDFStudio. You can specify which visualizer to use by appending --vis {viewer, tensorboard, wandb}
to the training command. Note that only one may be used at a time. Additionally the viewer only works for methods that are fast (ie. NeuS-facto
and NeuS-acc
), for slower methods like NeuS-facto-bigmlp
, use the other loggers.
Please refer to the datasets and data format documentation if you like to use custom datasets.
- A collaboration friendly studio for NeRFs
- Developed by nerfstudio team
- Easy-to-use config system
- Developed by Brent Yi
- Library for accelerating NeRF renders
- Developed by Ruilong Li
If you use this library or find the documentation useful for your research, please consider citing:
@misc{Yu2022SDFStudio,
author = {Yu, Zehao and Chen, Anpei and Antic, Bozidar and Peng, Songyou Peng and Bhattacharyya, Apratim
and Niemeyer, Michael and Tang, Siyu and Sattler, Torsten and Geiger, Andreas},
title = {SDFStudio: A Unified Framework for Surface Reconstruction},
year = {2022},
url = {https://github.com/autonomousvision/sdfstudio},
}