Add PyNeRF external method (#2734)

* add pynerf method

* fixes

* fixes

* format

* rename k-planes references
This commit is contained in:
hturki authored and GitHub committed 2024-01-10 00:58:02 +00:00
1 parent 451a70c1f3
commit 7edd768240
4 files changed
+117

No files matched your search

+1
View File
@@ -152,6 +152,7 @@ This documentation is organized into 3 parts:
- [NeRFPlayer](nerfology/methods/nerfplayer.md): 4D Radiance Fields by Streaming Feature Channels
- [Tetra-NeRF](nerfology/methods/tetranerf.md): Representing Neural Radiance Fields Using Tetrahedra
- [Instruct-GS2GS](nerfology/methods/igs2gs.md): Editing 3DGS Scenes with Instructions
- [PyNeRF](nerfology/methods/pynerf.md): Pyramidal Neural Radiance Fields
**Eager to contribute a method?** We'd love to see you use nerfstudio in implementing new (or even existing) methods! Please view our {ref}`guide<own_method_docs>` for more details about how to add to this list!
+1
View File
@@ -39,6 +39,7 @@ The following methods are supported in nerfstudio:
TensoRF<tensorf.md>
Generfacto<generfacto.md>
Instruct-GS2GS<igs2gs.md>
PyNeRF<pynerf.md>
```
(own_method_docs)=
+92
View File
@@ -0,0 +1,92 @@
# PyNeRF
<h4>Pyramidal Neural Radiance Fields</h4>
```{button-link} https://haithemturki.com/pynerf/
:color: primary
:outline:
Paper Website
```
```{button-link} https://github.com/hturki/pynerf
:color: primary
:outline:
Code
```
<video id="teaser" muted autoplay playsinline loop controls width="100%">
<source id="mp4" src="https://haithemturki.com/pynerf/vids/ficus.mp4" type="video/mp4">
</video>
**A fast NeRF anti-aliasing strategy.**
## Installation
First, install Nerfstudio and its dependencies. Then install the PyNeRF extension and [torch-scatter](https://github.com/rusty1s/pytorch_scatter):
```
pip install git+https://github.com/hturki/pynerf
pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH_VERSION}+${CUDA}.html
```
## Running PyNeRF
There are three default configurations provided which use the MipNeRF 360 and Multicam dataparsers by default. You can easily use other dataparsers via the ``ns-train`` command (ie: ``ns-train pynerf nerfstudio-data --data <your data dir>`` to use the Nerfstudio data parser)
The default configurations provided are:
| Method | Description | Scene type | Memory |
| ----------------------- |---------------------------------------------------| ------------------------------ |--------|
| `pynerf ` | Tuned for outdoor scenes, uses proposal network | outdoors | ~5GB |
| `pynerf-synthetic` | Tuned for synthetic scenes, uses proposal network | synthetic | ~5GB |
| `pynerf-occupancy-grid` | Tuned for Multiscale blender, uses occupancy grid | synthetic | ~5GB |
The main differences between them is whether they are suited for synthetic/indoor or real-world unbounded scenes (in case case appearance embeddings and scene contraction are enabled), and whether sampling is done with a proposal network (usually better for real-world scenes) or an occupancy grid (usally better for single-object synthetic scenes like Blender).
## Method
Most NeRF methods assume that training and test-time cameras capture scene content from a roughly constant distance:
<table>
<tbody>
<tr>
<td style="width: 48%;">
<div style="display: flex; justify-content: center; align-items: center;">
<img src="https://haithemturki.com/pynerf/images/ficus-cameras.jpg">
</div>
</td>
<td style="width: 4%;"><img src="https://haithemturki.com/pynerf/images/arrow-right-white.png" style="width: 100%;"></td>
<td style="width: 48%;">
<video width="100%" autoplay loop controls>
<source src="https://haithemturki.com/pynerf/vids/ficus-rotation.mp4" type="video/mp4" poster="https://haithemturki.com/pynerf/images/ficus-rotation.jpg">
</video>
</td>
</tr>
</tbody>
</table>
They degrade and render blurry views in less constrained settings:
<table>
<tbody>
<tr>
<td style="width: 48%;">
<div style="display: flex; justify-content: center; align-items: center;">
<img src="https://haithemturki.com/pynerf//images/ficus-cameras-different.jpg">
</div>
</td>
<td style="width: 4%;"><img src="https://haithemturki.com/pynerf/images/arrow-right-white.png" style="width: 100%;"></td>
<td style="width: 48%;">
<video width="100%" autoplay loop controls>
<source src="https://haithemturki.com/pynerf/vids/ficus-zoom-nerf.mp4" type="video/mp4" poster="https://haithemturki.com/pynerf/images/ficus-zoom-nerf.jpg">
</video>
</td>
</tr>
</tbody>
</table>
This is due to NeRF being scale-unaware, as it reasons about point samples instead of volumes. We address this by training a pyramid of NeRFs that divide the scene at different resolutions. We use "coarse" NeRFs for far-away samples, and finer NeRF for close-up samples:
<img src="https://haithemturki.com/pynerf/images/model.jpg" width="70%" style="display: block; margin-left: auto; margin-right: auto">