Giter VIP home page Giter VIP logo

aug-nerf's Introduction

Aug-NeRF: Training Stronger Neural Radiance Fields with Triple-Level Physically-Grounded Augmentations

License: MIT

Official implementation of CVPR 2022 paper "Aug-NeRF: Training Stronger Neural Radiance Fields with Triple-Level Physically-Grounded Augmentations".

Tianlong Chen*, Peihao Wang*, Zhiwen Fan, Zhangyang (Atlas) Wang

Introduction

Neural Radiance Field (NeRF) regresses a neural parameterized scene by differentially rendering multi-view images with ground-truth supervision. However, when interpolating novel views, NeRF often yields inconsistent and visually non-smooth geometric results, which we consider as a generalization gap between seen and unseen views. Recent advances in convolutional neural networks have demonstrated the promise of advanced robust data augmentations, either random or learned, in enhancing both in-distribution and out-of-distribution generalization. Inspired by that, we propose Augmented NeRF (Aug-NeRF), which for the first time brings the power of robust data augmentations into regularizing the NeRF training. Particularly, our proposal learns to seamlessly blend worst-case perturbations into three distinct levels of the NeRF pipeline with physical grounds, including (1) the input coordinates, to simulate imprecise camera parameters at image capture; (2) intermediate features, to smoothen the intrinsic feature manifold; and (3) pre-rendering output, to account for the potential degradation factors in the multi-view image supervision. Extensive results demonstrate that Aug-NeRF effectively boosts NeRF performance in both novel view synthesis (up to 1.5 dB PSNR gain) and underlying geometry reconstruction. Furthermore, thanks to the implicit smooth prior injected by the triple-level augmentations, Aug-NeRF can even recover scenes from heavily corrupted images, a highly challenging setting untackled before.

Getting Started

Dependency

We recommend users to use conda to install the running environment. The following dependencies are required:

pytorch=1.7.0
torchvision=0.8.0
cudatoolkit=11.0
tensorboard=2.7.0
opencv
imageio
imageio-ffmpeg
configargparse
scipy
matplotlib
tqdm
mrc
lpips

Data Preparation

To run our code on NeRF dataset, users need first download data from official cloud drive. Then extract package files according to the following directory structure:

├── configs
│   ├── ...
│
├── datasets
│   ├── nerf_llff_data
│   │   └── fern
│   │   └── flower  # downloaded llff dataset
│   │   └── horns   # downloaded llff dataset
|   |   └── ...
|   ├── nerf_synthetic
|   |   └── lego
|   |   └── ship    # downloaded synthetic dataset
|   |   └── ...

The last step is to generate and process data via our provided script:

python gen_dataset.py --config <config_file>

where <config_file> is the path to the configuration file of your experiment instance. Examples and pre-defined configuration files are provided in configs folder.

Our synthetic noisy dataset will come soon ...

Usage

Training

After generating datasets, users can train a vanilla NeRF by the following command:

python run_nerf.py --gpuid <gpu_id> --expname <output_folder> --config <default_config_file>

To apply adversarial augmentation, users can specify the option --adv:

python run_nerf.py --gpuid <gpu_id> --expname <output_folder> --config <default_config_file>
--adv <adv types> --pgd_alpha <pgd alpha> --pgd_iters <pgd iters> --pgd_eps <pgd eps>

where available options include 1) Coordinate perturbation: pts_c, pts_f, zval_c, zval_f, 2) Intermediate feature perturbation: feat_c, feat_f and 3) Pre-rendering output perturbation: raw_c, raw_f. Hyper-parameters --pgd_alpha, --pgd_alpha, --pgd_iters, --pgd_eps should be specified for each type of perturbations accordingly.

Visualization

While training, users can view logging information through tensorboard:

tensorboard --logdir='./logs' --port <your_port> --host 0.0.0.0

When training is done, users can evaluate and synthesize exhibition video by running:

python run_nerf.py --eval --eval_video --gpuid <gpu_id> --config <default_config_file>

To visualize geometry, users can first generate density field with flag --eval_vol:

python run_nerf.py --eval --eval_vol --gpuid <gpu_id> --config <default_config_file>

The exported volume will be saved into <expname>/eval/ directory (with both .npy and .mrc suffices). Then users can use Python library PyMCubes or USCF Chimera to threshold and extract meshes from the density field.

Citation

This repository is build based on NeRF-Pytorch repository.

If you find our code implementation helpful for your own resarch or work, please cite our paper.

@inproceedings{chen2022augnerf,
title={Aug-NeRF: Training Stronger Neural Radiance Fields with Triple-Level Physically-Grounded Augmentations},
author={Chen, Tianlong and Wang, Peihao and Fan, Zhiwen and Wang, Zhangyang},
booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2022}
}

aug-nerf's People

Contributors

peihaowang avatar tianlong-chen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aug-nerf's Issues

Where can I find your paper?

Thanks for your wonderful work! It is really interesting !

However, where can I find this paper?

Looking for your reply!

Pre-trained checkpoints needed

Thank you for providing code for this excellent work!
I'm wondering if you could add some pre-trained Aug-NeRF checkpoints into your codebase in convinience of my studies, as for my lacking of computing power for training.
Appreciate your help in advance!

Hyper-Parameter Values

Hello, there! First of all, thanks for the repo, the paper is really interesting.

I was wondering if you could share the values for the hyper-parameters --pgd_alpha, --pgd_iters, --pgd_ep that you used for each of the perturbations in order to obtain the paper results.

GPU Memory Requirement

How much memory does training Aug-NeRF require? For my RTX 3070 with 8GB memory, it keeps running out of memory even when I set --ray_chunk 32 and --pts_chunk 256. Shall I give up training Aug-NeRF on my RTX 3070?

Runtime

What's the runtime like for a typical scene?

Adversarial training is meaningless, maybe the codes are wrong?

Hello,
Really nice job! But I have some concerns with the released codes.

According to your codes, AdvNeRFNet has three components, that are AdvNeRFNet.nerf_adv, AdvNeRFNet.nerf and AdvNeRFNet.nerf_fine.

During training, the loss_adv and adv_perturb are only related with the update of AdvNeRFNet.nerf_adv, and the loss_clean is only related with the update of AdvNeRFNet.nerf and AdvNeRFNet.nerf_fine.

During inference, only AdvNeRFNet.nerf and AdvNeRFNet.nerf_fine are involved.

After carefully checking your codes, I find that AdvNeRFNet.nerf_adv, AdvNeRFNet.nerf and AdvNeRFNet.nerf_fine are independent with each other and there are no common components before or after them, so the existence of the AdvNeRFNet.nerf_adv branch seems meaningless to the training and inference step of conventional NeRF.

What do you think? Is there any details I ignore?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.