mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 15:59:16 +08:00
Rename field heads
This commit is contained in:
1 parent
5e24cbf6fe
commit
8e852c5771
3 files changed
+19
-19
No files matched your search
+6
-6
@@ -9,8 +9,8 @@ from torchtyping import TensorType
|
||||
from mattport.nerf.field_modules.base import FieldModule
|
||||
|
||||
|
||||
class RenderHead(FieldModule):
|
||||
"""Base Render head"""
|
||||
class FieldOutput(FieldModule):
|
||||
"""Base field output"""
|
||||
|
||||
def __init__(self, in_dim: int, out_dim: int, activation: Optional[nn.Module] = None) -> None:
|
||||
"""
|
||||
@@ -47,15 +47,15 @@ class RenderHead(FieldModule):
|
||||
return self.net(in_tensor)
|
||||
|
||||
|
||||
class DensityHead(RenderHead):
|
||||
"""Density head"""
|
||||
class DensityFieldOutput(FieldOutput):
|
||||
"""Density output"""
|
||||
|
||||
def __init__(self, in_dim: int, activation: Optional[nn.Module] = nn.Softplus()) -> None:
|
||||
super().__init__(in_dim, 1, activation)
|
||||
|
||||
|
||||
class RGBHead(RenderHead):
|
||||
"""RGB head"""
|
||||
class RGBFieldOutput(FieldOutput):
|
||||
"""RGB output"""
|
||||
|
||||
def __init__(self, in_dim: int, activation: Optional[nn.Module] = nn.Sigmoid()) -> None:
|
||||
super().__init__(in_dim, 3, activation)
|
||||
@@ -7,13 +7,13 @@ import torch
|
||||
from torch import nn
|
||||
from torchtyping import TensorType
|
||||
|
||||
from mattport.nerf.field_modules import render_heads as rh
|
||||
from mattport.nerf.field_modules import field_outputs
|
||||
|
||||
|
||||
class Renderer(nn.Module):
|
||||
"""Base Renderer. Intended to be subclassed"""
|
||||
|
||||
def required_render_heads(self) -> Set[rh.RenderHead]:
|
||||
def required_render_heads(self) -> Set[field_outputs.FieldOutput]:
|
||||
"""
|
||||
Returns:
|
||||
Set[RenderHead]: RenderHeads required for this renderer.
|
||||
@@ -45,8 +45,8 @@ class RGB(Renderer):
|
||||
self.rgb_name = rgb_name
|
||||
self.density_name = density_name
|
||||
|
||||
def required_render_heads(self) -> Set[rh.RenderHead]:
|
||||
return set(rh.RGBHead, rh.DensityHead)
|
||||
def required_render_heads(self) -> Set[field_outputs.FieldOutput]:
|
||||
return set(field_outputs.RGBFieldOutput, field_outputs.DensityFieldOutput)
|
||||
|
||||
def forward(
|
||||
self,
|
||||
@@ -83,8 +83,8 @@ class Depth(Renderer):
|
||||
Renderer (_type_): _description_
|
||||
"""
|
||||
|
||||
def required_render_heads(self) -> Set[rh.RenderHead]:
|
||||
return set(rh.DensityHead)
|
||||
def required_render_heads(self) -> Set[field_outputs.FieldOutput]:
|
||||
return set(field_outputs.DensityFieldOutput)
|
||||
|
||||
def forward(
|
||||
self,
|
||||
|
||||
Reference in new issue
Block a user