mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-12 02:45:34 +08:00
* starting docs for pipelines * working on an example * clearing output * starting to implement config changes and add documentation * removing diff * format * templated pipeline notebook a bit * black
11 KiB
11 KiB
In [1]:
class NeRFField(Field):
"""NeRF Field"""
def __init__(self, ...) -> None:
"""Create boilerplate NeRF field."""
super().__init__()
# In the init method, we are instantiating all relevant field modules
self.position_encoding = position_encoding
self.direction_encoding = direction_encoding
self.mlp_base = MLP(
in_dim=self.position_encoding.get_out_dim(),
num_layers=base_mlp_num_layers,
layer_width=base_mlp_layer_width,
skip_connections=skip_connections,
)
...
def get_density(self, point_samples: PointSamples):
"""
Computes and returns the densities.
"""
def get_outputs(
self, point_samples: PointSamples, density_embedding: Optional[TensorType] = None
) -> Dict[FieldHeadNames, TensorType]:
"""
Computes and returns the outputs.
"""[0;36m Input [0;32mIn [1][0;36m[0m [0;31m def __init__(self, ...) -> None:[0m [0m ^[0m [0;31mSyntaxError[0m[0;31m:[0m invalid syntax
In [2]:
class NeRFGraph(Graph):
"""Vanilla NeRF graph"""
def __init__(self, intrinsics=None, camera_to_world=None, **kwargs) -> None:
super().__init__(intrinsics=intrinsics, camera_to_world=camera_to_world, **kwargs)
def populate_fields(self):
"""
Set all field related modules here
"""
def populate_misc_modules(self):
"""
Set all remaining modules here including: samplers, renderers, losses, and metrics
"""
def get_param_groups(self) -> Dict[str, List[Parameter]]:
"""
Create a dictionary of parameters that are grouped according to different optimizers
"""
def get_outputs(self, ray_bundle: RayBundle):
"""
Takes in a Ray Bundle and returns a dictionary of outputs.
"""
def get_loss_dict(self, outputs, batch):
"""
Computes and returns the losses.
"""
def log_test_image_outputs(self, image_idx, step, batch, outputs):
"""
Writes the test image outputs.
"""[0;31m---------------------------------------------------------------------------[0m [0;31mNameError[0m Traceback (most recent call last) [1;32m/shared/ethanweber/nerfactory/docs/tutorials/pipelines/creating_models.ipynb Cell 4[0m in [0;36m<cell line: 1>[0;34m()[0m [0;32m----> <a href='vscode-notebook-cell://ssh-remote%2Bbirman/shared/ethanweber/nerfactory/docs/tutorials/pipelines/creating_models.ipynb#W6sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>[0m [39mclass[39;00m [39mNeRFGraph[39;00m(Graph): [1;32m <a href='vscode-notebook-cell://ssh-remote%2Bbirman/shared/ethanweber/nerfactory/docs/tutorials/pipelines/creating_models.ipynb#W6sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a>[0m [39m"""Vanilla NeRF graph"""[39;00m [1;32m <a href='vscode-notebook-cell://ssh-remote%2Bbirman/shared/ethanweber/nerfactory/docs/tutorials/pipelines/creating_models.ipynb#W6sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a>[0m [39mdef[39;00m [39m__init__[39m([39mself[39m, intrinsics[39m=[39m[39mNone[39;00m, camera_to_world[39m=[39m[39mNone[39;00m, [39m*[39m[39m*[39mkwargs) [39m-[39m[39m>[39m [39mNone[39;00m: [0;31mNameError[0m: name 'Graph' is not defined