mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-28 20:10:05 +08:00
Created skeleton structure for documentation (#30)
* added contribution docs * set up skeleton for readthedocs * setup skeleton structure for documentation * added tooling docs * fixed broken link
This commit is contained in:
1 parent
cc4d3431b8
commit
3949739449
17 files changed
+457
-292
No files matched your search
@@ -0,0 +1,48 @@
|
||||
# Benchmarking workflow
|
||||
|
||||
We make it easy to benchmark your new NeRF against the standard Blender dataset.
|
||||
|
||||
#### Launching training on Blender
|
||||
|
||||
To start, you will need to train your NeRF on each of the blender objects.
|
||||
To launch training jobs automatically on each of these items, you can call:
|
||||
|
||||
```
|
||||
./scripts/benchmarking/launch_train_blender.sh <config-name> <list_of_gpus>
|
||||
```
|
||||
|
||||
Simply replace the arguments in brackets with the correct arguments.
|
||||
* `<config-name>`: name of the config you created for your new graph. For instance, if you have created the config `configs/graph_vanilla_nerf.yaml`, `<config-name>` will be `graph_vanilla_nerf`.
|
||||
* `<list_of_gpus>`: specify the list of gpus you want to use on your machine space separated. for instance, if you want to use GPU's 0-3, you will need to pass in `0 1 2 3`. If left empty, the script will automatically find available GPU's and distribute training jobs on the available GPUs.
|
||||
|
||||
A full example would be:
|
||||
|
||||
```
|
||||
./scripts/benchmarking/launch_train_blender.sh graph_vanilla_nerf 0 1 2 3
|
||||
```
|
||||
|
||||
The script will automatically launch training on all of the items and save the checkpoints in an output directory with the current date.
|
||||
You will use the date as the reference when you run inference for benchmarking.
|
||||
|
||||
#### Benchmarking on Blender
|
||||
Once you have launched training, and training converges, you can test your method with `scripts/benchmarking/run_benchmark.py`.
|
||||
|
||||
Modify the `BENCH` variable to specify which jobs you want benchmarked.
|
||||
|
||||
```
|
||||
BENCH = {
|
||||
"method": "graph_vanilla_nerf", # change this to whatever you want
|
||||
"hydra_base_dir": "outputs/", # change this to wherever hydra's default output directory is
|
||||
"benchmark_date": "05-26-2022", # change this to the date you ran the benchmarking
|
||||
"object_list": ["mic", "ficus", "chair", "hotdog", "materials", "drums", "ship", "lego"],
|
||||
}
|
||||
```
|
||||
|
||||
Then you can simply run
|
||||
|
||||
```
|
||||
python scripts/benchmarking/run_benchmark.py
|
||||
|
||||
```
|
||||
|
||||
The script will search for the most recent checkpoint according to the benchmark configuration specified via `BENCH`. It will run inference and calculate the PSNR according to the respective object. The output is then saved in the `hydra_base_dir` directory as `<benchmark_date>.json` (full path: `<hydra_base_dir>/<benchmark_date>.json`).
|
||||
@@ -0,0 +1 @@
|
||||
# Hydra config structure
|
||||
@@ -0,0 +1,12 @@
|
||||
.. _tooling:
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
||||
hydra.md
|
||||
logging.md
|
||||
profiling.md
|
||||
benchmarking.md
|
||||
other_codebase.md
|
||||
speedup.md
|
||||
jupyter.md
|
||||
@@ -0,0 +1,10 @@
|
||||
# Setting up Jupyter
|
||||
|
||||
We provide a few visualization tools with Jupyter that can be found in `notebooks/`.
|
||||
|
||||
To install and run any of the notebooks, simply run the following commands:
|
||||
|
||||
```
|
||||
python -m jupyter lab build
|
||||
bash environments/run_jupyter.sh
|
||||
```
|
||||
@@ -0,0 +1,30 @@
|
||||
# Logging Features
|
||||
|
||||
We provide integration with multiple logging interfaces to log images and statistics during training.
|
||||
All of these loggers are configurable via the config:
|
||||
|
||||
```
|
||||
# e.g. configs/graphs_default.yaml
|
||||
|
||||
logging:
|
||||
steps_per_log: 10 # how often to log losses/images
|
||||
max_buffer_size: 20 # defines how many steps to average over (if reporting averages)
|
||||
writer: # definition of all writers you want to use
|
||||
TensorboardWriter:
|
||||
save_dir: "./" # must specify the output path for all writers
|
||||
LocalWriter:
|
||||
save_dir: "./"
|
||||
stats_to_track:
|
||||
[ITER_LOAD_TIME, ITER_TRAIN_TIME, RAYS_PER_SEC, CURR_TEST_PSNR]
|
||||
max_log_size: 10
|
||||
```
|
||||
|
||||
Currently, we provide support for the following loggers:
|
||||
|
||||
1. [Tensorboard](https://www.tensorflow.org/tensorboard): `TensorBoardWriter`
|
||||
2. [Weights and Biases](https://wandb.ai/site): `WandbWriter`
|
||||
3. Local writer: `LocalWriter`
|
||||
|
||||
The `LocalWriter` simply outputs to the terminal. However, you can specify additional parameters to customize the logging.
|
||||
* stats_to_track: all the stats that you want to print to the terminal (see list under `EventName` in `utils/writer.py`). You can add or remove any of the defined enums.
|
||||
* max_log_size: how much content to print onto the screen (e.g. only print 10 lines on the screen at a time). If 0, will print everything without deleting any previous lines.
|
||||
@@ -0,0 +1,16 @@
|
||||
# Run other repos with our data
|
||||
|
||||
If you are looking to test out other existing repo's with our data, the pyRad structure makes it easy!
|
||||
|
||||
For instance, you can run nerf-pytorch and jaxnerf with the following commands:
|
||||
|
||||
```
|
||||
# nerf-pytorch
|
||||
cd external
|
||||
python run_nerf.py --config configs/chair.txt --datadir /path/to/pyrad/data/blender/chair
|
||||
|
||||
# jaxnerf
|
||||
cd external
|
||||
conda activate jaxnerf
|
||||
python -m jaxnerf.train --data_dir=/path/to/pyrad/data/blender/chair --train_dir=/path/to/pyrad/outputs/blender_chair_jaxnerf --config=/path/to/pyrad/external/jaxnerf/configs/demo --render_every 100
|
||||
```
|
||||
@@ -0,0 +1,63 @@
|
||||
# Profiling and debugging
|
||||
|
||||
## Profilers
|
||||
We provide built-in performance profiling capabilities to make it easier for you to debug and assess the performance of your code.
|
||||
|
||||
#### In-house profiler
|
||||
You can use our built-in profiler by enabling the profiler in the config:
|
||||
|
||||
```
|
||||
# e.g. configs/graphs_default.yaml
|
||||
|
||||
logging:
|
||||
enable_profiler: True
|
||||
```
|
||||
|
||||
The profiler computes the average total time of execution for any function with the `@profiler.time_function` decorator.
|
||||
For instance, if you wanted to profile the total time it takes to generate rays given pixel and camera indices via the `RayGenerator` class, you would want to evaluate its `forward()` function. In that class, you would need to add the decorator to the function.
|
||||
|
||||
|
||||
```
|
||||
class RayGenerator(nn.Module):
|
||||
|
||||
...
|
||||
|
||||
@profiler.time_function # add the profiler decorator before the function
|
||||
def forward(self, ray_indices: TensorType["num_rays", 3]) -> RayBundle:
|
||||
# implementation here
|
||||
...
|
||||
```
|
||||
|
||||
At termination of training or end of the training run, the profiler will print out the average execution time for all of the functions that have the profiler tag.
|
||||
|
||||
Use this profiler if there are specific functions that you want to measure the times for.
|
||||
|
||||
|
||||
#### Profiling with PySpy
|
||||
If you want to profile the entire codebase, we provide functionality to generate flame graphs or get real-time reports using [PySpy](https://github.com/benfred/py-spy).
|
||||
|
||||
Install PySpy
|
||||
|
||||
```
|
||||
pip install py-spy
|
||||
```
|
||||
|
||||
To perform the profiling, you can either specify that you want to generate a flame graph or generate a live-view of the profiler.
|
||||
|
||||
```
|
||||
## for flame graph
|
||||
|
||||
./scripts/debugging/profile.sh -t flame -o flame.svg -p <python_command>
|
||||
|
||||
## for live view of functions
|
||||
|
||||
./scripts/debugging/profile.sh -t top -p <python_command>
|
||||
```
|
||||
|
||||
In both cases, `<python_command>` can be replaced with any command you would normally run in the terminal. For instance, you can replace `<python_function>` with `scripts/run_train.py data/dataset=blender_lego`. Then the full command would be e.g.:
|
||||
|
||||
```
|
||||
./scripts/debugging/profile.sh -t flame -o flame.svg -p scripts/run_train.py data/dataset=blender_lego
|
||||
```
|
||||
|
||||
## Debugging
|
||||
@@ -0,0 +1,14 @@
|
||||
# Speeding up code with TinyCuda
|
||||
|
||||
Documentation for running the code with CUDA.
|
||||
Please see https://github.com/NVlabs/tiny-cuda-nn for how to install tiny-cuda-nn.
|
||||
|
||||
```
|
||||
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
|
||||
```
|
||||
|
||||
To run instant-ngp with tcnn, you can do the following. This is with the fox dataset.
|
||||
|
||||
```
|
||||
python scripts/run_train.py --config-name=instant_ngp_tcnn.yaml data/dataset=instant_ngp_fox
|
||||
```
|
||||
Reference in new issue
Block a user