mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-30 04:50:16 +08:00
misc cleanup (#432)
* misc cuda improvements. added cone angle as param * wandb as default. better organization for experiments * turn off tensorboard * disable eval when using viewer * remove comment * launch.json
This commit is contained in:
1 parent
ef8c4fbe23
commit
8973039e65
21 files changed
+230
-111
No files matched your search
+21
-23
@@ -23,6 +23,7 @@ from typing import Any, Dict, List, Literal, Optional, Tuple, Type
|
||||
|
||||
import dcargs
|
||||
import torch
|
||||
from rich import console
|
||||
|
||||
from nerfactory.configs.utils import to_immutable_dict
|
||||
|
||||
@@ -39,13 +40,13 @@ from nerfactory.datamanagers.dataparsers.record3d_parser import Record3D
|
||||
# model instances
|
||||
from nerfactory.models.base import Model
|
||||
from nerfactory.models.compound import CompoundModel
|
||||
from nerfactory.models.instant_ngp import NGPModel
|
||||
from nerfactory.models.nerfw import NerfWModel
|
||||
from nerfactory.models.tensorf import TensoRFModel
|
||||
from nerfactory.optimizers.schedulers import ExponentialDecaySchedule
|
||||
from nerfactory.pipelines.base import Pipeline
|
||||
from nerfactory.utils import writer
|
||||
|
||||
CONSOLE = console.Console()
|
||||
|
||||
# Pretty printing class
|
||||
class PrintableConfig: # pylint: disable=too-few-public-methods
|
||||
@@ -116,7 +117,7 @@ class WandbWriterConfig(InstantiateConfig):
|
||||
"""target class to instantiate"""
|
||||
enable: bool = False
|
||||
"""if True enables wandb logging, else disables"""
|
||||
relative_log_dir: Path = Path("./")
|
||||
relative_log_dir: Path = Path("./wandb")
|
||||
"""relative path to save all wandb events"""
|
||||
log_dir: dcargs.conf.Fixed[Path] = dcargs.MISSING
|
||||
"""auto-populated absolute path to saved wandb events"""
|
||||
@@ -164,8 +165,8 @@ class LoggingConfig(PrintableConfig):
|
||||
"""maximum history size to keep for computing running averages of stats.
|
||||
e.g. if 20, averages will be computed over past 20 occurances."""
|
||||
writer: Tuple[Any, ...] = (
|
||||
TensorboardWriterConfig(enable=True),
|
||||
WandbWriterConfig(enable=False),
|
||||
TensorboardWriterConfig(enable=False),
|
||||
WandbWriterConfig(enable=True),
|
||||
LocalWriterConfig(enable=True),
|
||||
)
|
||||
"""list of all supported writers. Can turn on/off writers by specifying enable."""
|
||||
@@ -215,7 +216,7 @@ class NerfactoryDataParserConfig(DataParserConfig):
|
||||
|
||||
_target: Type = Nerfactory
|
||||
"""target class to instantiate"""
|
||||
data_directory: Path = Path("data/ours/posterv2")
|
||||
data_directory: Path = Path("data/ours/posters_v3")
|
||||
"""directory specifying location of data"""
|
||||
scale_factor: float = 1.0
|
||||
"""How much to scale the camera origins by."""
|
||||
@@ -369,7 +370,7 @@ class ModelConfig(InstantiateConfig):
|
||||
"""target class to instantiate"""
|
||||
enable_collider: bool = True
|
||||
"""Whether to create a scene collider to filter rays."""
|
||||
collider_params: Dict[str, float] = to_immutable_dict({"near_plane": 2.0, "far_plane": 6.0})
|
||||
collider_params: Optional[Dict[str, float]] = to_immutable_dict({"near_plane": 2.0, "far_plane": 6.0})
|
||||
"""parameters to instantiate scene collider with"""
|
||||
loss_coefficients: Dict[str, float] = to_immutable_dict({"rgb_loss_coarse": 1.0, "rgb_loss_fine": 1.0})
|
||||
"""Loss specific weights."""
|
||||
@@ -377,8 +378,6 @@ class ModelConfig(InstantiateConfig):
|
||||
"""Number of samples in coarse field evaluation. Defaults to 64"""
|
||||
num_importance_samples: int = 128
|
||||
"""Number of samples in fine field evaluation. Defaults to 128"""
|
||||
field_implementation: Literal["torch", "tcnn"] = "torch"
|
||||
"""one of "torch" or "tcnn", or other fields in 'field_implementation_to_class"""
|
||||
enable_density_field: bool = False
|
||||
"""Whether to create a density field to filter samples."""
|
||||
density_field_params: Dict[str, Any] = to_immutable_dict(
|
||||
@@ -394,21 +393,8 @@ class ModelConfig(InstantiateConfig):
|
||||
|
||||
|
||||
@dataclass
|
||||
class InstantNGPModelConfig(ModelConfig):
|
||||
"""Instant NGP Model Config"""
|
||||
|
||||
_target: Type = NGPModel
|
||||
"""target class to instantiate"""
|
||||
enable_collider: bool = False
|
||||
"""Whether to create a scene collider to filter rays."""
|
||||
loss_coefficients: Dict[str, float] = to_immutable_dict({"rgb_loss": 1.0})
|
||||
"""Loss specific weights."""
|
||||
field_implementation: Literal["torch", "tcnn"] = "tcnn" # torch, tcnn, ...
|
||||
"""one of "torch" or "tcnn", or other fields in 'field_implementation_to_class'"""
|
||||
enable_density_field: bool = True
|
||||
"""Whether to create a density field to filter samples."""
|
||||
num_samples: int = 1024 # instead of course/fine samples
|
||||
"""Number of samples in field evaluation. Defaults to 1024,"""
|
||||
class VanillaModelConfig(InstantiateConfig):
|
||||
"""Vanilla Model Config"""
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -560,6 +546,18 @@ class Config(PrintableConfig):
|
||||
"""Make paths more specific using the current timestamp."""
|
||||
self.set_timestamp()
|
||||
|
||||
# if the viewer is enabled, disable tensorboard and wandb logging
|
||||
# TODO(ethan): this is gross for now and will require a config refactor
|
||||
if self.viewer.enable:
|
||||
string = "Disabling tensorboard and wandb logging since viewer is enabled."
|
||||
CONSOLE.print(f"[bold red]{string}")
|
||||
self.logging.writer[0].enable = False
|
||||
self.logging.writer[1].enable = False
|
||||
# also disable eval steps
|
||||
string = "Disabling eval iterations since viewer is enabled."
|
||||
CONSOLE.print(f"[bold red]{string}")
|
||||
self.trainer.steps_per_test = self.trainer.max_num_iterations
|
||||
|
||||
def set_timestamp(self, timestamp: Optional[str] = None) -> None:
|
||||
"""Make paths in our config more specific using a timestamp.
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ from nerfactory.configs.base import (
|
||||
CompoundModelConfig,
|
||||
Config,
|
||||
FriendsDataManagerConfig,
|
||||
InstantNGPModelConfig,
|
||||
MipNerf360DataParserConfig,
|
||||
ModelConfig,
|
||||
NerfWModelConfig,
|
||||
@@ -38,6 +37,7 @@ from nerfactory.configs.base import (
|
||||
TrainerConfig,
|
||||
VanillaDataManagerConfig,
|
||||
)
|
||||
from nerfactory.models.instant_ngp import InstantNGPModelConfig
|
||||
from nerfactory.models.mipnerf import MipNerfModel
|
||||
from nerfactory.models.mipnerf_360 import MipNerf360Model
|
||||
from nerfactory.models.semantic_nerf import SemanticNerfModel
|
||||
@@ -46,7 +46,7 @@ from nerfactory.models.vanilla_nerf import NeRFModel
|
||||
base_configs: Dict[str, Config] = {}
|
||||
base_configs["instant_ngp"] = Config(
|
||||
method_name="instant_ngp",
|
||||
trainer=TrainerConfig(mixed_precision=True),
|
||||
trainer=TrainerConfig(steps_per_test=500, steps_per_save=2000, mixed_precision=True),
|
||||
pipeline=PipelineConfig(
|
||||
datamanager=VanillaDataManagerConfig(
|
||||
train_dataparser=BlenderDataParserConfig(),
|
||||
|
||||
Reference in new issue
Block a user