KyujinHan / NeRF_details_code_analysis

NeRF code analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

D-NeRF_details_code_analysis

D-NeRF code analysis My blog: https://kyujinpy.tistory.com/26


D-NeRF code almost same the NeRF.
D-NeRF only added 'Deformation network' and 't' input.
So, if you understand the D-NeRF code, you must understand NeRF code..!!!


Github reference

NeRF
NeRF github: https://github.com/yenchenlin/nerf-pytorch

D-NeRF
D-NeRF github: https://github.com/albertpumarola/D-NeRF


CODE

1. You just use the 'D-NeRF implementation.ipynb' or 'D-NeRF not_change_version.ipynb' file.

2. You use 'D_NeRF.py'  
> In this case, the code consists of 3 python scripts.  

This code very details about code analysis.
I wrote the many many comment, because of understanding.


Dataset

D-NeRF dataset
In D-NeRF, there are pre-trained model and datasets.

This code can be use these dataset.
So you can download and implementation this.
If using hellwarrior data, you just move file in data folder..!!


Be careful

Currently, this code cannot use the pre-trained model.
Because I changed some class name.

If you want to use pre-trained model in 'D-NeRF implementaion.ipynb', you change class name same like D-NeRF github.

First,  
class Canonical_NeRF -> NeRFOriginal  
class D_NeRF -> DirectTemporalNeRF  

Second,  
self._deformation_layers, self._deformation_out_layer -> self._time, self._time_out  
self._ca_nerf -> self._occ  

Third,
This code, Canonical_NeRF class forward() function's argument is (self, x)
You must change the Canonical_NeRF input (self, x, t)

Or, you just use 'D-NeRF not_change_version.ipynb', you can use pretrain-weights!
There are some visualization methods.


Video

# Put the code in 'D-NeRF not_change_version.ipynb' last block.

# Sava in (basedir + expname + ...)
torch.set_default_tensor_type('torch.cuda.FloatTensor')
args.no_reload = False
args.render_only = True
args.render_test = False
args.basedir = './logs'
args.dataset_type = 'blender'

for i in range(6):
    
    if i == 0:
        args.config = './configs/bouncingballs.txt'
        args.expname = 'bouncingballs'
        args.datadir = './data/bouncingballs/'
    
    elif i == 1:
        args.config = './configs/hellwarrior.txt'
        args.expname = 'hellwarrior'
        args.datadir = './data/hellwarrior/'
    
    elif i == 2:
        args.config = './configs/hook.txt'
        args.expname = 'hook'
        args.datadir = './data/hook/'
        
    elif i == 3:
        args.config = './configs/jumpingjacks.txt'
        args.expname = 'jumpingjacks'
        args.datadir = './data/jumpingjacks/'
    
    elif i == 4:
        args.config = './configs/lego.txt'
        args.expname = 'lego'
        args.datadir = './data/lego/'
        
    elif i == 5:
        args.config = './configs/mutant.txt'
        args.expname = 'mutant'
        args.datadir = './data/mutant/'
    
    train(args)

My Result (Video)

video (1) video (2) video (3) video (4) video (5) video


Other thing

Any other question, you visit my blog and I will reply if you comment.
Thank you..!

About

NeRF code analysis


Languages

Language:Jupyter Notebook 98.9%Language:Python 1.1%