Skip to content

Commit

Permalink
Config restructure (nerfstudio-project#283)
Browse files Browse the repository at this point in the history
* starting docs for pipelines

* working on an example

* clearing output

* starting to implement config changes and add documentation

* wip: removed cicular imports; porting basic config into python; todo: get python setups workin

* circular imports again

* wip: pausing at dataloader sort of working

* break for today

* running vanilla

* wip need to get all the config docs working

* laptop about to die

* instant ngp working

* added all configs for all methods; not tested yet: [mipnerf360, nerfw, semantic_nerf]

* unpacking later

* done with pylinting

* mostly done. just need to do docs and one test

* added import order to docs

* fixing near/far plane and other config things

* making loggers also instantiable via configs

* docs

* lint

* making --help work with dcargs

* moving configs back into flat

* convert list to tuples; fixed post init function with mutable params

* lint

* made run_eval and benchmarking scripts compatible with new config/dcargs

* lint

* added option to load configs from presaved config

Co-authored-by: evonneng <[email protected]>
  • Loading branch information
ethanweber and evonneng authored Aug 27, 2022
1 parent e0856e3 commit 7e9a56f
Show file tree
Hide file tree
Showing 46 changed files with 987 additions and 916 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/core_code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: black docs/ nerfactory/ scripts/ tests/ --check
- name: Python Pylint
run: |
pylint nerfactory tests scripts
pylint --disable=cyclic-import nerfactory tests scripts
- name: Test with pytest
run: |
pytest
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"program": "scripts/run_train.py",
"console": "integratedTerminal",
"args": [
"--config-name=graph_instant_ngp.yaml"
"instant_ngp"
]
},
{
Expand All @@ -53,7 +53,7 @@
"program": "scripts/run_train.py",
"console": "integratedTerminal",
"args": [
"--config-name=graph_mipnerf_360.yaml"
"mipnerf_360"
]
},
{
Expand All @@ -63,7 +63,7 @@
"program": "scripts/run_train.py",
"console": "integratedTerminal",
"args": [
"--config-name=graph_nerfw.yaml"
"nerfw"
// "++data.use_preprocessing_cache=true"
]
},
Expand All @@ -74,7 +74,7 @@
"program": "scripts/run_train.py",
"console": "integratedTerminal",
"args": [
"--config-name=graph_semantic_nerf.yaml",
"semantic_nerf",
"++data.use_preprocessing_cache=true"
]
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ logging:
#### 5. Rendering a trajectories during inference

```
python scripts/run_eval.py --method=traj --traj=spiral --output-filename=output.mp4 --config-name=graph_instant_ngp.yaml trainer.resume_train.load_dir=outputs/blender_lego/instant_ngp/2022-07-07_230905/checkpoints
python scripts/run_eval.py --method=traj --traj=spiral --output-filename=output.mp4 --config-name=graph_instant_ngp.yaml --checkpoint-dir=outputs/blender_lego/instant_ngp/2022-07-07_230905/checkpoints
```

#### 6. In-depth guide
Expand Down
Empty file removed configs/README.md
Empty file.
97 changes: 0 additions & 97 deletions configs/graph_default.yaml

This file was deleted.

52 changes: 0 additions & 52 deletions configs/graph_instant_ngp.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions configs/graph_mipnerf.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions configs/graph_mipnerf_360.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions configs/graph_nerfw.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions configs/graph_semantic_nerf.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions configs/graph_vanilla_nerf.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import sys

sys.path.insert(0, os.path.abspath(".."))
import nerfactory.configs.base
import nerfactory.dataloaders.base

# -- Project information -----------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ bash environment/run_tensorboard.sh
To evaluate the trained NeRF, we provide an evaluation script that allows you to do benchmarking (see our [benchmarking workflow](../tooling/benchmarking.md)) or to render out the scene with a custom trajectory and save the output to a video.

```bash
python scripts/run_eval.py --method=traj --traj=spiral --output-filename=output.mp4 --config-name=graph_instant_ngp.yaml trainer.resume_train.load_dir=outputs/blender_lego/instant_ngp/2022-07-07_230905/checkpoints
python scripts/run_eval.py --method=traj --traj=spiral --output-filename=output.mp4 --config-name=graph_instant_ngp.yaml --checkpoint-dir=outputs/blender_lego/instant_ngp/2022-07-07_230905/checkpoints
```

Please note, this quickstart allows you to preform everything in a headless manner. We also provide a web-based visualizer that allows you to easily monitor training or render out trajectories. See our [viewer docs](../tutorials/viewer/viewer_quickstart.md) for more.
Expand Down
2 changes: 1 addition & 1 deletion environment/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ aiohttp
aiortc
av
black[jupyter]==22.3.0
dcargs
dcargs>=0.2.5
ninja
functorch==0.1.1
h5py>=2.9.0
Expand Down
17 changes: 9 additions & 8 deletions nerfactory/cameras/rays.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,22 @@ class RayBundle(TensorDataclass):
Args:
origins: Ray origins (XYZ)
directions: Unit ray direction vector
pixel_area: Projected area of pixel a distance 1 away from origin.
pixel_area: Projected area of pixel a distance 1 away from origin
camera_indices: Camera indices
nears: Distance along ray to start sampling
fars: Rays Distance along ray to stop sampling
valid_mask: Rays that are valid
num_rays_per_chunk: Number of rays per chunk
"""

origins: TensorType["num_rays", 3]
directions: TensorType["num_rays", 3]
pixel_area: TensorType["num_rays", 1]
camera_indices: Optional[TensorType["num_rays", 1]] = None
nears: Optional[TensorType["num_rays", 1]] = None
fars: Optional[TensorType["num_rays", 1]] = None
valid_mask: Optional[TensorType["num_rays", 1, bool]] = None
# TODO(ethan): make sure the sizes with ... are correct
origins: TensorType[..., 3]
directions: TensorType[..., 3]
pixel_area: TensorType[..., 1]
camera_indices: Optional[TensorType[..., 1]] = None
nears: Optional[TensorType[..., 1]] = None
fars: Optional[TensorType[..., 1]] = None
valid_mask: Optional[TensorType[..., 1, bool]] = None
num_rays_per_chunk: int = 128

def set_camera_indices(self, camera_index: int) -> None:
Expand Down
13 changes: 13 additions & 0 deletions nerfactory/configs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2022 The Plenoptix Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading

0 comments on commit 7e9a56f

Please sign in to comment.