Skip to content

HrushikeshBudhale/NeRF_from_scratch

Repository files navigation

NeRF_from_scratch

Nerf with minimalistic implementation of NeRF from paper NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis

If you are new to the field of NeRF, I recommend watching this video and reading the original NeRF paper. If you are new to 'Positional Encoding' which is one of the key inventions that made NeRFs and transformers possible, checkout my other repo Fourier_feature_positional_encoding.

The code is written in a way to make it easier for learners to understand the concepts and add new changes and models on top of it.

'main' branch

This branch implements stratified sampling with single network.

NeRF Results

This small model can achieve a PSNR score of 25.0.

NeRF Results

Novel view synthesis results:

NeRF Results NeRF Results

Branch 'nerf_with_hierarchical_sampling'

This branch implements hierarchical sampling that uses additional samples making the reconstruction more accurate.

(Do checkout the difference between the two branches to understand the little change needed to implement hierarchical sampling.)

NeRF Results You can find the data required to train the model here on gdrive.

NeRF Results NeRF Results

With hierarchical sampling recon can achieve higher PSNR value. (from previous 25.0 to 28.6).

NeRF Results

NeRF Results

Installation

  1. Create a conda environment with python 3.10.

    conda create -n nerf python=3.10
    conda activate nerf
  2. Install supported version of pytorch.

  3. Install the dependencies.

    pip install -r requirements.txt
  4. Download the scene data from gdrive. (or use your own data)

  5. Update the config file with the path to the data.

  6. Run the code.

    python train_nerf.py
    python test_nerf.py

NeRFs and Gaussian Splatting have revolutionized the field of 3D reconstruction and view synthesis. Instant Neural Graphics Primitives (InstantNGP) by NVIDIA took NeRFs to the next level by making it much faster and more accurate.

If you are interested in learning NGP checkout my other repo NGP_from_scratch that builds on top of this code and achieves even better results.

Acknowledgements

About

reimplementation of Nerf with minimal code

Topics

Resources

License

Stars

Watchers

Forks

Languages