Skip to content

wyhuai/NeRFocus

Repository files navigation

NeRFocus: Neural Radiance Field for 3D Synthetic Defocus

This repository contains the code release for NeRFocus: Neural Radiance Field for 3D Synthetic Defocus. This implementation is written in JAX, and is a fork of Jon Barron's Mip-NeRF implementation. image

Installation

git clone https://github.com/wyhuai/nerfocus.git; cd nerfocus
conda install pip; pip install --upgrade pip
pip install -r requirements.txt

Evaluation

We provide a pretrained model in experiments/horns, so you can run the following command to generate a video with defocus effects. You may change the lens parameters "l" and "a" in eval_vid.py to adjust the focus distance and aperture size. python -m eval_vid --data_dir=horns --train_dir=experiments/horns --chunk=3196 --gin_file=configs/llff.gin --logtostderr

Data

You can download the datasets from the NeRF official Google Drive.

Generate multi-blur datasets

You can generate the multi-blur datasets by running datatool.py, remember to change your desired data path and the blur kernel size.

Training

Run the following command, make sure the path is correct. You also need to change the path inside train.py to your data path.
python -m train --data_dir=horns --train_dir=experiments/horns --gin_file=configs/llff.gin --logtostderr

You can also train your own dataset, as long as it confroms to NeRF data format.

Results

Click to watch video demonstration

image image image

About

Extending Mip-NeRF for rendering defocus effects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages