Skip to content

Official implementation of RelationField: Relate Anything in Radiance Fields

License

Notifications You must be signed in to change notification settings

boschresearch/RelationField

Repository files navigation

RelationField: Relate Anything in Radiance Fields

Sebastian Koch, Johanna Wald, Mirco Colosi, Narunas Vaskevicius, Pedro Hermosilla, Federico Tombari Timo Ropinski

Paper | Project Page

RelationField Teaser

Installation

Install NerfStudio

conda create --name relationfield -y python=3.10
conda activate relationfield
python -m pip install --upgrade pip

Install cuda, torch, etc

conda install nvidia/label/cuda-11.8.0::cuda
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
python -m pip install ninja git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

Install SAM

pip install git+https://github.com/facebookresearch/segment-anything.git

Install RelationField

git clone https://github.com/boschresearch/relationfield
cd relationfield
python -m pip install -e .

Data preparation and Foundation Models

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 SAM from here and unzip it into ./models.

Replica Dataset

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 --data <root-replica-folder> --output <nerfstudio-output>

SCANNET++ Dataset

Follow the ScanNet++ data download here to download the entire ScanNet++ dataset or a handful of subscenes and transform it into nerfstudio format using these steps:

python datasets/scannetpp_preprocess.py

RIO10 Dataset

Download the RIO10 dataset from here and transform it into nerfstudio format using these steps:

python datasets/rio_preprocess.py

Preprocess GPT Captions

To caption the preprocessed dataset with GPT run:

export OPEN_API_KEY=YOUR_API_KEY
python datasets/preprocess_dataset_gpt.py --data_dir [PATH]

In case a one of the captioning steps fails you can manually correct it and run (this happens very rarely):

python datasets/preprocess_dataset_gpt.py --data_dir [PATH] --redo img_id1.png,...,img_idk.png

Running RelationField

This repository creates a new Nerfstudio method named "relationfield". To train with it, run the command:

ns-train relationfield --data [PATH]

To view the optimized NeRF, you can launch the viewer separately:

ns-viewer --load-config outputs/path_to/config.yml

Interact with the viewer to visualize relationships:

relationfield_viewer_demo.mp4

Utilizing depth data

RelationField support depth supervision for improved and faster convergence of the NeRF geometry. To activate make sure that depth data is available for your data and run:

export NERFACTO_DEPTH=True
ns-train relationfield --data [PATH]

Running RelationField with Gaussian Splatting geometry!

Although RelationField's relation field is optimized using NeRF geometry, it can be used to relate gaussians in 3D!

ns-train relationfield-gauss --data [PATH] --pipeline.relationfield-ckpt outputs/path_to/config.yml

Troubleshooting

Note: RelationField requires ~32GB of memory during training. If your system has lower computational resources, consider reducing the number of training rays.

In relationfield/relationfield/relationfield_config.py, you can adjust the following parameters (lines 42-46):

train_num_rays_per_batch=4096,
eval_num_rays_per_batch=4096, 
pixel_sampler=RelationFieldPixelSamplerConfig(
    num_rays_per_image=256,  # 4096/256 = 16 images per batch
),

Acknowledgement

Large parts of the code base are inspied and build on top of OpenNerf and GARField.

Citation

If you use this work or find it helpful, please consider citing: (bibtex)

@article{koch2024relationfield,
 author = {Koch, Sebastian and Wald, Johanna and Colosi, Mirco and Vaskevicius, Narunas and Hermosilla, Pedro and Tombari, Federico and Ropinski, Timo}},
 title = {RelationField: Relate Anything in Radiance Fields},
 journal = {arXiv preprint arXiv:2412.13652},
 year = {2024},
}

About

Official implementation of RelationField: Relate Anything in Radiance Fields

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages