Francis Engelmann, Fabian Manhardt, Michael Niemeyer, Keisuke Tateno, Marc Pollefeys, Federico Tombari
After installing conda (see here), setup the conda environment:
conda create --name opennerf -y python=3.10
conda activate opennerf
python -m pip install --upgrade pip
conda install nvidia/label/cuda-12.1.1::cuda
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 -c pytorch -c nvidia
python -m pip install ninja git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
git clone https://github.com/opennerf/opennerf
cd opennerf
python -m pip install -e .
ns-install-cli
The datasets and saved NeRF models require significant disk space. Let's link them to some (remote) larger storage:
ln -s path/to/large_disk/data data
ln -s path/to/large_disk/models models
ln -s path/to/large_disk/outputs outputs
Download the OpenSeg feature extractor model from here and unzip it into ./models.
Download the Replica dataset pre-processed by NICE-SLAM and transform it into nerfstudio format using these steps:
cd data
wget https://cvg-data.inf.ethz.ch/nice-slam/data/Replica.zip
unzip Replica.zip
cd ..
python datasets/replica_preprocess.py
The preprocessed LERF dataset is available from the official repository.
This repository creates a new Nerfstudio method named "opennerf". To train with it, run the command:
ns-train opennerf --data [PATH]
See .vscode/launch.json for specific training examples.
To view the optimized NeRF, you can launch the viewer separately:
ns-viewer --load-config outputs/path_to/config.yml
Adapt the global variables CONDA_DIR and PREFIX in train_eval_replica_semantics.py. Then run it:
python scripts/train_eval_replica_semantics.py
This version of the code corresponds to entry (2) "Render & Project" in Table 2 of the paper and produces the following 3D semantic segmentation scores on the Replica dataset:
| All | Head | Common | Tail | |||||
| mIoU | mAcc | mIoU | mAcc | mIoU | mAcc | mIoU | mAcc | |
| Run 0 | 18.74% | 31.87% | 30.26% | 43.89% | 20.07% | 33.52% | 5.88% | 18.19% |
| Run 1 | 19.68% | 32.68% | 30.76% | 44.70% | 20.84% | 34.16% | 7.43% | 19.17% |
| Run 2 | 18.80% | 31.72% | 30.36% | 44.02% | 19.63% | 32.71% | 6.41% | 18.43% |
TODO
Object coordinate frame:
- X - right
- Y - up
- Z - backwards (away from scene, towards you)
├── opennerf
│ ├──
│ ├── __init__.py
│ ├── data
│ │ ├── utils
│ │ │ ├── dino_dataloader.py
│ │ │ ├── dino_extractor.py
│ │ │ ├── feature_dataloader.py
│ │ │ ├── openseg_dataloader.py
│ │ │ ├── openseg_extractor.py
│ ├── encoders
│ │ ├── image_encoder.py
│ ├── opennerf_config.py
│ ├── opennerf_datamanger.py
│ ├── opennerf_field.py
│ ├── opennerf_fieldheadnames.py
│ ├── opennerf_model.py
│ ├── opennerf_pipeline.py
│ ├── opennerf_renderers.py
├── pyproject.toml
If you find our code or paper useful, please cite:
@inproceedings{engelmann2024opennerf,
title = {{OpenNeRF: Open Set 3D Neural Scene Segmentation with Pixel-Wise Features and Rendered Novel Views}},
author = {Engelmann, Francis and Manhardt, Fabian and Niemeyer, Michael and Tateno, Keisuke and Pollefeys, Marc and Tombari, Federico},
booktitle = {International Conference on Learning Representations},
year = {2024}
}