• Stars
    star
    189
  • Rank 203,474 (Top 5 %)
  • Language
    Python
  • License
    Other
  • Created over 2 years ago
  • Updated about 1 year ago

Reviews

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

Repository Details

[ECCV 2022] R2L: Distilling Neural Radiance Field to Neural Light Field for Efficient Novel View Synthesis

R2L: Distilling NeRF to NeLF

Project | ArXiv | PDF

 

This repository is for the new neral light field (NeLF) method introduced in the following ECCV'22 paper:

R2L: Distilling Neural Radiance Field to Neural Light Field for Efficient Novel View Synthesis
Huan Wang 1,2, Jian Ren 1, Zeng Huang 1, Kyle Olszewski 1, Menglei Chai 1, Yun Fu 2, and Sergey Tulyakov 1
1 Snap Inc. 2 Northeastern University
Work done when Huan was an intern at Snap Inc.

[TL;DR] We present R2L, a deep (88-layer) residual MLP network that can represent the neural light field (NeLF) of complex synthetic and real-world scenes. It is featured by compact representation size (~20MB storage size), faster rendering speed (~30x speedup than NeRF), significantly improved visual quality (1.4dB boost than NeRF), with no whistles and bells (no special data structure or parallelism required).

Reproducing Our Results

Below we only show the example of scene lego. You may test on other scenes simply by changing all the lego word segment to other scene names. Scripts have been doubled-checked. You should be able to run them simply by copy-paste.

0. Download the code

git clone [email protected]:snap-research/R2L.git && cd R2L

1. Set up (original) data

sh scripts/download_example_data.sh

2. Set up environment with Anaconda

  • conda create --name R2L python=3.9.6
  • conda activate R2L
  • pip install -r requirements.txt (We use torch 1.9.0, torchvision 0.10.0)

3. Quick start: test our trained models

  • Download models:
sh scripts/download_R2L_models.sh
  • Run
CUDA_VISIBLE_DEVICES=0 python main.py --model_name R2L --config configs/lego_noview.txt --n_sample_per_ray 16 --netwidth 256 --netdepth 88 --use_residual --cache_ignore data --trial.ON --trial.body_arch resmlp --pretrained_ckpt R2L_Blender_Models/lego.tar --render_only --render_test --testskip 1 --screen --project Test__R2L_W256D88__blender_lego

4. Train R2L models

There are two major steps in R2L training. (1) Use pretrained NeRF model to generate synthetic data and train R2L network on the synthetic data -- this step can make our R2L model perform comparably to the NeRF teacher; (2) Finetune the R2L model in (1) with the real data -- this step will further boost the performance and make our R2L model outperform the NeRF teacher.

The detailed step-by-step training pipeline is as follows.

Step 1.

Train a NeRF model:

CUDA_VISIBLE_DEVICES=0 python main.py --model_name nerf --config configs/lego.txt --screen --cache_ignore data,__pycache__,torchsearchsorted,imgs --project NeRF__blender_lego

You can also download the teachers we trained to continue first:

sh scripts/download_NeRF_models.sh

To test the download teachers, you can use

CUDA_VISIBLE_DEVICES=0 python main.py --model_name nerf --config configs/lego.txt --pretrained_ckpt NeRF_Blender_Models/lego.tar --render_only --render_test --testskip 1 --screen --project Test__NeRF__blender_lego

Step 2.

Use the pretrained NeRF model to generate synthetic data (saved in .npy format):

CUDA_VISIBLE_DEVICES=0 python utils/create_data.py --create_data rand --config configs/lego.txt --teacher_ckpt Experiments/NeRF__blender_lego*/weights/200000.tar --n_pose_kd 10000 --datadir_kd data/nerf_synthetic/lego:data/nerf_synthetic/lego_pseudo_images10k --screen --cache_ignore data,__pycache__,torchsearchsorted,imgs --project NeRF__blender_lego__create_pseudo

If you are using the downloaded teachers, please use this snippet:

CUDA_VISIBLE_DEVICES=0 python utils/create_data.py --create_data rand --config configs/lego.txt --teacher_ckpt NeRF_Blender_Models/lego.tar --n_pose_kd 10000 --datadir_kd data/nerf_synthetic/lego:data/nerf_synthetic/lego_pseudo_images10k --screen --cache_ignore data,__pycache__,torchsearchsorted,imgs --project NeRF__blender_lego__create_pseudo

The pseudo data will be saved in data/nerf_synthetic/lego_pseudo_images10k. Every 4096 rays are saved in one .npy file. For 10k images (400x400 resoltuion), there will be 309600 .npy files. On our RTX 2080Ti GPU, rendering 1 image with NeRF takes around 8.5s, so 10k images would take around 24hrs. If you want to try our method quicker, you may download the lego data we synthesized (500 images, 2.8GB) and go to Step 3:

sh scripts/download_lego_pseudo_images500.sh

The data will be extracted under data/nerf_synthetic/lego_pseudo_images500. Using only 500 pseudo images for training would lead to degraded quality, but based on our ablation study (see Fig. 6 in our paper), it works farily good.

Step 3.

Train R2L model on the synthetic data:

CUDA_VISIBLE_DEVICES=0 python main.py --model_name R2L --config configs/lego_noview.txt --n_sample_per_ray 16 --netwidth 256 --netdepth 88 --datadir_kd data/nerf_synthetic/lego_pseudo_images10k --n_pose_video 20,1,1 --N_iters 1200000 --N_rand 20 --data_mode rays --hard_ratio 0.2 --hard_mul 20 --use_residual --trial.ON --trial.body_arch resmlp --num_worker 8 --warmup_lr 0.0001,200 --cache_ignore data,__pycache__,torchsearchsorted,imgs --screen --project R2L__blender_lego

If you are using the downloaded lego_pseudo_images500 data, please use this snippet:

CUDA_VISIBLE_DEVICES=0 python main.py --model_name R2L --config configs/lego_noview.txt --n_sample_per_ray 16 --netwidth 256 --netdepth 88 --datadir_kd data/nerf_synthetic/lego_pseudo_images500 --n_pose_video 20,1,1 --N_iters 1200000 --N_rand 20 --data_mode rays --hard_ratio 0.2 --hard_mul 20 --use_residual --trial.ON --trial.body_arch resmlp --num_worker 8 --warmup_lr 0.0001,200 --cache_ignore data,__pycache__,torchsearchsorted,imgs --screen --project R2L__blender_lego

Step 4.

Convert original real data (images) to our .npy format:

  • For blender data:
python utils/convert_original_data_to_rays_blender.py --splits train --datadir data/nerf_synthetic/lego

The converted data will be saved in data/nerf_synthetic/lego_real_train.

  • For llff data:
python utils/convert_original_data_to_rays_llff.py --splits train --datadir data/nerf_llff_data/flower

The converted data will be saved in data/nerf_llff_data/room_real_train.

Step 5.

Finetune the R2L model in Step 3 on the data in Step 4:

CUDA_VISIBLE_DEVICES=0 python main.py --model_name R2L --config configs/lego_noview.txt --n_sample_per_ray 16 --netwidth 256 --netdepth 88 --datadir_kd data/nerf_synthetic/lego_real_train --n_pose_video 20,1,1 --N_iters 1600000 --N_rand 20 --data_mode rays --hard_ratio 0.2 --hard_mul 20 --use_residual --cache_ignore data,__pycache__,torchsearchsorted,imgs --screen --trial.ON --trial.body_arch resmlp --num_worker 8 --warmup_lr 0.0001,200 --save_intermediate_models --pretrained_ckpt Experiments/R2L__blender_lego_SERVER*/weights/ckpt_1200000.tar --resume --project R2L__blender_lego__ft

Note, this step is pretty fast and prone to overfitting, so do not finetune it too much. We simply set the finetuning steps based on our validation.

Results

The quantitative and qualitative comparison are shown below. See more results and videos on our webpage.


Acknowledgments

In this code we refer to the following implementations: nerf-pytorch and smilelogging. Great thanks to them! We especially thank nerf-pytorch. Our code is largely built upon their wonderful implementation. We also greatly thank the anounymous ECCV'22 reviewers for the constructive comments to help us improve the paper.

Reference

If our work or code helps you, please consider to cite our paper. Thank you!

@inproceedings{wang2022r2l,
  author = {Huan Wang and Jian Ren and Zeng Huang and Kyle Olszewski and Menglei Chai and Yun Fu and Sergey Tulyakov},
  title = {R2L: Distilling Neural Radiance Field to Neural Light Field for Efficient Novel View Synthesis},
  booktitle = {ECCV},
  year = {2022}
}

More Repositories

1

articulated-animation

Code for Motion Representations for Articulated Animation paper
Jupyter Notebook
1,210
star
2

EfficientFormer

EfficientFormerV2 [ICCV 2023] & EfficientFormer [NeurIPs 2022]
Python
972
star
3

NeROIC

Python
909
star
4

HyperHuman

[ICLR 2024] Github Repo for "HyperHuman: Hyper-Realistic Human Generation with Latent Structural Diffusion"
HTML
489
star
5

Panda-70M

[CVPR 2024] Panda-70M: Captioning 70M Videos with Multiple Cross-Modality Teachers
Python
459
star
6

MoCoGAN-HD

[ICLR 2021 Spotlight] A Good Image Generator Is What You Need for High-Resolution Video Synthesis
Python
240
star
7

3dgp

3D generation on ImageNet [ICLR 2023]
Python
207
star
8

MMVID

[CVPR 2022] Show Me What and Tell Me How: Video Synthesis via Multimodal Conditioning
Python
194
star
9

MobileR2L

[CVPR 2023] Real-Time Neural Light Field on Mobile Devices
Python
192
star
10

CAT

[CVPR 2021] Teachers Do More Than Teach: Compressing Image-to-Image Models (CAT)
Python
180
star
11

discoscene

CVPR 2023 Highlight: DiscoScene
Python
138
star
12

3DVADER

Source code for the paper: "AutoDecoding Latent 3D Diffusion Models"
132
star
13

BitsFusion

118
star
14

SnapFusion

HTML
95
star
15

F8Net

[ICLR 2022 Oral] F8Net: Fixed-Point 8-bit Only Multiplication for Network Quantization
Python
95
star
16

SF-V

This respository contains the code for SF-V: Single Forward Video Generation Model.
82
star
17

AToM

Official implementation of `AToM: Amortized Text-to-Mesh using 2D Diffusion`
82
star
18

graphless-neural-networks

[ICLR 2022] Code for Graph-less Neural Networks: Teaching Old MLPs New Tricks via Distillation (GLNN)
Python
75
star
19

MLPInit-for-GNNs

[ICLR 2023] MLPInit: Embarrassingly Simple GNN Training Acceleration with MLP Initialization
Jupyter Notebook
69
star
20

unsupervised-volumetric-animation

The repository for paper Unsupervised Volumetric Animation
Python
67
star
21

non-contrastive-link-prediction

[ICLR 2023] Link Prediction with Non-Contrastive Learning
Python
26
star
22

linkless-link-prediction

[ICML 2023] Linkless Link Prediction via Relational Distillation
Python
18
star
23

locomo

Python
15
star
24

LargeGT

Graph Transformers for Large Graphs
Python
13
star
25

efficient-nn-tutorial

Page for the CVPR 2023 Tutorial - Efficient Neural Networks: From Algorithm Design to Practical Mobile Deployments
HTML
13
star
26

weights2weights

Official Implementation of weights2weights
12
star
27

SpFDE

[NeurIPs 2022] Layer Freezing & Data Sieving: Missing Pieces of a Generic Framework for Sparse Training
11
star
28

representations-for-creativity

HTML
7
star
29

hpdm

Hierarchical Patch Diffusion Models for High-Resolution Video Synthesis [CVPR 2024]
HTML
7
star
30

video-synthesis-tutorial

HTML
5
star
31

snap-research-website

https://research.snap.com/
HTML
2
star
32

promptable-game-models

2
star
33

NeurT-FDR

NeurT-FDR, a method for controlling false discovery rate by incorporating feature hierarchy
Python
2
star
34

qfar

Official implementation of MobiCom 2023 paper "QfaR: Location-Guided Scanning of Visual Codes from Long Distances"
Python
1
star
35

cabam-graph-generation

[KDD MLG'20] Class-Assortative Barabasi Albert Model for Graph Generation
Jupyter Notebook
1
star
36

cv-call-for-interns-2022

HTML
1
star
37

NodeDup

Node Duplication Improves Cold-start Link Prediction
Python
1
star
38

SPAD

Source code for paper "SPAD: Spatially Aware Multi-View Diffusers"
1
star
39

snapvideo

HTML
1
star