• Stars
    star
    1,187
  • Rank 39,407 (Top 0.8 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created about 2 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NeRF-SLAM: Real-Time Dense Monocular SLAM with Neural Radiance Fields. https://arxiv.org/abs/2210.13641 + Sigma-Fusion: Probabilistic Volumetric Fusion for Dense Monocular SLAM https://arxiv.org/abs/2210.01276

NeRF-SLAM

Real-Time Dense Monocular SLAM with Neural Radiance Fields

Antoni Rosinol Β· John J. Leonard Β· Luca Carlone

Paper | Video |

Table of Contents
  1. Install
  2. Download Datasets
  3. Run
  4. Citation
  5. License
  6. Acknowledgments
  7. Contact

Install

Clone repo with submodules:

git clone https://github.com/ToniRV/NeRF-SLAM.git --recurse-submodules
git submodule update --init --recursive

From this point on, use a virtual environment... Install torch (see here for other versions):

# CUDA 11.3
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113

Pip install requirements:

pip install -r requirements.txt
pip install -r ./thirdparty/gtsam/python/requirements.txt

Compile ngp (you need cmake>3.22):

cmake ./thirdparty/instant-ngp -B build_ngp
cmake --build build_ngp --config RelWithDebInfo -j

Compile gtsam and enable the python wrapper:

cmake ./thirdparty/gtsam -DGTSAM_BUILD_PYTHON=1 -B build_gtsam 
cmake --build build_gtsam --config RelWithDebInfo -j
cd build_gtsam
make python-install

Install:

python setup.py install

Download Sample Data

This will just download one of the replica scenes:

./scripts/download_replica_sample.bash

Run

python ./examples/slam_demo.py --dataset_dir=./datasets/Replica/office0 --dataset_name=nerf --buffer=100 --slam --parallel_run --img_stride=2 --fusion='nerf' --multi_gpu --gui

This repo also implements Sigma-Fusion: just change --fusion='sigma' to run that.

FAQ

GPU Memory

This is a GPU memory intensive pipeline, to monitor your GPU usage, I'd recommend to use nvitop. Install nvitop in a local env:

pip3 install --upgrade nvitop

Keep it running on a terminal, and monitor GPU memory usage:

nvitop --monitor

If you consistently see "out-of-memory" errors, you may either need to change parameters or buy better GPUs :). The memory consuming parts of this pipeline are:

  • Frame to frame correlation volumes (but can be avoided using on-the-fly correlation computation).
  • Volumetric rendering (intrinsically memory intensive, tricks exist, but ultimately we need to move to light fields or some better representation (OpenVDB?)).

Installation issues

  1. Gtsam not working: check that the python wrapper is installed, check instructions here: gtsam_python. Make sure you use our gtsam fork, which exposes more of gtsam's functionality to python.
  2. Gtsam's dependency is not really needed, I just used to experiment adding IMU and/or stereo cameras, and have an easier interface to build factor-graphs. This didn't quite work though, because the network seemed to have a concept of scale, and it didn't quite work when updating poses/landmarks and then optical flow.
  3. Somehow the parser converts this to const std::vector<const gtsam::Matrix&>&, and I need to remove manually in gtsam/build/python/linear.cpp the inner const X& ..., and also add <pybind11/stl.h> because:
  Did you forget to `#include <pybind11/stl.h>`?

Citation

@article{rosinol2022nerf,
  title={NeRF-SLAM: Real-Time Dense Monocular SLAM with Neural Radiance Fields},
  author={Rosinol, Antoni and Leonard, John J and Carlone, Luca},
  journal={arXiv preprint arXiv:2210.13641},
  year={2022}
}

License

This repo is BSD Licensed. It reimplements parts of Droid-SLAM (BSD Licensed). Our changes to instant-NGP (Nvidia License) are released in our fork of instant-ngp (branch feature/nerf_slam) and added here as a thirdparty dependency using git submodules.

Acknowledgments

This work has been possible thanks to the open-source code from Droid-SLAM and Instant-NGP, as well as the open-source datasets Replica and Cube-Diorama.

Contact

I have many ideas on how to improve this approach, but I just graduated so I won't have much time to do another PhD... If you are interested in building on top of this, feel free to reach out :) [email protected]

More Repositories

1

mesh_rviz_plugins

RVIZ plugins to display a mesh, a refactoring of plugins in: https://github.com/robustrobotics/flame_ros
C++
38
star
2

Kimera-VIO-Evaluation

Code to evaluate and tune SPARK VIO pipeline.
Python
21
star
3

visual-odometry-pipeline

Awesome monocular VO pipeline
MATLAB
21
star
4

euroc_dataset_tools

Scripts to convert a rosbag into Euroc dataset format.
Python
17
star
5

Constraint-Satisfaction-Notebook

Example lecture for Constraint Satisfaction Problems in an interactive jupyter notebook. With python code to solve CSPs, with visualization of Sudoku and NQueens problems.
Jupyter Notebook
14
star
6

Learning-to-navigate-without-a-map

The goal of the project is to determine how well deep learning is suited for planning under incomplete information.
Python
12
star
7

make_arxiv_submission

Generates a ready to submit arxiv zip file out of your paper.
Perl
8
star
8

catkin_package_maker

Automatic generator of ROS packages with the minimal skeleton for development of a ROS node (c++). This is an extremely simplified and cleaner version of `catkin_create_pkg`.
Python
8
star
9

MIT-16.32-Autonomous-Drone-Racing

Code and report for the project of the MIT course 16.32 Principles of Optimal Control and Estimation
TeX
7
star
10

ply_ros_publisher

ROS publisher of PLY files as a Mesh or as a Pointcloud, given input filename via rosparams or via rosservice call
C++
7
star
11

libelas_catkin

Catkin simple wrapper for LIBELAS: http://www.cvlibs.net/software/libelas/
C++
2
star
12

ROS_pointcloud_recolor

Subscribes to a pointcloud topic and recolors it given a registered 2D image with the pointcloud.
C++
2
star
13

rviz_waypoint_navigator

GUI interface for waypoint_navigator using Rviz.
C++
2
star
14

kimera_rviz_markers

RVIZ markers for Kimera-VIO-ROS
C++
2
star
15

hackupc17

flux the bucks
Python
1
star
16

dotfiles

Shell
1
star
17

threadsafe_queue

Threadsafe queue with shutdown switch.
C++
1
star
18

Vision-Algorithms

MATLAB
1
star
19

MIT_6.862_Applied_Machine_Learning

Jupyter Notebook
1
star
20

opengv_catkin

Catkin wrapper for installing [opengv](https://github.com/laurentkneip/opengv)
CMake
1
star