mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-05 15:28:49 +08:00
Update docstrings
This commit is contained in:
1 parent
cc79708df7
commit
37a3692b45
11 files changed
+197
-130
No files matched your search
+23
-6
@@ -50,14 +50,24 @@ class AbstractGraph(nn.Module):
|
||||
|
||||
|
||||
class Graph(AbstractGraph):
|
||||
"""_summary_"""
|
||||
"""Where everything (Fields, Optimizers, Samplers, Visualization, etc) is linked together. This should be
|
||||
subclassed for custom NeRF model.
|
||||
|
||||
Args:
|
||||
intrinsics (torch.Tensor): Camera intrinsics.
|
||||
camera_to_world (torch.Tensor): Camera to world transformation.
|
||||
loss_coefficients (DictConfig): Loss specific weights.
|
||||
steps_per_occupancy_grid_update (int): How often to update occupancy grid.
|
||||
scene_bounds (SceneBounds): Bounds of target scene.
|
||||
collider_config (DictConfig): Configuration of scene collider.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
intrinsics=None,
|
||||
camera_to_world=None,
|
||||
intrinsics: torch.Tensor = None,
|
||||
camera_to_world: torch.Tensor = None,
|
||||
loss_coefficients: DictConfig = None,
|
||||
steps_per_occupancy_grid_update=16,
|
||||
steps_per_occupancy_grid_update: int = 16,
|
||||
scene_bounds: SceneBounds = None,
|
||||
collider_config: DictConfig = None,
|
||||
**kwargs,
|
||||
@@ -94,8 +104,15 @@ class Graph(AbstractGraph):
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def get_outputs(self, ray_bundle: RayBundle):
|
||||
"""Takes in a Ray Bundle and returns a dictionary of outputs."""
|
||||
def get_outputs(self, ray_bundle: RayBundle) -> dict:
|
||||
"""Takes in a Ray Bundle and returns a dictionary of outputs.
|
||||
|
||||
Args:
|
||||
ray_bundle (RayBundle): Input bundle of rays.
|
||||
|
||||
Returns:
|
||||
dict: Outputs of graph. (ie. rendered colors)
|
||||
"""
|
||||
|
||||
def forward_after_ray_generator(self, ray_bundle: RayBundle, batch: Union[str, Dict[str, torch.tensor]] = None):
|
||||
"""Run forward starting with a ray bundle."""
|
||||
|
||||
@@ -23,20 +23,19 @@ from pyrad.cameras.cameras import get_camera_model
|
||||
|
||||
class RayGenerator(nn.Module):
|
||||
"""torch.nn Module for generating rays.
|
||||
This class will store the intrinsics and extrinsics parameters of the cameras."""
|
||||
This class will store the intrinsics and extrinsics parameters of the cameras.
|
||||
|
||||
Args:
|
||||
intrinsics (TensorType["num_cameras", "num_intrinsics_params"]):
|
||||
The intrinsics parameters.
|
||||
camera_to_world (TensorType["num_cameras", 3, 4]): Camera to world transformation matrix.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
intrinsics: TensorType["num_cameras", "num_intrinsics_params"],
|
||||
camera_to_world: TensorType["num_cameras", 3, 4],
|
||||
) -> None:
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
intrinsics (TensorType["num_cameras", "num_intrinsics_params"]):
|
||||
The intrinsics parameters.
|
||||
camera_to_world (TensorType["num_cameras", 3, 4]): Camera to world transformation matrix.
|
||||
"""
|
||||
super().__init__()
|
||||
self.num_cameras, self.num_intrinsics_params = intrinsics.shape
|
||||
assert self.num_cameras >= 0
|
||||
@@ -54,7 +53,7 @@ class RayGenerator(nn.Module):
|
||||
"""Index into the cameras to generate the rays.
|
||||
|
||||
Args:
|
||||
x (_type_): _description_
|
||||
ray_indices (TensorType["num_rays", 3]): Contains camera, row, and col indicies for target rays.
|
||||
"""
|
||||
c = ray_indices[:, 0] # camera indices
|
||||
y = ray_indices[:, 1] # row indices
|
||||
|
||||
@@ -37,16 +37,25 @@ from pyrad.utils import visualization, writer
|
||||
|
||||
|
||||
class NeRFGraph(Graph):
|
||||
"""Vanilla NeRF graph"""
|
||||
"""Vanilla NeRF graph
|
||||
|
||||
Args:
|
||||
intrinsics (torch.Tensor): Camera intrinsics.
|
||||
camera_to_world (torch.Tensor): Camera to world transformation.
|
||||
near_plane (float, optional): Where to start sampling points. Defaults to a distance of 2,
|
||||
far_plane (float, optional): Where to stop sampling points. Defaults to a distance of 6,
|
||||
num_coarse_samples (int, optional): Number of samples in coarse field evaluation. Defaults to 64,
|
||||
num_importance_samples(int, optional): Number of samples in fine field evaluation. Defaults to 64,
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
intrinsics=None,
|
||||
camera_to_world=None,
|
||||
near_plane=2.0,
|
||||
far_plane=6.0,
|
||||
num_coarse_samples=64,
|
||||
num_importance_samples=128,
|
||||
intrinsics: torch.Tensor = None,
|
||||
camera_to_world: torch.Tensor = None,
|
||||
near_plane: float = 2.0,
|
||||
far_plane: float = 6.0,
|
||||
num_coarse_samples: int = 64,
|
||||
num_importance_samples: int = 128,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
self.near_plane = near_plane
|
||||
|
||||
Reference in new issue
Block a user