Git Product home page Git Product logo

nerf-pytorch-reproduce's Introduction

nerf-pytorch-reproduce

A PyTorch Re-Implementation

NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
Ben Mildenhall*1, Pratul P. Srinivasan*1, Matthew Tancik*1, Jonathan T. Barron2, Ravi Ramamoorthi3, Ren Ng1
1UC Berkeley, 2Google Research, 3UC San Diego
*denotes equal contribution

A PyTorch re-implementation of Neural Radiance Fields.

Readability Matters!

Since the original release, and the concurrent pytorch implementation wrote all the codes basically in just two files, run_nerf.py and run_nerf_helper.py, which makes it very hard to read, along with many unnecessary operations, I re-organize the whole code architecture as below, which is more concise and readable.

β”œβ”€β”€ core
β”‚Β Β  β”œβ”€β”€ datasets
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ create_dataloader.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ create_dataset.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ create_rays.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ load_blender.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ load_deepvoxels.py
β”‚Β Β  β”‚Β Β  └── load_llff.py
β”‚Β Β  β”œβ”€β”€ models
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ create_model.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ embedder.py
β”‚Β Β  β”‚Β Β  └── nerf.py
β”‚Β Β  └── utils
β”‚Β Β      β”œβ”€β”€ create_configs.py
β”‚Β Β      β”œβ”€β”€ metrics.py
β”‚Β Β      β”œβ”€β”€ test_nerf_utils.py
β”‚Β Β      └── train_nerf_utils.py
β”œβ”€β”€ run_nerf.py

Modifications

Besides the re-organization, I re-implement some of the core functions in NeRF:

  • core/datasets/dataset.py: a unified dataset for blender, llff data type, with all N*H*W rays generated;
  • core/datasets/dataloader.py: a unified dataloader for both no_batching=True/False;
  • core/datasets/create_rays.py: a vectorized implementation of rays generation, N*H*W rays once;
  • core/models/embedder.py: a vectorized implementation of positional encoding;

With all the modifications describes above, this NeRF version is a little🫠 faster than the concurrent pytorch implementation, which may illustrates the bottleneck may relies on the caching of data, according to the re-implementaion by krrish94.

How To Run?

Quick Start

Download data for two example datasets: lego and fern

bash download_example_data.sh

To train a low-res lego NeRF:

python run_nerf.py --config configs/lego.txt

To train a high-res lego NeRF:

python run_nerf.py --config configs/lego-official.txt

To train a low-res fern NeRF:

python run_nerf.py --config configs/fern.txt

Sample Results from the Repo

On Synthetic Data lego

On Real Data llff

Citation

@misc{mildenhall2020nerf,
    title={NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis},
    author={Ben Mildenhall and Pratul P. Srinivasan and Matthew Tancik and Jonathan T. Barron and Ravi Ramamoorthi and Ren Ng},
    year={2020},
    eprint={2003.08934},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

nerf-pytorch-reproduce's People

Contributors

xx-peach avatar

Stargazers

haoming yu avatar

Watchers

Kostas Georgiou avatar

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.