mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-05 23:38:42 +08:00
dataloader logic, new folder structure, flatter configs (#26)
* renaming dataloader to data. adding some dataloader classes * restructuring configs * fixed instant ngp tcnn direction rescaling * working through test cases * black and lint and tests
This commit is contained in:
1 parent
24c1c77ef1
commit
457788d689
105 files changed
+8828
-682
No files matched your search
@@ -2,8 +2,8 @@
|
||||
Callback functions for training iterations
|
||||
"""
|
||||
|
||||
from pyrad.nerf.graph.base import Graph
|
||||
from pyrad.nerf.occupancy_grid import OccupancyGrid
|
||||
from pyrad.graphs.base import Graph
|
||||
from pyrad.fields.occupancy_fields.occupancy_grid import OccupancyGrid
|
||||
|
||||
|
||||
def update_occupancy(graph: Graph):
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
"""Common Colors"""
|
||||
from typing import Union
|
||||
from omegaconf import ListConfig
|
||||
import torch
|
||||
from torchtyping import TensorType
|
||||
|
||||
WHITE = torch.tensor([1.0, 1.0, 1.0])
|
||||
BLACK = torch.tensor([0.0, 0.0, 0.0])
|
||||
RED = torch.tensor([1.0, 0.0, 0.0])
|
||||
GREEN = torch.tensor([0.0, 1.0, 0.0])
|
||||
BLUE = torch.tensor([0.0, 0.0, 1.0])
|
||||
|
||||
COLORS_DICT = {
|
||||
"white": WHITE,
|
||||
"black": BLACK,
|
||||
"red": RED,
|
||||
"green": GREEN,
|
||||
"blue": BLUE,
|
||||
}
|
||||
|
||||
|
||||
def get_color(color: Union[str, list, ListConfig]) -> TensorType[3]:
|
||||
"""
|
||||
Args:
|
||||
color (Union[str, list, ListConfig]): Color as a string or a rgb list
|
||||
|
||||
Returns:
|
||||
TensorType[3]: Parsed color
|
||||
"""
|
||||
if isinstance(color, str):
|
||||
color = color.lower()
|
||||
if color not in COLORS_DICT:
|
||||
raise ValueError(f"{color} is not a valid preset color")
|
||||
return COLORS_DICT[color]
|
||||
if isinstance(color, (list, ListConfig)):
|
||||
if len(color) != 3:
|
||||
raise ValueError(f"Color should be 3 values (RGB) instead got {color}")
|
||||
return torch.tensor(color)
|
||||
|
||||
raise ValueError(f"Color should be an RGB list or string, instead got {type(color)}")
|
||||
+1
-1
@@ -8,7 +8,7 @@ def components_from_spherical_harmonics(levels: int, directions: TensorType[...,
|
||||
"""
|
||||
Args:
|
||||
levels (int): Number of spherical harmonic levels to compute.
|
||||
coeffs (TensorType[..., "coeffs"]): Spherical hamonic coefficients
|
||||
directions (TensorType[..., 3]): Spherical hamonic coefficients
|
||||
|
||||
Returns:
|
||||
TensorType[..., "components"]: Value for each component.
|
||||
|
||||
@@ -5,6 +5,7 @@ Generic Writer class
|
||||
|
||||
import enum
|
||||
import os
|
||||
import sys
|
||||
from abc import abstractmethod
|
||||
from typing import Dict
|
||||
|
||||
@@ -16,7 +17,6 @@ from omegaconf import DictConfig, ListConfig
|
||||
from torch.utils.tensorboard import SummaryWriter
|
||||
from torchtyping import TensorType
|
||||
|
||||
import pyrad.utils.writer
|
||||
from pyrad.utils.decorators import check_main_thread, decorate_all
|
||||
|
||||
to8b = lambda x: (255 * torch.clamp(x, min=0, max=1)).to(torch.uint8)
|
||||
@@ -136,7 +136,7 @@ def setup_event_writers(config: DictConfig) -> None:
|
||||
"""Initialization of all event writers specified in config"""
|
||||
logging_configs = config.logging.writer
|
||||
for writer_type in logging_configs:
|
||||
writer_class = getattr(pyrad.utils.writer, writer_type)
|
||||
writer_class = getattr(sys.modules[__name__], writer_type)
|
||||
writer_config = logging_configs[writer_type]
|
||||
if writer_type == "LocalWriter":
|
||||
curr_writer = writer_class(writer_config.save_dir, writer_config.stats_to_track, writer_config.max_log_size)
|
||||
|
||||
Reference in new issue
Block a user