mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-24 18:14:16 +08:00
Update docs (#16)
This commit is contained in:
1 parent
93ef7a729f
commit
d38e852fe4
5 files changed
+91
-41
No files matched your search
@@ -38,6 +38,8 @@ extensions = [
|
||||
"sphinx.ext.autosummary",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinxemoji.sphinxemoji",
|
||||
"myst_parser",
|
||||
"sphinx.ext.napoleon",
|
||||
]
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
@@ -53,3 +55,23 @@ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
||||
#
|
||||
html_theme = "furo"
|
||||
html_title = "pyRad"
|
||||
|
||||
|
||||
# -- Napoleon settings -------------------------------------------------------
|
||||
|
||||
# Settings for parsing non-sphinx style docstrings. We use Google style in this
|
||||
# project.
|
||||
napoleon_google_docstring = True
|
||||
napoleon_numpy_docstring = False
|
||||
napoleon_include_init_with_doc = False
|
||||
napoleon_include_private_with_doc = False
|
||||
napoleon_include_special_with_doc = True
|
||||
napoleon_use_admonition_for_examples = False
|
||||
napoleon_use_admonition_for_notes = False
|
||||
napoleon_use_admonition_for_references = False
|
||||
napoleon_use_ivar = False
|
||||
napoleon_use_param = True
|
||||
napoleon_use_rtype = True
|
||||
napoleon_preprocess_types = False
|
||||
napoleon_type_aliases = None
|
||||
napoleon_attr_annotations = True
|
||||
@@ -1,4 +1,5 @@
|
||||
furo==2022.4.7
|
||||
readthedocs-sphinx-search==0.1.2
|
||||
sphinx==4.5.0
|
||||
sphinxemoji==0.2.0
|
||||
sphinxemoji==0.2.0
|
||||
myst-parser==0.17.2
|
||||
@@ -23,7 +23,14 @@ class FieldHeadNames(Enum):
|
||||
|
||||
|
||||
class FieldHead(FieldModule):
|
||||
"""Base field output"""
|
||||
"""Base field output
|
||||
|
||||
Args:
|
||||
out_dim (int): output dimension for renderer
|
||||
field_head_name (FieldHeadNames): Field type
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -32,13 +39,7 @@ class FieldHead(FieldModule):
|
||||
in_dim: Optional[int] = None,
|
||||
activation: Optional[nn.Module] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Args:
|
||||
out_dim (int): output dimension for renderer
|
||||
field_head_name (FieldHeadNames): Field type
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
super().__init__()
|
||||
self.out_dim = out_dim
|
||||
self.activation = activation
|
||||
@@ -75,52 +76,78 @@ class FieldHead(FieldModule):
|
||||
|
||||
|
||||
class DensityFieldHead(FieldHead):
|
||||
"""Density output"""
|
||||
"""Density output
|
||||
|
||||
Args:
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
def __init__(self, in_dim: Optional[int] = None, activation: Optional[nn.Module] = nn.Softplus()) -> None:
|
||||
super().__init__(in_dim=in_dim, out_dim=1, field_head_name=FieldHeadNames.DENSITY, activation=activation)
|
||||
|
||||
|
||||
class RGBFieldHead(FieldHead):
|
||||
"""RGB output"""
|
||||
"""RGB output
|
||||
|
||||
Args:
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
def __init__(self, in_dim: Optional[int] = None, activation: Optional[nn.Module] = nn.Sigmoid()) -> None:
|
||||
super().__init__(in_dim=in_dim, out_dim=3, field_head_name=FieldHeadNames.RGB, activation=activation)
|
||||
|
||||
|
||||
class SHFieldHead(FieldHead):
|
||||
"""Spherical harmonics output"""
|
||||
"""Spherical harmonics output
|
||||
|
||||
Args:
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
levels (int, optional): Number of spherical harmonics layers. Defaults to 3.
|
||||
channels (int, optional): Number of channels. Defaults to 3 (ie RGB).
|
||||
activation (Optional[nn.Module], optional): Output activation. Defaults to None.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, in_dim: Optional[int] = None, levels: int = 3, channels: int = 3, activation: Optional[nn.Module] = None
|
||||
) -> None:
|
||||
"""
|
||||
Args:
|
||||
in_dim (int): Input dimension
|
||||
levels (int, optional): Number of spherical harmonics layers. Defaults to 3.
|
||||
channels (int, optional): Number of channels. Defaults to 3 (ie RGB).
|
||||
activation (Optional[nn.Module], optional): Output activation. Defaults to None.
|
||||
"""
|
||||
|
||||
out_dim = channels * levels**2
|
||||
super().__init__(in_dim=in_dim, out_dim=out_dim, field_head_name=FieldHeadNames.SH, activation=activation)
|
||||
|
||||
|
||||
class UncertaintyFieldHead(FieldHead):
|
||||
"""Uncertainty output"""
|
||||
"""Uncertainty output
|
||||
|
||||
Args:
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
def __init__(self, in_dim: Optional[int] = None, activation: Optional[nn.Module] = nn.Softplus()) -> None:
|
||||
super().__init__(in_dim=in_dim, out_dim=1, field_head_name=FieldHeadNames.UNCERTAINTY, activation=activation)
|
||||
|
||||
|
||||
class TransientRGBFieldHead(FieldHead):
|
||||
"""Transient RGB output"""
|
||||
"""Transient RGB output
|
||||
|
||||
Args:
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
def __init__(self, in_dim: Optional[int] = None, activation: Optional[nn.Module] = nn.Sigmoid()) -> None:
|
||||
super().__init__(in_dim=in_dim, out_dim=3, field_head_name=FieldHeadNames.TRANSIENT_RGB, activation=activation)
|
||||
|
||||
|
||||
class TransientDensityFieldHead(FieldHead):
|
||||
"""Transient density output"""
|
||||
"""Transient density output
|
||||
|
||||
Args:
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
def __init__(self, in_dim: Optional[int] = None, activation: Optional[nn.Module] = nn.Softplus()) -> None:
|
||||
super().__init__(
|
||||
@@ -129,12 +156,13 @@ class TransientDensityFieldHead(FieldHead):
|
||||
|
||||
|
||||
class SemanticFieldHead(FieldHead):
|
||||
"""Semantic stuff output"""
|
||||
"""Semantic stuff output
|
||||
|
||||
Args:
|
||||
num_classes (int): Number of semantic classes
|
||||
in_dim (int, optional): input dimension. If not defined in constructor, it must be set later.
|
||||
activation (Optional[nn.Module]): output head activation
|
||||
"""
|
||||
|
||||
def __init__(self, num_classes: int, in_dim: Optional[int] = None) -> None:
|
||||
"""
|
||||
Args:
|
||||
num_classes (int): Number of semantic classes
|
||||
in_dim (int): Input dimension
|
||||
"""
|
||||
super().__init__(in_dim=in_dim, out_dim=num_classes, field_head_name=FieldHeadNames.SEMANTICS, activation=None)
|
||||
@@ -11,7 +11,16 @@ from pyrad.nerf.field_modules.base import FieldModule
|
||||
|
||||
|
||||
class MLP(FieldModule):
|
||||
"""Multilayer perceptron"""
|
||||
"""Multilayer perceptron
|
||||
|
||||
Args:
|
||||
in_dim (int): Input layer dimension
|
||||
num_layers (int): Number of network layers
|
||||
layer_width (int): Width of each MLP layer
|
||||
out_dim (int, optional): Ouput layer dimension. Defaults to layer_width
|
||||
activation (Optional[nn.Module], optional): intermediate layer activation function. Defaults to nn.ReLU.
|
||||
out_activation (Optional[nn.Module], optional): output activation function. Defaults to None.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -23,16 +32,7 @@ class MLP(FieldModule):
|
||||
activation: Optional[nn.Module] = nn.ReLU(),
|
||||
out_activation: Optional[nn.Module] = None,
|
||||
) -> None:
|
||||
"""Initialize parameters of mulilayer perceptron.
|
||||
|
||||
Args:
|
||||
in_dim (int): Input layer dimension
|
||||
num_layers (int): Number of network layers
|
||||
layer_width (int): Width of each MLP layer
|
||||
out_dim (int, optional): Ouput layer dimension. Defaults to layer_width
|
||||
activation (Optional[nn.Module], optional): intermediate layer activation function. Defaults to nn.ReLU.
|
||||
out_activation (Optional[nn.Module], optional): output activation function. Defaults to None.
|
||||
"""
|
||||
super().__init__()
|
||||
self.in_dim = in_dim
|
||||
assert self.in_dim > 0
|
||||
@@ -69,7 +69,7 @@ class MLP(FieldModule):
|
||||
in_tensor (TensorType[..., "in_dim]): Network input
|
||||
|
||||
Returns:
|
||||
TensorType[..., "out_dim"]: Network output
|
||||
TensorType[..., "out_dim"]: MLP network output
|
||||
"""
|
||||
x = in_tensor
|
||||
for i, layer in enumerate(self.layers):
|
||||
|
||||
@@ -136,8 +136,7 @@ class PDFSampler(Sampler):
|
||||
|
||||
Args:
|
||||
ray_bundle (RayBundle): Rays to generate samples for
|
||||
TensorType[..., "output_dim"]: A encoded input tensor
|
||||
bins (TensorType[..., "num_samples"]): Ray bins
|
||||
ray_samples (RaySamples): Existing ray samples
|
||||
weights: (TensorType[..., "num_samples"]): Weights for each bin
|
||||
num_samples (Optional[int]): Number of samples per ray
|
||||
eps: float: Small value to prevent numerical issues. Defaults to 1e-5
|
||||
|
||||
Reference in new issue
Block a user