2020-10-12 17:05:53 +02:00
# NeRF++
2020-10-16 03:56:30 +02:00
Codebase for arXiv preprint ["NeRF++: Analyzing and Improving Neural Radiance Fields" ](http://arxiv.org/abs/2010.07492 )
2020-10-12 17:05:53 +02:00
* Work with 360 capture of large-scale unbounded scenes.
2020-10-12 18:06:08 +02:00
* Support multi-gpu training and inference with PyTorch DistributedDataParallel (DDP).
2020-10-13 04:18:48 +02:00
* Optimize per-image autoexposure (**experimental feature**).
2020-10-12 17:05:53 +02:00
2020-10-16 00:31:21 +02:00
## Demo
![](demo/tat_Truck.gif) ![](demo/tat_Playground.gif)
2020-10-12 17:05:53 +02:00
## Data
2020-10-12 17:30:30 +02:00
* Download our preprocessed data from [tanks_and_temples ](https://drive.google.com/file/d/11KRfN91W1AxAW6lOFs4EeYDbeoQZCi87/view?usp=sharing ), [lf_data ](https://drive.google.com/file/d/1gsjDjkbTh4GAR9fFqlIDZ__qR9NYTURQ/view?usp=sharing ).
* Put the data in the sub-folder data/ of this code directory.
2020-10-12 17:05:53 +02:00
* Data format.
2020-10-12 17:09:10 +02:00
* Each scene consists of 3 splits: train/test/validation.
2020-10-15 07:21:49 +02:00
* Intrinsics and poses are stored as flattened 4x4 matrices (row-major).
2020-10-15 21:32:40 +02:00
* Pixel coordinate of an image's upper-left corner is (column, row)=(0, 0).
2020-10-15 07:21:49 +02:00
* Poses are camera-to-world, not world-to-camera transformations.
2020-10-12 17:09:10 +02:00
* Opencv camera coordinate system is adopted, i.e., x--->right, y--->down, z--->scene.
2020-10-15 21:33:29 +02:00
* To convert camera poses between Opencv and Opengl conventions, the following code snippet can be used for both Opengl2Opencv and Opencv2Opengl.
2020-10-15 07:17:24 +02:00
```python
import numpy as np
def convert_pose(C2W):
flip_yz = np.eye(4)
flip_yz[1, 1] = -1
flip_yz[2, 2] = -1
C2W = np.matmul(C2W, flip_yz)
return C2W
```
2020-10-12 17:09:10 +02:00
* Scene normalization: move the average camera center to origin, and put all the camera centers inside the unit sphere.
## Create environment
```bash
conda env create --file environment.yml
2020-10-12 18:04:51 +02:00
conda activate nerf-ddp
2020-10-12 17:09:10 +02:00
```
2020-10-12 17:05:53 +02:00
2020-10-12 18:02:40 +02:00
## Training (Use all available GPUs by default)
2020-10-12 17:05:53 +02:00
```python
python ddp_train_nerf.py --config configs/tanks_and_temples/tat_training_truck.txt
```
2020-10-12 18:02:40 +02:00
## Testing (Use all available GPUs by default)
2020-10-12 17:05:53 +02:00
```python
2020-10-12 18:03:32 +02:00
python ddp_test_nerf.py --config configs/tanks_and_temples/tat_training_truck.txt \
--render_splits test,camera_path
2020-10-13 04:17:12 +02:00
```
2020-10-15 16:16:04 +02:00
2020-10-16 01:32:00 +02:00
**Note**: due to restriction imposed by torch.gather function, please make sure the number of pixels in each image is divisible by the number of GPUs if you render images parallelly.
2020-10-15 16:16:04 +02:00
## Citation
Plese cite our work if you use the code.
```python
@article {kaizhang2020,
author = {Kai Zhang and Gernot Riegler and Noah Snavely and Vladlen Koltun},
title = {NeRF++: Analyzing and Improving Neural Radiance Fields},
2020-10-16 03:56:30 +02:00
journal = {arXiv:2010.07492},
2020-10-15 16:16:04 +02:00
year = {2020},
}
```