Skip to content

A PyTorch implementation of NeRF (Neural Radiance Fields) that reproduces the results.

License

Notifications You must be signed in to change notification settings

sword4869/nerf-pytorch

 
 

Repository files navigation


1. NeRF-pytorch

Paper

Project

code

Tensorflow implementation

nerf-pytorch

1.1. Installation

git clone git@github.com:sword4869/nerf-pytorch.git
cd nerf-pytorch
conda create -n nerf python=3.10 -y
conda activate nerf
pip install -r requirements.txt

The LLFF data loader requires ImageMagick.

You will also need the LLFF code (and COLMAP) set up to compute poses if you want to run on your own real data.

1.2. Dataset

1.2.1. example dataset

Download data for two example datasets: nerf_llff_datafernnerf_syntheticlego

# this bash is so lower than directly downloading the following link.
bash download_example_data.sh

1.2.2. More Datasets

To play with other scenes presented in the paper, download the data here. Place the downloaded dataset according to the following directory structure:

├── configs                                                                                                       
│   ├── ...                                                                                     
│                                                                                               
├── data                                                                                                                                                                                                       
│   ├── nerf_llff_data                                                                                                  
│   │   └── fern                                                                                                                             
│   │   └── flower  # downloaded llff dataset                                                                                  
│   │   └── horns   # downloaded llff dataset
|   |   └── ...
|   ├── nerf_synthetic
|   |   └── lego
|   |   └── ship    # downloaded synthetic dataset
|   |   └── ...

1.3. Train

To train a low-res lego NeRF:

python run_nerf.py --config configs/lego.txt

After training for 100k iterations (~4 hours on a single 2080 Ti), you can find the following video at logs/lego_test/lego_test_spiral_100000_rgb.mp4.

To train a low-res fern NeRF:

python run_nerf.py --config configs/fern.txt

After training for 200k iterations (~8 hours on a single 2080 Ti), you can find the following video at logs/fern_test/render_poses_200000_rgb.mp4 and logs/fern_test/render_poses_200000_disp.mp4

1.4. QuickStart

You can download the pre-trained models here. Place the downloaded directory in ./logs in order to test it later. See the following directory structure for an example:

├── logs 
│   ├── <expname in config>
│   ├── flower_test  # downloaded logs
│   ├── trex_test    # downloaded logs
python run_nerf.py --config configs/{DATASET}.txt --render_only

About

A PyTorch implementation of NeRF (Neural Radiance Fields) that reproduces the results.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.7%
  • Shell 0.3%