mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-18 05:44:31 +08:00
1 parent
edf9f59940
commit
fe5f46c0aa
9 files changed
+115
-118
No files matched your search
@@ -14,7 +14,6 @@
|
||||
|
||||
"""Base Configs"""
|
||||
|
||||
import enum
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@@ -320,33 +319,6 @@ class SchedulerConfig(InstantiateConfig):
|
||||
return self._target(optimizer, lr_init, self.lr_final, self.max_steps)
|
||||
|
||||
|
||||
class MethodType(enum.Enum):
|
||||
"""Enum for the method type."""
|
||||
|
||||
PSNR = enum.auto()
|
||||
TRAJ = enum.auto()
|
||||
|
||||
|
||||
class TrajectoryType(enum.Enum):
|
||||
"""Enum for the trajectory type."""
|
||||
|
||||
SPIRAL = enum.auto()
|
||||
INTERP = enum.auto()
|
||||
|
||||
|
||||
@dataclass
|
||||
class EvalConfig(PrintableConfig):
|
||||
"""Boiler plate config for running eval"""
|
||||
|
||||
checkpoint_dir: Optional[Path] = None
|
||||
rendered_output_name: Optional[str] = None
|
||||
method: MethodType = MethodType.PSNR
|
||||
traj: TrajectoryType = TrajectoryType.SPIRAL
|
||||
output_filename: Path = Path("output.json")
|
||||
rendered_resolution_scaling_factor: float = 1.0
|
||||
load_config: Optional[Path] = None # optionally load config file from training
|
||||
|
||||
|
||||
@dataclass
|
||||
class Config(PrintableConfig):
|
||||
"""Full config contents"""
|
||||
@@ -367,7 +339,6 @@ class Config(PrintableConfig):
|
||||
}
|
||||
)
|
||||
viewer: ViewerConfig = ViewerConfig()
|
||||
eval: Optional[EvalConfig] = None
|
||||
|
||||
def __post_init__(self):
|
||||
"""Convert logging directories to more specific filepaths"""
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
Put all the method implementations in one location.
|
||||
"""
|
||||
|
||||
from typing import Dict
|
||||
|
||||
from nerfactory.configs.base import (
|
||||
BlenderDataloaderConfig,
|
||||
Config,
|
||||
@@ -33,7 +35,7 @@ from nerfactory.models.mipnerf_360 import MipNerf360Model
|
||||
from nerfactory.models.semantic_nerf import SemanticNerfModel
|
||||
from nerfactory.models.vanilla_nerf import NeRFModel
|
||||
|
||||
base_configs = {}
|
||||
base_configs: Dict[str, Config] = {}
|
||||
base_configs["instant_ngp"] = Config(
|
||||
method_name="instant_ngp",
|
||||
trainer=TrainerConfig(mixed_precision=True),
|
||||
|
||||
@@ -24,20 +24,14 @@ from typing import Any, Dict, TypeVar
|
||||
|
||||
import dcargs
|
||||
|
||||
from nerfactory.configs import base as cfg
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
def cli_from_base_configs(base_library: Dict[str, T], eval_mode=False) -> T:
|
||||
def cli_from_base_configs(base_library: Dict[str, T]) -> T:
|
||||
"""Populate an instance of `cls`, where the first positional argument is used to
|
||||
select from a library of named base configs. See
|
||||
https://brentyi.github.io/dcargs/examples/06_base_configs/ for more details."""
|
||||
|
||||
if eval_mode:
|
||||
for _, v in base_library.items():
|
||||
v.eval = cfg.EvalConfig()
|
||||
|
||||
# Get base configuration name from the first positional argument.
|
||||
if len(sys.argv) < 2 or sys.argv[1] not in base_library:
|
||||
valid_usages = map(lambda k: f"{sys.argv[0]} {k} --help", base_library.keys())
|
||||
@@ -52,8 +46,7 @@ def cli_from_base_configs(base_library: Dict[str, T], eval_mode=False) -> T:
|
||||
args=sys.argv[2:],
|
||||
default_instance=default_instance,
|
||||
# `avoid_subparsers` will avoid making a subparser for unions when a default is
|
||||
# provided; in this case, it simplifies our CLI but makes it less expressive
|
||||
# (cannot switch away from the base optimizer types).
|
||||
# provided; in this case, it simplifies our CLI but makes it less expressive.
|
||||
avoid_subparsers=True,
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user