adding viewer video + other doc related updates (#688)

This commit is contained in:
evonneng authored and GitHub committed 2022-10-05 02:59:59 -07:00
1 parent 9cc50132c5
commit 917d02c695
13 files changed
+142 -50

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
Pipelines Overview
Pipelines overview
-------------------------
Here we describe what a Pipeline is and how it works. You can see an overview figure with the major Pipeline components below.
@@ -1,4 +1,4 @@
# Viewer Overview
# Viewer overview
> We have a real-time web viewer that requires no installation. It's available at [https://viewer.nerf.studio/](https://viewer.nerf.studio/), where you can connect to your training job. If you want to understand how the viewer works and contribute to it's features, this section is for you!
+6 -2
View File
@@ -1,13 +1,17 @@
# Methods
We provide a set of pre implemented nerfstudio methods. One of the goals of nerfstudio is to modularize the various NeRF techniques as much as possible. As a result, many of the techniques from these pre-implemented methods can be mixed.
We provide a set of pre implemented nerfstudio methods.
**The goal of nerfstudio is to modularize the various NeRF techniques as much as possible.**
As a result, many of the techniques from these pre-implemented methods can be mixed 🎨.
## Running a method
It's easy!
```bash
ns-train METHOD_NAME
ns-train {METHOD_NAME}
```
To list the available methods run:
+5
View File
@@ -13,3 +13,8 @@ Paper Website
```bash
ns-train instant-ngp
```
```{admonition} Coming Soon
This guide is coming soon.
```
+16 -10
View File
@@ -8,17 +8,17 @@
Paper Website
```
### Running the Model
### Running the model
```bash
ns-train vanilla-nerf
```
## Method
## Method overview
### Overview
If you have arrived to this site, it is likely that you have at least heard of NeRFs. This page will discuss the original NeRF paper, _"NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis"_ by Mildenhall, Srinivasan, Tancik et al. (2020).
If you have arrived to this site, it is likely that you have at least heard of NeRFs. This page will discuss the original NeRF paper, _"NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis"_ by Mildenhall, Srinivasan, Tancik et al. (2020). For most tasks, using the original NeRF model is likely not a good choice and hence we provide implementations of various other NeRF related models. It is however useful to understand how NeRF's work as most follow ups follow a similar structure.
For most tasks, using the original NeRF model is likely not a good choice and hence we provide implementations of various other NeRF related models. It is however useful to understand how NeRF's work as most follow ups follow a similar structure.
The goal is to optimize a volumetric representation of a scene that can be rendered from novel viewpoints. This representation is optimized from a set of images and associated camera poses.
@@ -44,7 +44,7 @@ If any of the following assumptions are broken, the reconstructions may fail com
Here is an overview pipeline for NeRF, we will walk through each component in this guide.
### Field Representation
### Field representation
```{image} imgs/models_nerf-pipeline-field-light.png
:align: center
@@ -56,7 +56,7 @@ Here is an overview pipeline for NeRF, we will walk through each component in th
:class: only-dark
```
NeRFs are a volumetric representation encoded into a neural network. They are not 3D meshes and they are not voxels. For each point in space the NeRF represents a view dependent radiance. More concretely each point has a density which describes how transparent or opaque a point in space is. They also have a view dependent color that changes depending on the angle the point is viewed.
NeRFs are a volumetric representation encoded into a neural network. They are not 3D meshes and they are not voxels. **For each point in space the NeRF represents a view dependent radiance.** More concretely each point has a density which describes how transparent or opaque a point in space is. They also have a view dependent color that changes depending on the angle the point is viewed.
```{image} imgs/models_nerf-field-light.png
:align: center
@@ -79,7 +79,7 @@ field_coarse = NeRFField(position_encoding=pos_enc, direction_encoding=dir_enc)
field_fine = NeRFField(position_encoding=pos_enc, direction_encoding=dir_enc)
```
#### Positional Encoding
#### Positional encoding
An extra trick is necessary to make the neural network expressive enough to represent fine details in the scene. The input coordinates $(x,y,z,\theta,\phi)$ need to be encoded to a higher dimensional space prior to being input into the network. You can learn more about encodings [here](../model_components/visualize_encoders.ipynb).
@@ -106,7 +106,9 @@ dir_enc = NeRFEncoding(
:class: only-dark
```
Now that we have a representation of space, we need some way to render new images of it. To accomplish this, we are going to _project_ a ray from the target pixel and evaluate points along that ray. We then rely on classic volumetric rendering techniques [[Kajiya, 1984]](https://dl.acm.org/doi/abs/10.1145/964965.808594) to composite the points into a predicted color. This compositing is similar to what happens in tools like Photoshop when you layer multiple objects of varying opacity on top of each other. The only difference is that NeRF takes into account the differences in spacing between points.
Now that we have a representation of space, we need some way to render new images of it. To accomplish this, we are going to _project_ a ray from the target pixel and evaluate points along that ray. We then rely on classic volumetric rendering techniques [[Kajiya, 1984]](https://dl.acm.org/doi/abs/10.1145/964965.808594) to composite the points into a predicted color.
This compositing is similar to what happens in tools like Photoshop when you layer multiple objects of varying opacity on top of each other. The only difference is that NeRF takes into account the differences in spacing between points.
Rending RGB images is not the only type of output render supported. It is possible to render other output types such as depth and semantics. Additional renderers can be found [Here](../../reference/api/model_components/renderers.rst).
@@ -137,7 +139,11 @@ rgb = renderer_rgb(
:class: only-dark
```
How we sample points along rays in space is an important design decision. Various sampling strategies can be used which are discussed in detail in the [Ray Samplers](../model_components/visualize_samplers.ipynb) guide. In NeRF we take advantage of a hierarchical sampling scheme that first uses a _uniform sampler_ and is followed by a _PDF sampler_. The uniform sampler distributes samples evenly between a predefined distance range from the camera. These are then used to compute an initial render of the scene. The renderer optionally produces _weights_ for each sample that correlate with how important each sample was to the final renderer. The PDF sampler uses these _weights_ to generate a new set of samples that are biased to regions of higher weight. In practice, these regions are near the surface of the object.
How we sample points along rays in space is an important design decision. Various sampling strategies can be used which are discussed in detail in the [Ray Samplers](../model_components/visualize_samplers.ipynb) guide. In NeRF we take advantage of a hierarchical sampling scheme that first uses a _uniform sampler_ and is followed by a _PDF sampler_.
The uniform sampler distributes samples evenly between a predefined distance range from the camera. These are then used to compute an initial render of the scene. The renderer optionally produces _weights_ for each sample that correlate with how important each sample was to the final renderer.
The PDF sampler uses these _weights_ to generate a new set of samples that are biased to regions of higher weight. In practice, these regions are near the surface of the object.
Associated code:
@@ -163,7 +169,7 @@ For all sampling, we use _Stratified_ samples during optimization and unmodified
## Benchmarks
##### Blender Synthetic
##### Blender synthetic
| Implementation | Mic | Ficus | Chair | Hotdog | Materials | Drums | Ship | Lego | Average |
| --------------------------------------------------------------------------------- | :-------: | --------- | :-------: | --------- | --------- | --------- | --------- | --------- | --------- |
+1 -1
View File
@@ -12,7 +12,7 @@ ns-train nerfacto --help
### Overview
```{admonition} Note
```{admonition} Coming Soon
This guide is coming soon. This is our flagship method that we encourage creators to use when making videos. It uses techniques from [Mip-NeRF 360](https://jonbarron.info/mipnerf360/) and [Instant-NGP](https://nvlabs.github.io/instant-ngp/).
```
+1 -1
View File
@@ -16,7 +16,7 @@ Paper Website
Paper Website
```
```{admonition} Notice
```{admonition} Coming Soon
The transient embeddings are still under development. Please stay tuned.
```
+5 -5
View File
@@ -1,12 +1,12 @@
# Model Components
# Model components
It can be difficult getting started with NeRFs. The reserach field is still quite new and most of the key nuggets are burried in academic papers. For this reason, we have consoladated many of the key concepts into a series of guides.
```{toctree}
:maxdepth: 1
Cameras Models<visualize_cameras.ipynb>
Sample Representation<visualize_samples.ipynb>
Ray Samplers<visualize_samplers.ipynb>
Spatial Distortions<visualize_spatial_distortions.ipynb>
Cameras models<visualize_cameras.ipynb>
Sample representation<visualize_samples.ipynb>
Ray samplers<visualize_samplers.ipynb>
Spatial distortions<visualize_spatial_distortions.ipynb>
Encoders<visualize_encoders.ipynb>
```
@@ -8,9 +8,13 @@
"\n",
"## Overview\n",
"\n",
"Once we have a set of cameras, we want to cast camera rays associated with each pixel. Along these ray we will sample the _field_ and aggregate the samples to predict the pixels value (ie. color). The parameterization of the samples are described [here](./visualize_samples.ipynb) however we must decide where to place these samples along a ray. For this task we will use a [`Sampler`](../../reference/api/model_components/ray_sampler.rst).\n",
"Once we have a set of cameras, we want to cast camera rays associated with each pixel. \n",
"\n",
"In the ideal world we would compute many dense samples along a ray. Unfortunatly each additional sample adds a computation cost to the system as it needs to be processed by the _field_ which is often a neural network. As a result it is common for NeRF methods to use on the order of 100 samples. Therefore we want to optimize where those samples are placed in the scene.\n",
"Along these ray we will sample the _field_ and aggregate the samples to predict the pixels value (ie. color). The parameterization of the samples are described [here](./visualize_samples.ipynb) however we must decide where to place these samples along a ray. For this task we will use a [`Sampler`](../../reference/api/model_components/ray_sampler.rst).\n",
"\n",
"In the ideal world we would compute many dense samples along a ray. Unfortunatly each additional sample adds a computation cost to the system as it needs to be processed by the _field_ which is often a neural network. \n",
"\n",
"As a result it is common for NeRF methods to use on the order of 100 samples. Therefore we want to optimize where those samples are placed in the scene.\n",
"\n",
"For example, if the sene can be bounded by a box and the objects are all similar scales, uniform sampling along the ray may be a good option. On the other hand if the scene is unbounded (potential extending as far as the the eye can see) uniform sampling does not make sense as the samples would be very sparse for close objects. In this case a different sampling like _Uniform in Disparity_ may perform better.\n",
"\n",
@@ -26,7 +30,11 @@
"\n",
"### Stratified Sampling\n",
"\n",
"Most samplers has the option to _stratify_ the samplers. When stratified, each sample is randomly perturbed. The magnitude of the pertubation is such that the sample ordering remains consistent and the overal distribution statistics are not changed. Using stratified samples during training generally improves the reconstructions as it help prevent overfitting. During inference stratified sampling should be disabled (nerfstudio samplers will do this) as it can cause noisy artifacts when the camera moves.\n",
"Most samplers has the option to _stratify_ the samplers. When stratified, each sample is randomly perturbed. \n",
"\n",
"The magnitude of the pertubation is such that the sample ordering remains consistent and the overal distribution statistics are not changed. Using stratified samples during training generally improves the reconstructions as it help prevent overfitting. \n",
"\n",
"During inference stratified sampling should be disabled (nerfstudio samplers will do this) as it can cause noisy artifacts when the camera moves.\n",
"\n",
"```{image} imgs/samplers_stratified-light.png\n",
":align: center\n",
@@ -40,7 +48,11 @@
"\n",
"### Heirarchical Sampling\n",
"\n",
"It is important to sample the scene where it has content otherwise the reconstruction quality will be reduced. One trick that is often employed in NeRF methods is to do multiple round of sampling. The first round can use a predefined sampler (ie. Uniform) to generate an image. Once the space is sampled, we have an idea which samples contributed to the final color. We can use this information to sample more around those regions using a `PDFSampler`. The PDF sampler is described more below."
"It is important to sample the scene where it has content otherwise the reconstruction quality will be reduced. \n",
"\n",
"One trick that is often employed in NeRF methods is to do multiple round of sampling. The first round can use a predefined sampler (ie. Uniform) to generate an image. Once the space is sampled, we have an idea which samples contributed to the final color. \n",
"\n",
"We can use this information to sample more around those regions using a `PDFSampler`. The PDF sampler is described more below."
]
},
{
@@ -5285,7 +5297,9 @@
"source": [
"## PDF Sampler\n",
"\n",
"The Probability Distribution Function (PDF) Sampler generates samples that match a given distribution. In the example below we first create a `UniformSampler` to generate a set of initial samples. We then assign weights to each of these samples to define the PDF (here it is an arbitrary funtion, but usually you would use the predicted weights from the field). The left plot the target PDF, on the right we plot a histogram of samples generated from the `PDFSampler`."
"The Probability Distribution Function (PDF) Sampler generates samples that match a given distribution. \n",
"\n",
"In the example below we first create a `UniformSampler` to generate a set of initial samples. We then assign weights to each of these samples to define the PDF (here it is an arbitrary funtion, but usually you would use the predicted weights from the field). The left plot the target PDF, on the right we plot a histogram of samples generated from the `PDFSampler`."
]
},
{
+2 -2
View File
@@ -9,7 +9,7 @@ To assist running on custom data we have a script that will process a video or f
To process your data run:
```bash
ns-process-data --data FOLDER_OR_VIDEO --output-dir PROCESSED_DATA_DIR
ns-process-data --data {FOLDER_OR_VIDEO} --output-dir {PROCESSED_DATA_DIR}
```
A full set of arguments can be found {doc}`here</reference/cli/ns_process_data>`.
@@ -25,7 +25,7 @@ A full set of arguments can be found {doc}`here</reference/cli/ns_process_data>`
Simply specify that you are using the `nerfstudio` dataparser and point the data directory to your processed data.
```bash
ns-train instant-ngp nerfstudio-data --data PROCESSED_DATA_DIR
ns-train instant-ngp nerfstudio-data --data {PROCESSED_DATA_DIR}
```
### Installing COLMAP
-21
View File
@@ -1,21 +0,0 @@
# Setting up viewer
## Training on a local machine
You should be able to click the link obtained while running a script to open the viewer in your browser.
![visualize_dataset](imgs/viewer_link.png)
## Training on a remote machine
If you are training on a remote maching, the viewer will still let you view your trainings. You will need to forward the port that the viewer is running on. For example, if you are running the viewer on port 7007, you will need to forward that port to your local machine. You can (without needing to modify router port settings) simply do this by opening a new terminal window and sshing into the remote machine with the following command:
```bash
ssh -L 7007:localhost:7007 <username>@<remote-machine-ip>
```
So long as you don't close this terminal window with this specific active ssh connection, the port will remain open for all your other ssh sessions. For example, if you do this in a new terminal window, any existing ssh sessions (terminal windows, VSCode remote connection, etc) will still be able to access the port, but if you close this terminal window, the port will be closed.
You can now simply open the link (the one printed when you begin your train script) in your browser on your local machine and it should connect!
![visualize_dataset](imgs/viewer_link.png)
If the port is being used, you can simply switch the port using the `--viewer.websocket-port` flag tied to the model subcommand.
+84
View File
@@ -0,0 +1,84 @@
Using the viewer
================
The nerfstudio web-based viewer makes it easy to view training in real-time, and to create content videos from your trained models 🌟!
In the tutorial below, we walk you through how you can turn a simple capture into a 3D video 📸 🎬
.. raw:: html
<iframe width="560" height="315" src="https://www.youtube.com/embed/nSFsugarWzk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
For specific sections, click the links below to navigate to the associated portion of the video.
Getting started
"""""""""""""""
* `Hello from nerfstudio <https://youtu.be/nSFsugarWzk?t=0>`_
* `Preprocess your video <https://youtu.be/nSFsugarWzk?t=13>`_
* `Launching training and viewer <https://youtu.be/nSFsugarWzk?t=27>`_
Viewer basics
"""""""""""""""
* `Viewer scene introduction <https://youtu.be/nSFsugarWzk?t=63>`_
* `Moving around in viewer <https://youtu.be/nSFsugarWzk?t=80>`_
* `Overview of Controls Panel - train speed/output options <https://youtu.be/nSFsugarWzk?t=98>`_
* `Overview of Scene Panel - toggle visibility <https://youtu.be/nSFsugarWzk?t=115>`_
Creating camera trajectories
""""""""""""""""""""""""""""
* `Creating a custom camera path <https://youtu.be/nSFsugarWzk?t=136>`_
* `Camera spline options - cycle, speed, smoothness <https://youtu.be/nSFsugarWzk?t=158>`_
* `Camera options - move, add, view <https://youtu.be/nSFsugarWzk?t=177>`_
Rendering a video
"""""""""""""""""
* `Preview camera trajectory <https://youtu.be/nSFsugarWzk?t=206>`_
* `How to render final video <https://youtu.be/nSFsugarWzk?t=227>`_
|
.. seealso::
For a more in-depth developer overview on how to hack with the viewer, see our `developer guide </docs/_build/html/developer_guides/viewer/index.html>`_
Local vs. remote compute
""""""""""""""""""""""""""
Training on a local machine
---------------------------
You should be able to click the link obtained while running a script to open the viewer in your browser.
.. image:: imgs/viewer_link.png
:width: 800
:alt: Visualize dataset
Training on a remote machine
----------------------------
If you are training on a remote maching, the viewer will still let you view your trainings.
You will need to forward the port that the viewer is running on.
For example, if you are running the viewer on port 7007, you will need to forward that port to your local machine.
You can (without needing to modify router port settings) simply do this by opening a new terminal window and sshing into the remote machine with the following command:
```bash
ssh -L 7007:localhost:7007 <username>@<remote-machine-ip>
```
.. admonition:: Note
So long as you don't close this terminal window with this specific active ssh connection, the port will remain open for all your other ssh sessions.
For example, if you do this in a new terminal window, any existing ssh sessions (terminal windows, VSCode remote connection, etc) will still be able to access the port, but if you close this terminal window, the port will be closed.
You can now simply open the link (same ones shown in image above) in your browser on your local machine and it should connect!
.. warning::
If the port is being used, you will need to switch the port using the `--viewer.websocket-port` flag tied to the model subcommand.
@@ -1,6 +1,6 @@
.. _graph_modules:
Model Components
Model components
===================
.. toctree::