mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-28 03:50:11 +08:00
Restructure into field modules
This commit is contained in:
1 parent
28a66dac72
commit
5e24cbf6fe
13 files changed
+21
-23
No files matched your search
@@ -1,4 +1,4 @@
|
||||
"""init modules"""
|
||||
"""init field modules"""
|
||||
from .encoding import Encoding, ScalingAndOffset
|
||||
from .mlp import MLP
|
||||
from .module import Module
|
||||
from .base import FieldModule
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
The module baseclass.
|
||||
The field module baseclass.
|
||||
"""
|
||||
from abc import abstractmethod
|
||||
|
||||
@@ -7,12 +7,8 @@ from torch import nn
|
||||
from torchtyping import TensorType
|
||||
|
||||
|
||||
class Module(nn.Module):
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
nn (_type_): _description_
|
||||
"""
|
||||
class FieldModule(nn.Module):
|
||||
"""Field modules that can be combined to store and compute the fields."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Default initialization of module"""
|
||||
@@ -3,10 +3,10 @@ Encoding functions
|
||||
"""
|
||||
import torch
|
||||
from torchtyping import TensorType
|
||||
from mattport.nerf.modules.module import Module
|
||||
from mattport.nerf.field_modules.base import FieldModule
|
||||
|
||||
|
||||
class Encoding(Module):
|
||||
class Encoding(FieldModule):
|
||||
"""Encode an input tensor. Intended to be subclassed"""
|
||||
|
||||
def __init__(self, in_dim: int) -> None:
|
||||
Whitespace-only changes.
@@ -5,10 +5,10 @@ from typing import Optional
|
||||
|
||||
from torch import nn
|
||||
from torchtyping import TensorType
|
||||
from mattport.nerf.modules.module import Module
|
||||
from mattport.nerf.field_modules.base import FieldModule
|
||||
|
||||
|
||||
class MLP(Module):
|
||||
class MLP(FieldModule):
|
||||
"""Multilayer perceptron"""
|
||||
|
||||
def __init__(
|
||||
File renamed without changes.
@@ -6,10 +6,10 @@ from typing import Optional
|
||||
from torch import nn
|
||||
from torchtyping import TensorType
|
||||
|
||||
from mattport.nerf.modules.module import Module
|
||||
from mattport.nerf.field_modules.base import FieldModule
|
||||
|
||||
|
||||
class RenderHead(Module):
|
||||
class RenderHead(FieldModule):
|
||||
"""Base Render head"""
|
||||
|
||||
def __init__(self, in_dim: int, out_dim: int, activation: Optional[nn.Module] = None) -> None:
|
||||
@@ -43,7 +43,7 @@ class Graph(nn.Module):
|
||||
self.modules = {}
|
||||
# initialize graph with known input dimensions; set default in_dim to 0
|
||||
for module_name, module_dict in modules_config.items():
|
||||
module = getattr(importlib.import_module("mattport.nerf.modules"), module_dict.class_name)
|
||||
module = getattr(importlib.import_module("mattport.nerf.field_modules"), module_dict.class_name)
|
||||
if not module_dict.meta_data.in_dim:
|
||||
module_dict.meta_data.in_dim = 0
|
||||
self.modules[module_name] = module(**module_dict.meta_data)
|
||||
|
||||
@@ -7,7 +7,7 @@ import torch
|
||||
from torch import nn
|
||||
from torchtyping import TensorType
|
||||
|
||||
from mattport.nerf.modules import render_heads as rh
|
||||
from mattport.nerf.field_modules import render_heads as rh
|
||||
|
||||
|
||||
class Renderer(nn.Module):
|
||||
|
||||
Reference in new issue
Block a user