• Stars
    star
    929
  • Rank 49,172 (Top 1.0 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created about 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

improves over nerf in 360 capture of unbounded scenes

NeRF++

Codebase for arXiv preprint "NeRF++: Analyzing and Improving Neural Radiance Fields"

  • Work with 360 capture of large-scale unbounded scenes.
  • Support multi-gpu training and inference with PyTorch DistributedDataParallel (DDP).
  • Optimize per-image autoexposure (experimental feature).

Demo

Data

  • Download our preprocessed data from tanks_and_temples, lf_data.
  • Put the data in the sub-folder data/ of this code directory.
  • Data format.
    • Each scene consists of 3 splits: train/test/validation.
    • Intrinsics and poses are stored as flattened 4x4 matrices (row-major).
    • Pixel coordinate of an image's upper-left corner is (column, row)=(0, 0), lower-right corner is (width-1, height-1).
    • Poses are camera-to-world, not world-to-camera transformations.
    • Opencv camera coordinate system is adopted, i.e., x--->right, y--->down, z--->scene. Similarly, intrinsic matrix also follows Opencv convention.
    • To convert camera poses between Opencv and Opengl conventions, the following code snippet can be used for both Opengl2Opencv and Opencv2Opengl.
      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
    • Scene normalization: move the average camera center to origin, and put all the camera centers inside the unit sphere. Check normalize_cam_dict.py for details.

Create environment

conda env create --file environment.yml
conda activate nerfplusplus

Training (Use all available GPUs by default)

python ddp_train_nerf.py --config configs/tanks_and_temples/tat_training_truck.txt

Note: In the paper, we train NeRF++ on a node with 4 RTX 2080 Ti GPUs, which took ∼24 hours.

Testing (Use all available GPUs by default)

python ddp_test_nerf.py --config configs/tanks_and_temples/tat_training_truck.txt \
                        --render_splits test,camera_path

Note: due to restriction imposed by torch.distributed.gather function, please make sure the number of pixels in each image is divisible by the number of GPUs if you render images parallelly.

Pretrained weights

I recently re-trained NeRF++ on the tanks and temples data for another project. Here are the checkpoints (google drive) just in case you might find them useful.

Citation

Plese cite our work if you use the code.

@article{kaizhang2020,
    author    = {Kai Zhang and Gernot Riegler and Noah Snavely and Vladlen Koltun},
    title     = {NeRF++: Analyzing and Improving Neural Radiance Fields},
    journal   = {arXiv:2010.07492},
    year      = {2020},
}

Generate camera parameters (intrinsics and poses) with COLMAP SfM

You can use the scripts inside colmap_runner to generate camera parameters from images with COLMAP SfM.

  • Specify img_dir and out_dir in colmap_runner/run_colmap.py.
  • Inside colmap_runner/, execute command python run_colmap.py.
  • After program finishes, you would see the posed images in the folder out_dir/posed_images.
    • Distortion-free images are inside out_dir/posed_images/images.
    • Raw COLMAP intrinsics and poses are stored as a json file out_dir/posed_images/kai_cameras.json.
    • Normalized cameras are stored in out_dir/posed_images/kai_cameras_normalized.json. See the Scene normalization method in the Data section.
    • Split distortion-free images and kai_cameras_normalized.json according to your need. You might find the self-explanatory script data_loader_split.py helpful when you try converting the json file to data format compatible with NeRF++.

Visualize cameras in 3D

Check camera_visualizer/visualize_cameras.py for visualizing cameras in 3D. It creates an interactive viewer for you to inspect whether your cameras have been normalized to be compatible with this codebase. Below is a screenshot of the viewer: green cameras are used for training, blue ones are for testing, while yellow ones denote a novel camera path to be synthesized; red sphere is the unit sphere.

Inspect camera parameters

You can use camera_inspector/inspect_epipolar_geometry.py to inspect if the camera paramters are correct and follow the Opencv convention assumed by this codebase. The script creates a viewer for visually inspecting two-view epipolar geometry like below: for key points in the left image, it plots their correspoinding epipolar lines in the right image. If the epipolar geometry does not look correct in this visualization, it's likely that there are some issues with the camera parameters.

More Repositories

1

ARF-svox2

Artistic Radiance Fields
Python
510
star
2

IRON

Inverse rendering by optimizing neural SDF and materials from photometric images
Python
293
star
3

SatelliteSfM

A library for solving the satellite structure from motion problem
Python
289
star
4

PhySG

Code for PhySG: Inverse Rendering with Spherical Gaussians for Physics-based Relighting and Material Editing
Python
216
star
5

VisSatSatelliteStereo

This is the python interface for adapted COLMAP; you can run both SfM and MVS.
Python
77
star
6

SatelliteNeRF

Python
76
star
7

ColmapForVisSat

Adapted COLMAP intended to work with satellite images
C
50
star
8

DepthSensingBeyondLiDARRange

Python
30
star
9

rpc_triangulation_solver

fast triangulation solver for the RPC model
Python
18
star
10

SatelliteNeuS

Python
18
star
11

colmap_in_docker

install colmap in a docker
Dockerfile
12
star
12

SatellitePlaneSweep

This implements plane sweep stereo for the satellite-based MVS.
C++
11
star
13

texture_mapping

simple texture mapping
Python
10
star
14

DepthSensing

project website for "depth sensing beyond LiDAR range"
JavaScript
10
star
15

VisSatToolSet

Tool set for the VisSat project
Python
9
star
16

IRON-website

JavaScript
4
star
17

PhySG-website

PhySG: Inverse Rendering with Spherical Gaussians forPhysics-based Material Editing and Relighting
HTML
4
star
18

PhySG-adapted

Python
3
star
19

VisSat

project website for 'Leveraging Vision Reconstruction Pipelines for Satellite Imagery'
JavaScript
3
star
20

sps-stereo

add some enhancement to 'siposcsaba89/sps-stereo'
C++
2
star
21

atlas

a texture atlas generator for the texture mapping project
C
1
star