Unbounded Neural Radiance Fields in Pytorch
1. Introduction
This is still a research project in progress.
This project aims for benchmarking several state-of-the-art large-scale radiance fields algorithms. We exchangely use terms "unbounded NeRF" and "large-scale NeRF" because we find the techniques behind them are closely related.
Instead of pursuing a big and complicated code system, we pursue a simple code repo with SOTA performance for unbounded NeRFs.
You are expected to get the following results in this repository:
Benchmark | Methods | PSNR |
---|---|---|
Unbounded Tanks & Temples | NeRF++ | 20.49 |
Unbounded Tanks & Temples | Plenoxels | 20.40 |
Unbounded Tanks & Temples | DVGO | 20.10 |
Unbounded Tanks & Temples | Ours | 20.85 |
Mip-NeRF-360 Benchmark | NeRF | 24.85 |
Mip-NeRF-360 Benchmark | NeRF++ | 26.21 |
Mip-NeRF-360 Benchmark | Mip-NeRF-360 | 28.94 |
Mip-NeRF-360 Benchmark | DVGO | 25.42 |
Mip-NeRF-360 Benchmark | Ours | 28.98 |
Expand / collapse qualitative results.
Tanks and Temples:
- Playground:
best_ours_playground.mp4
- Truck:
truck_6_ours.mp4
- M60:
m60_baseline.mp4
- Train:
train_2_init_ours.mp4
Mip-NeRF-360 Benchmark:
- Bicycle:
2_ours.mp4
- Stump:
stump_4_ours.mp4
- Kitchen:
2_kitchen.mp4
- Bonsai:
2_ours.mp4
- Garden:
2_ours.mp4
- Counter:
counter_2.mp4
- Room:
9_almost_ok.mp4
Block-NeRF):
San Francisco Mission Bay (dataset released by-
Training splits:
oct2_124_300_frames_trim.mp4
-
Rotation:
rotation.mov
Hope our efforts could help your research or projects!
2. News
- [2023.3.20] This project is renamed to "UnboundedNeRFPytorch" because we find our work is not large enough (e.g., at city level), rigorously speaking.
Expand / collapse older news.
- [2023.2.27] A major update of our repository with better performance and full code release.
- [2022.12.23] Released several weeks' NeRF. Too many papers pop out these days so the update speed is slow.
- [2022.9.12] Training Block-NeRF on the Waymo dataset, reaching PSNR 24.3.
- [2022.8.31] Training Mega-NeRF on the Waymo dataset, loss still NAN.
- [2022.8.24] Support the full Mega-NeRF pipeline.
- [2022.8.18] Support all previous papers in weekly classified NeRF.
- [2022.8.17] Support classification in weekly NeRF.
- [2022.8.16] Support evaluation scripts and data format standard. Getting some results.
- [2022.8.13] Add estimated camera pose and release a better dataset.
- [2022.8.12] Add weekly NeRF functions.
- [2022.8.8] Add the NeRF reconstruction code and doc for custom purposes.
- [2022.7.28] The data preprocess script is finished.
- [2022.7.20] This project started!
3. Installation
Expand / collapse installation steps.
-
Clone this repository. Use depth == 1 to avoid download a large history.
git clone --depth=1 [email protected]:sjtuytc/LargeScaleNeRFPytorch.git mkdir data mkdir logs
-
Create conda environment.
conda create -n large-scale-nerf python=3.9 conda activate large-scale-nerf
-
Install pytorch and other libs. Make sure your Pytorch version is compatible with your CUDA.
pip install --upgrade pip conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia pip install -r requirements.txt
-
Install grid-based operators to avoid running them every time, cuda lib required. (Check via "nvcc -V" to ensure that you have a latest cuda.)
apt-get install g++ build-essential # ensure you have g++ and other build essentials, sudo access required. cd FourierGrid/cuda python setup.py install cd ../../
-
Install other libs used for reconstructing custom scenes. This is only needed when you need to build your scenes.
sudo apt-get install colmap sudo apt-get install imagemagick # required sudo accesss conda install pytorch-scatter -c pyg # or install via https://github.com/rusty1s/pytorch_scatter
You can use laptop version of COLMAP as well if you do not have access to sudo access on your server. However, we found if you do not set up COLMAP parameters properly, you would not get the SOTA performance.
4. Unbounded NeRF on the public datasets
Click the following sub-section titles to expand / collapse steps.
4.1 Download processed data.
- Disclaimer: users are required to get permission from the original dataset provider. Any usage of the data must obey the license of the dataset owner.
(1) Unbounded Tanks & Temples. Download data from here. Then unzip the data.
cd data
gdown --id 11KRfN91W1AxAW6lOFs4EeYDbeoQZCi87
unzip tanks_and_temples.zip
cd ../
(2) The Mip-NeRF-360 dataset.
cd data
wget http://storage.googleapis.com/gresearch/refraw360/360_v2.zip
mkdir 360_v2
unzip 360_v2.zip -d 360_v2
cd ../
(3) San Fran Cisco Mission Bay. What you should know before downloading the data:
- Our processed waymo data is significantly smaller than the original version (19.1GB vs. 191GB) because we store the camera poses instead of raw ray directions. Besides, our processed data is more friendly for Pytorch dataloaders. Download the data in the Google Drive. You may use gdown to download the files via command lines. If you are interested in processing the raw waymo data on your own, please refer to this doc.
The downloaded data would look like this:
data
|
|โโโโโโ360_v2 // the root folder for the Mip-NeRF-360 benchmark
| โโโโโโโbicycle // one scene under the Mip-NeRF-360 benchmark
| | โโโโโโโimages // rgb images
| | โโโโโโโimages_2 // rgb images downscaled by 2
| | โโโโโโโsparse // camera poses
| ...
|โโโโโโtanks_and_temples // the root folder for Tanks&Temples
| โโโโโโโtat_intermediate_M60 // one scene under Tanks&Temples
| | โโโโโโโcamera_path // render split camera poses, intrinsics and extrinsics
| | โโโโโโโtest // test split
| | โโโโโโโtrain // train split
| | โโโโโโโvalidation // validation split
| ...
|โโโโโโpytorch_waymo_dataset // the root folder for San Fran Cisco Mission Bay
| โโโโโโโcam_info.json // extracted cam2img information in dict.
| โโโโโโโcoordinates.pt // global camera information used in Mega-NeRF, deprecated
| โโโโโโโtrain // train data
| | โโโโโโโmetadata // meta data per image (camera information, etc)
| | โโโโโโโrgbs // rgb images
| | โโโโโโโsplit_block_train.json // split block informations
| | โโโโโโโtrain_all_meta.json // all meta informations in train folder
| โโโโโโโval // val data with the same structure as train
4.2 Train models and see the results!
You only need to run "python run_FourierGrid.py" to finish the train-test-render cycle. Explanations of some arguments:
--program: the program to run, normally --program train will be all you need.
--config: the config pointing to the scene file, e.g., --config FourierGrid/configs/tankstemple_unbounded/truck_single.py.
--num_per_block: number of blocks used in large-scale NeRFs, normally this is set to -1, unless specially needed.
--render_train: render the trained model on the train split.
--render_train: render the trained model on the test split.
--render_train: render the trained model on the render split.
--exp_id: add some experimental ids to identify different experiments. E.g., --exp_id 5.
--eval_ssim / eval_lpips_vgg: report SSIM / LPIPS(VGG) scores.
While we list major of the commands in scripts/train_FourierGrid.sh, we list some of commands below for better reproducibility.
# Unbounded tanks and temples
python run_FourierGrid.py --program train --config FourierGrid/configs/tankstemple_unbounded/playground_single.py --num_per_block -1 --render_train --render_test --render_video --exp_id 57
python run_FourierGrid.py --program train --config FourierGrid/configs/tankstemple_unbounded/train_single.py --num_per_block -1 --render_train --render_test --render_video --exp_id 12
python run_FourierGrid.py --program train --config FourierGrid/configs/tankstemple_unbounded/truck_single.py --num_per_block -1 --render_train --render_test --render_video --exp_id 4
python run_FourierGrid.py --program train --config FourierGrid/configs/tankstemple_unbounded/m60_single.py --num_per_block -1 --render_train --render_test --render_video --exp_id 6
# 360 degree dataset
python run_FourierGrid.py --program train --config FourierGrid/configs/nerf_unbounded/room_single.py --num_per_block -1 --eval_ssim --eval_lpips_vgg --render_train --render_test --render_video --exp_id 9
python run_FourierGrid.py --program train --config FourierGrid/configs/nerf_unbounded/stump_single.py --num_per_block -1 --eval_ssim --eval_lpips_vgg --render_train --render_test --render_video --exp_id 10
python run_FourierGrid.py --program train --config FourierGrid/configs/nerf_unbounded/bicycle_single.py --num_per_block -1 --eval_ssim --eval_lpips_vgg --render_train --render_test --render_video --exp_id 11
python run_FourierGrid.py --program train --config FourierGrid/configs/nerf_unbounded/bonsai_single.py --num_per_block -1 --eval_ssim --eval_lpips_vgg --render_train --render_test --render_video --exp_id 3
python run_FourierGrid.py --program train --config FourierGrid/configs/nerf_unbounded/garden_single.py --num_per_block -1 --eval_ssim --eval_lpips_vgg --render_train --render_test --render_video --exp_id 2
python run_FourierGrid.py --program train --config FourierGrid/configs/nerf_unbounded/kitchen_single.py --num_per_block -1 --eval_ssim --eval_lpips_vgg --render_train --render_test --render_video --exp_id 2
python run_FourierGrid.py --program train --config FourierGrid/configs/nerf_unbounded/counter_single.py --num_per_block -1 --eval_ssim --eval_lpips_vgg --render_train --render_test --render_video --exp_id 2
# San Francisco Mission Bay dataset
python run_FourierGrid.py --program train --config FourierGrid/configs/waymo/waymo_no_block.py --num_per_block 100 --render_video --exp_id 30
The old version of Block-NeRF is still provided to serve as a baseline, but it will be deprecated soon. We will mainly work on grid-based models later because they are simple and fast. Run the following command to reproduce the old Block-NeRF experiments:
bash scripts/block_nerf_train.sh
bash scripts/block_nerf_eval.sh
5. Build your custom unbounded NeRF (deprecated)
Expand / collapse steps for building custom NeRF world.
-
Put your images under data folder. The structure should be like:
data |โโโโโโMadoka // Your folder name here. | โโโโโโโsource // Source images should be put here. | โโโโโโโ---|1.png | โโโโโโโ---|2.png | โโโโโโโ---|...
The sample data is provided in our Google drive folder. The Madoka and Otobai can be found at this link.
-
Run COLMAP to reconstruct scenes. This would probably cost a long time.
python FourierGrid/tools/imgs2poses.py data/Madoka
You can replace data/Madoka by your data folder. If your COLMAP version is larger than 3.6 (which should not happen if you use apt-get), you need to change export_path to output_path in the colmap_wrapper.py.
-
Training NeRF scenes.
python FourierGrid/run_FourierGrid.py --config configs/custom/Madoka.py
You can replace configs/custom/Madoka.py by other configs.
-
Validating the training results to generate a fly-through video.
python FourierGrid/run_FourierGrid.py --config configs/custom/Madoka.py --render_only --render_video --render_video_factor 8
6. Citations & acknowledgements
Consider citing the following great works:
@inproceedings{dvgo,
title={Direct voxel grid optimization: Super-fast convergence for radiance fields reconstruction},
author={Sun, Cheng and Sun, Min and Chen, Hwann-Tzong},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={5459--5469},
year={2022}
}
@InProceedings{Tancik_2022_CVPR,
author = {Tancik, Matthew and Casser, Vincent and Yan, Xinchen and Pradhan, Sabeek and Mildenhall, Ben and Srinivasan, Pratul P. and Barron, Jonathan T. and Kretzschmar, Henrik},
title = {Block-NeRF: Scalable Large Scene Neural View Synthesis},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2022},
pages = {8248-8258}
}
We refer to the code and data from DVGO, nerf-pl and SVOX2, thanks for their great work!
Weekly classified NeRF
We track weekly NeRF papers and classify them. All previous published NeRF papers have been added to the list. We provide an English version and a Chinese version. We welcome contributions and corrections via PR.
We also provide an excel version (the meta data) of all NeRF papers, you can add your own comments or make your own paper analysis tools based on the structured meta data.
Contributors โจ
Thanks goes to these wonderful people (emoji key):
Zelin Zhao ๐ป ๐ง |
EZ-Yang ๐ป |
Alex-Zhang ๐ |
Fan Lu ๐ |
MaybeShewill-CV ๐ |
buer1121 ๐ |
This project follows the all-contributors specification. Contributions of any kind welcome!