• Stars
    star
    1,039
  • Rank 44,349 (Top 0.9 %)
  • Language
    Python
  • License
    Other
  • Created about 3 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Direct voxel grid optimization for fast radiance field reconstruction.

DirectVoxGO

Direct Voxel Grid Optimization (CVPR2022 Oral, project page, DVGO paper, DVGO v2 paper).

github_teaser_inward_bounded.mp4
github_teaser_forward_facing.mp4

Custom casual capturing

A short guide to capture custom forward-facing scenes and rendering fly-through videos.

Below are two rgb and depth fly-through videos from custom captured scenes.

casual_capturing.mp4

Features

  • Speedup NeRF by replacing the MLP with the voxel grid.
  • Simple scene representation:
    • Volume densities: dense voxel grid (3D).
    • View-dependent colors: dense feature grid (4D) + shallow MLP.
  • Pytorch cuda extention built just-in-time for another 2--3x speedup.
  • O(N) realization for the distortion loss proposed by mip-nerf 360.
    • The loss improves our training time and quality.
    • We have released a self-contained pytorch package: torch_efficient_distloss.
    • Consider a batch of 8192 rays X 256 points.
      • GPU memory consumption: 6192MB => 96MB.
      • Run times for 100 iters: 20 sec => 0.2sec.
  • Supported datasets:

Installation

git clone [email protected]:sunset1995/DirectVoxGO.git
cd DirectVoxGO
pip install -r requirements.txt

Pytorch and torch_scatter installation is machine dependent, please install the correct version for your machine.

Dependencies (click to expand)
  • PyTorch, numpy, torch_scatter: main computation.
  • scipy, lpips: SSIM and LPIPS evaluation.
  • tqdm: progress bar.
  • mmcv: config system.
  • opencv-python: image processing.
  • imageio, imageio-ffmpeg: images and videos I/O.
  • Ninja: to build the newly implemented torch extention just-in-time.
  • einops: torch tensor shaping with pretty api.
  • torch_efficient_distloss: O(N) realization for the distortion loss.

Directory structure for the datasets

(click to expand;)
data
β”œβ”€β”€ nerf_synthetic     # Link: https://drive.google.com/drive/folders/128yBriW1IG_3NJ5Rp7APSTZsJqdJdfc1
β”‚   └── [chair|drums|ficus|hotdog|lego|materials|mic|ship]
β”‚       β”œβ”€β”€ [train|val|test]
β”‚       β”‚   └── r_*.png
β”‚       └── transforms_[train|val|test].json
β”‚
β”œβ”€β”€ Synthetic_NSVF     # Link: https://dl.fbaipublicfiles.com/nsvf/dataset/Synthetic_NSVF.zip
β”‚   └── [Bike|Lifestyle|Palace|Robot|Spaceship|Steamtrain|Toad|Wineholder]
β”‚       β”œβ”€β”€ intrinsics.txt
β”‚       β”œβ”€β”€ rgb
β”‚       β”‚   └── [0_train|1_val|2_test]_*.png
β”‚       └── pose
β”‚           └── [0_train|1_val|2_test]_*.txt
β”‚
β”œβ”€β”€ BlendedMVS         # Link: https://dl.fbaipublicfiles.com/nsvf/dataset/BlendedMVS.zip
β”‚   └── [Character|Fountain|Jade|Statues]
β”‚       β”œβ”€β”€ intrinsics.txt
β”‚       β”œβ”€β”€ rgb
β”‚       β”‚   └── [0|1|2]_*.png
β”‚       └── pose
β”‚           └── [0|1|2]_*.txt
β”‚
β”œβ”€β”€ TanksAndTemple     # Link: https://dl.fbaipublicfiles.com/nsvf/dataset/TanksAndTemple.zip
β”‚   └── [Barn|Caterpillar|Family|Ignatius|Truck]
β”‚       β”œβ”€β”€ intrinsics.txt
β”‚       β”œβ”€β”€ rgb
β”‚       β”‚   └── [0|1|2]_*.png
β”‚       └── pose
β”‚           └── [0|1|2]_*.txt
β”‚
β”œβ”€β”€ deepvoxels         # Link: https://drive.google.com/drive/folders/1ScsRlnzy9Bd_n-xw83SP-0t548v63mPH
β”‚   └── [train|validation|test]
β”‚       └── [armchair|cube|greek|vase]
β”‚           β”œβ”€β”€ intrinsics.txt
β”‚           β”œβ”€β”€ rgb/*.png
β”‚           └── pose/*.txt
β”‚
β”œβ”€β”€ nerf_llff_data     # Link: https://drive.google.com/drive/folders/128yBriW1IG_3NJ5Rp7APSTZsJqdJdfc1
β”‚   └── [fern|flower|fortress|horns|leaves|orchids|room|trex]
β”‚
β”œβ”€β”€ tanks_and_temples  # Link: https://drive.google.com/file/d/11KRfN91W1AxAW6lOFs4EeYDbeoQZCi87/view?usp=sharing
β”‚   └── [tat_intermediate_M60|tat_intermediate_Playground|tat_intermediate_Train|tat_training_Truck]
β”‚       └── [train|test]
β”‚           β”œβ”€β”€ intrinsics/*txt
β”‚           β”œβ”€β”€ pose/*txt
β”‚           └── rgb/*jpg
β”‚
β”œβ”€β”€ lf_data            # Link: https://drive.google.com/file/d/1gsjDjkbTh4GAR9fFqlIDZ__qR9NYTURQ/view?usp=sharing
β”‚   └── [africa|basket|ship|statue|torch]
β”‚       └── [train|test]
β”‚           β”œβ”€β”€ intrinsics/*txt
β”‚           β”œβ”€β”€ pose/*txt
β”‚           └── rgb/*jpg
β”‚
β”œβ”€β”€ 360_v2             # Link: https://jonbarron.info/mipnerf360/
β”‚   └── [bicycle|bonsai|counter|garden|kitchen|room|stump]
β”‚       β”œβ”€β”€ poses_bounds.npy
β”‚       └── [images_2|images_4]
β”‚
β”œβ”€β”€ nerf_llff_data     # Link: https://drive.google.com/drive/folders/14boI-o5hGO9srnWaaogTU5_ji7wkX2S7
β”‚   └── [fern|flower|fortress|horns|leaves|orchids|room|trex]
β”‚       β”œβ”€β”€ poses_bounds.npy
β”‚       └── [images_2|images_4]
β”‚
└── co3d               # Link: https://github.com/facebookresearch/co3d
    └── [donut|teddybear|umbrella|...]
        β”œβ”€β”€ frame_annotations.jgz
        β”œβ”€β”€ set_lists.json
        └── [129_14950_29917|189_20376_35616|...]
            β”œβ”€β”€ images
            β”‚   └── frame*.jpg
            └── masks
                └── frame*.png

GO

  • Training

    $ python run.py --config configs/nerf/lego.py --render_test

    Use --i_print and --i_weights to change the log interval.

  • Evaluation To only evaluate the testset PSNR, SSIM, and LPIPS of the trained lego without re-training, run:

    $ python run.py --config configs/nerf/lego.py --render_only --render_test \
                                                  --eval_ssim --eval_lpips_vgg

    Use --eval_lpips_alex to evaluate LPIPS with pre-trained Alex net instead of VGG net.

  • Render video

    $ python run.py --config configs/nerf/lego.py --render_only --render_video

    Use --render_video_factor 4 for a fast preview.

  • Reproduction: all config files to reproduce our results.

    (click to expand)
      $ ls configs/*
      configs/blendedmvs:
      Character.py  Fountain.py  Jade.py  Statues.py
    
      configs/nerf:
      chair.py  drums.py  ficus.py  hotdog.py  lego.py  materials.py  mic.py  ship.py
    
      configs/nsvf:
      Bike.py  Lifestyle.py  Palace.py  Robot.py  Spaceship.py  Steamtrain.py  Toad.py  Wineholder.py
    
      configs/tankstemple:
      Barn.py  Caterpillar.py  Family.py  Ignatius.py  Truck.py
    
      configs/deepvoxels:
      armchair.py  cube.py  greek.py  vase.py
    
      configs/tankstemple_unbounded:
      M60.py  Playground.py  Train.py  Truck.py
    
      configs/lf:
      africa.py  basket.py  ship.py  statue.py  torch.py
    
      configs/nerf_unbounded:
      bicycle.py  bonsai.py  counter.py  garden.py  kitchen.py  room.py  stump.py
    
      configs/llff:
      fern.py  flower.py  fortress.py  horns.py  leaves.py  orchids.py  room.py  trex.py
    

Custom casually captured scenes

Coming soon hopefully.

Development and tuning guide

Extention to new dataset

Adjusting the data related config fields to fit your camera coordinate system is recommend before implementing a new one. We provide two visualization tools for debugging.

  1. Inspect the camera and the allocated BBox.
    • Export via --export_bbox_and_cams_only {filename}.npz:
      python run.py --config configs/nerf/mic.py --export_bbox_and_cams_only cam_mic.npz
    • Visualize the result:
      python tools/vis_train.py cam_mic.npz
  2. Inspect the learned geometry after coarse optimization.
    • Export via --export_coarse_only {filename}.npz (assumed coarse_last.tar available in the train log):
      python run.py --config configs/nerf/mic.py --export_coarse_only coarse_mic.npz
    • Visualize the result:
      python tools/vis_volume.py coarse_mic.npz 0.001 --cam cam_mic.npz
Inspecting the cameras & BBox Inspecting the learned coarse volume

Speed and quality tradeoff

We have reported some ablation experiments in our paper supplementary material. Setting N_iters, N_rand, num_voxels, rgbnet_depth, rgbnet_width to larger values or setting stepsize to smaller values typically leads to better quality but need more computation. The weight_distortion affects the training speed and quality as well. Only stepsize is tunable in testing phase, while all the other fields should remain the same as training.

Advanced data structure

You will need them for scaling to a higher grid resolution. But we believe our simplest dense grid could still be your good starting point if you have other challenging problems to deal with.

Acknowledgement

The code base is origined from an awesome nerf-pytorch implementation, but it becomes very different from the code base now.

More Repositories

1

py360convert

Python implementation of convertion between equirectangular, cubemap and perspective. (equirect2cube, cube2equirect, equirect2perspec)
Python
410
star
2

HorizonNet

Pytorch implementation of HorizonNet: Learning Room Layout with 1D Representation and Pano Stretch Data Augmentation.
Python
317
star
3

pytorch-layoutnet

Pytorch implementation of LayoutNet.
Python
171
star
4

torch_efficient_distloss

Efficient distortion loss with O(n) realization.
Python
128
star
5

HoHoNet

"HoHoNet: 360 Indoor Holistic Understanding with Latent Horizontal Features" official pytorch implementation.
Jupyter Notebook
103
star
6

PanoPlane360

Indoor Panorama Planar 3D Reconstruction via Divide and Conquer
Python
51
star
7

Talk2AI_Contest

η§‘ζŠ€ε€§ζ“‚ε° θˆ‡AI對話
Jupyter Notebook
6
star
8

HMM

Implement Discrete Hidden Markov Model.
Python
4
star
9

parallel_analysis

Parallel final research project
TeX
4
star
10

ballfight

Term project of course SNP at NCTU
Python
3
star
11

sitcon2016

Developing SITCON 2016's web
HTML
3
star
12

CVFX-HW5

Homework 5 of NTHU CVFX.
Python
3
star
13

Infinite_Zooming

Homework4 of NTHU CVFX. Feature matching for moving forward and infinite zooming effect.
Python
3
star
14

ScratchX-ext

ScratchX extensions for course and lab.
JavaScript
2
star
15

sunset1995.github.io

Personal website
HTML
2
star
16

CAD

cad contest 2015 challenged luser luser and shienchun
C++
2
star
17

ExampleResearchProject

My research projects initial point.
Python
1
star
18

YA-SAT

Yet Another SAT Solver. Term project of PACA.
C++
1
star
19

trex-game-agent

Designed course project for Scratch and Python @ NCTU
Python
1
star
20

CAD2016

luser, luser and xian chong participating CAD Contest 2016
C++
1
star
21

hackgen

JavaScript
1
star
22

WSphoneinfo

Host a website sending sensors' value to websocket server used by our Unity game project.
HTML
1
star
23

CO_LAB2016

NCTU Computer Organization lab in 2016 spring
Verilog
1
star
24

ShadowverseTool

Shadowverse tool [WIP]
Python
1
star
25

exps_manager

Daemon for managing experiments to ease my burden in Grad Student Descent.
1
star