kakaobrain / nerf-factory

An awesome PyTorch NeRF library

Home Page:https://kakaobrain.github.io/NeRF-Factory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NeRF-Factory: An awesome PyTorch NeRF collection

logo

Project Page | Checkpoints

Attention all NeRF researchers! We are here with a PyTorch-reimplemented large-scale NeRF library. Our library is easily extensible and usable.

animated animated

This contains PyTorch-implementation of 7 popular NeRF models.

and also 7 popular NeRF datasets.

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 function def 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)

About

An awesome PyTorch NeRF library

https://kakaobrain.github.io/NeRF-Factory

License:Apache License 2.0


Languages

Language:Python 65.6%Language:Cuda 26.5%Language:C++ 4.3%Language:Shell 3.2%Language:CMake 0.4%