NeRF-Factory: An awesome PyTorch NeRF collection
Attention all NeRF researchers! We are here with a PyTorch-reimplemented large-scale NeRF library. Our library is easily extensible and usable.
This contains PyTorch-implementation of 7 popular NeRF models.
- NeRF: [Project Page] [Paper] [Code]
- NeRF++: [Paper] [Code]
- DVGO: [Project Page] [Paper-v1] [Paper-v2] [Code]
- Plenoxels: [Project Page] [Paper] [Code]
- Mip-NeRF: [Project Page] [Paper] [Code]
- Mip-NeRF360: [Project Page] [Paper] [Code]
- Ref-NeRF: [Project Page] [Paper] [Code]
and also 7 popular NeRF datasets.
- NeRF Blender: link
- NeRF LLFF: link
- Tanks and Temples: link
- LF: link
- NeRF-360: link
- NeRF-360-v2: link
- Shiny Blender: link
You only need to do for running the code is:
python3 -m run --ginc configs/[model]/[data].gin
# ex) python3 -m run --ginc configs/nerf/blender.gin
We also provide convenient visualizers for NeRF researchers.
Contributor
This project is created and maintained by Yoonwoo Jeong, Seungjoo Shin, and Kibaek Park.
Requirements
conda create -n nerf_factory -c anaconda python=3.8
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch
pip3 install -r requirements.txt
## Optional(Plenoxel)
pip3 install .
## Or you could directly build from nerf_factory.yml
conda env create --file nerf_factory.yml
Command
python3 -m run --ginc configs/[model]/[data].gin
# ex) python3 -m run --ginc configs/nerf/blender.gin
Preparing Dataset
We provide an automatic download script for all datasets.
# NeRF-blender dataset
bash scripts/download_data.sh nerf_synthetic
# NeRF-LLFF(NeRF-Real) dataset
bash scripts/download_data.sh nerf_llff
# NeRF-360 dataset
bash scripts/download_data.sh nerf_real_360
# Tanks and Temples dataset
bash scripts/download_data.sh tanks_and_temples
# LF dataset
bash scripts/download_data.sh lf
# NeRF-360-v2 dataset
bash scripts/download_data.sh nerf_360_v2
# Shiny-blender dataset
bash scripts/download_data.sh shiny_blender
Run the Code!
A very simple script to run the code.
Training Code
A script for running the training code.
python3 run.py --ginc configs/[model]/[data].gin --scene [scene]
## ex) run training nerf on chair scene of blender dataset
python3 run.py --ginc configs/nerf/blender.gin --scene chair
Evaluation Code
A script for running the evaluation code only.
python3 run.py --ginc configs/[model]/[data].gin --scene [scene] \
--ginb run.run_train=False
## ex) run evaluating nerf on chair scene of blender dataset
python3 run.py --ginc configs/nerf/blender.gin --scene chair \
--ginb run.run_train=False
Custom
How to add the custom dataset and the custom model in NeRF-Factory?
Custom Dataset
- Add files of the custom dataset on
./data/[custom_dataset]
. - Implement a dataset loader code on
./src/data/data_util/[custom_dataset].py
. - Implement a custom dataset class
LitData[custom_dataset]
on./src/data/litdata.py
. - Add option of selecting the custom dataset on the function
def select_dataset()
of./utils/select_option.py
. - Add gin config file for each model as
./configs/[model]/[custom_dataset].gin
.
Custom Model
- Implement a custom model code on
./src/model/[custom_model]/model.py
. - Implement a custom model's helper code on
./src/model/[custom_model]/helper.py
. - [Optional] If you need more code files for the custom model, you can add them in
./src/model/[custom_model]/
.- Add option of selecting the custom model on the functiondef select_model()
of./utils/select_option.py
. - Add gin config file for each model as
./configs/[custom_model]/[dataset].gin
.
License
Copyright (c) 2022 POSTECH, KAIST, and Kakao Brain Corp. All Rights Reserved. Licensed under the Apache License, Version 2.0 (see LICENSE for details)