yenchenlin / nerf-pytorch

A PyTorch implementation of NeRF (Neural Radiance Fields) that reproduces the results.
MIT License
5.38k stars 1.05k forks source link

The value of 'skips' parameter at NeRF class #78

Closed wowo0709 closed 2 years ago

wowo0709 commented 2 years ago

Hi.

While looking at the NeRF code in run_nerf_helpers.py, I had a question about skips=[4].

Below is the network architecture in the NeRF paper and the code of run_nerf_helpers.py lines 79~80.

NeRF architecture

image-20220720180532667

Code

self.pts_linears = nn.ModuleList(
            [nn.Linear(input_ch, W)] + [nn.Linear(W, W) if i not in self.skips else nn.Linear(W + input_ch, W) for i in range(D-1)])

As you can see in the architecture, skip occurs at the 5th layer, and according to the code, skip occurs at the 6th layer.

If there is a special reason for this, or if there is something I am missing, please let me know.

Thanks

wowo0709 commented 2 years ago

Oh, I confused. The code is right.

It is correct to concat with the input of the 6th layer 😂

You can delete this issue