mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-22 15:45:39 +08:00
Pipeline v2 (#258)
* Model class done, pipeline class still needs more visualization stuffs * Renaming the BaseDataContainer to DataloaderOutputs and adding documentation * Pushing more documentation, removing some trivial functions * Updating dict typing * Removing config dicts for collider * Passing tests * Pushing shell new dataloader * Saving work, need to fix NGP model's get_loss_dict and Pipeline * V1 of the ngp pipeline should be done. Need train script and debugging * Updating with latest instant-ngp code * Syntax updates from latest ngp graph code * Linter, removing unneeded code in new NGP graph code * Style * Should be good now. Linter is happy and the code is verbatum current instant-ngp * Everything done except novel view testing code * Fixing some nitpicks * Debugging dataloader * merged master * WOP. integrating pipeline with configs and notebook demo * removing model folder * a lot of name changing from Graph to Model * in progress... changing trainer to use pipeline... broken right now * pipeline code runs * switched to val dataset * makes run_eval.py work * updated configs for pipeline change * fixing test_run_train script * fixing black and linting * fix docs * small updates to trainer Co-authored-by: Jake Austin <jake-austin@berkeley.edu>
This commit is contained in:
1 parent
670c2a01db
commit
0b042be956
55 files changed
+8595
-8263
No files matched your search
+24
-25
@@ -15,7 +15,7 @@
|
||||
"""Structured config classes"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from omegaconf import MISSING, DictConfig
|
||||
|
||||
@@ -62,29 +62,21 @@ class TrainerConfig:
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageDatasetConfig:
|
||||
"""Configuration for type of dataset to instantiate"""
|
||||
|
||||
_target_: str = MISSING
|
||||
|
||||
|
||||
@dataclass
|
||||
class DataConfig:
|
||||
class DataloaderConfig:
|
||||
"""Configuration for train/eval datasets"""
|
||||
|
||||
dataset_inputs_train: Dict[str, Any] = MISSING
|
||||
image_dataset_train: ImageDatasetConfig = MISSING
|
||||
dataloader_train: Dict[str, Any] = MISSING
|
||||
dataset_inputs_eval: Dict[str, Any] = MISSING
|
||||
image_dataset_eval: ImageDatasetConfig = MISSING
|
||||
dataloader_eval: Dict[str, Any] = MISSING
|
||||
# additional optional parameters here
|
||||
pixel_sampler: Optional[Dict[str, Any]] = None
|
||||
use_preprocessing_cache: bool = False
|
||||
_target_: str = MISSING
|
||||
image_dataset_type: Optional[str] = "rgb"
|
||||
train_dataset: Dict[str, Any] = MISSING
|
||||
train_num_rays_per_batch: int = MISSING
|
||||
train_num_images_to_sample_from: int = MISSING
|
||||
eval_dataset: Dict[str, Any] = MISSING
|
||||
eval_image_indices: List[int] = MISSING
|
||||
eval_num_rays_per_chunk: int = MISSING
|
||||
|
||||
|
||||
@dataclass
|
||||
class GraphConfig:
|
||||
class ModelConfig:
|
||||
"""Configuration for graph instantiation"""
|
||||
|
||||
_target_: str = MISSING
|
||||
@@ -99,6 +91,15 @@ class GraphConfig:
|
||||
density_field_config: Dict[str, Any] = MISSING
|
||||
|
||||
|
||||
@dataclass
|
||||
class PipelineConfig:
|
||||
"""Configuration for pipeline instantiation"""
|
||||
|
||||
_target_: str = MISSING
|
||||
dataloader: DataloaderConfig = MISSING
|
||||
model: ModelConfig = MISSING
|
||||
|
||||
|
||||
@dataclass
|
||||
class ViewerConfig:
|
||||
"""Configuration for viewer instantiation"""
|
||||
@@ -119,10 +120,9 @@ class Config:
|
||||
trainer: TrainerConfig = MISSING
|
||||
experiment_name: str = MISSING
|
||||
method_name: str = MISSING
|
||||
data: DataConfig = MISSING
|
||||
graph: GraphConfig = MISSING
|
||||
optimizers: Dict[str, Any] = MISSING
|
||||
viewer: ViewerConfig = MISSING
|
||||
pipeline: PipelineConfig = MISSING
|
||||
# additional optional parameters here
|
||||
hydra: Optional[Dict[str, Any]] = None
|
||||
|
||||
@@ -141,18 +141,17 @@ def setup_config(config: DictConfig) -> Config:
|
||||
trainer = TrainerConfig(**config.trainer)
|
||||
experiment_name = config.experiment_name
|
||||
method_name = config.method_name
|
||||
data = DataConfig(**config.data)
|
||||
graph = GraphConfig(**config.graph)
|
||||
pipeline = PipelineConfig(**config.pipeline)
|
||||
optimizers = config.optimizers
|
||||
viewer = ViewerConfig(**config.viewer)
|
||||
|
||||
return Config(
|
||||
machine=machine,
|
||||
logging=logging,
|
||||
trainer=trainer,
|
||||
experiment_name=experiment_name,
|
||||
method_name=method_name,
|
||||
data=data,
|
||||
graph=graph,
|
||||
pipeline=pipeline,
|
||||
optimizers=optimizers,
|
||||
viewer=viewer,
|
||||
)
|
||||
@@ -128,6 +128,9 @@ def make_dir(filename_or_folder: str) -> str:
|
||||
|
||||
Args:
|
||||
filename_or_folder (str): The filename or folder to make.
|
||||
|
||||
Returns:
|
||||
The filename_or_folder, which is the input.
|
||||
"""
|
||||
if filename_or_folder[-1] != "/" and filename_or_folder.find(".") < 0:
|
||||
folder = os.path.dirname(filename_or_folder + "/")
|
||||
|
||||
@@ -82,6 +82,9 @@ def instantiate_from_dict_config(dict_config: Any, **kwargs):
|
||||
"""
|
||||
dict_config_kwargs = {k: v for k, v in dict_config.items() if k != "_target_"}
|
||||
uninstantiated_class = locate(dict_config._target_) # pylint: disable=protected-access
|
||||
assert (
|
||||
uninstantiated_class is not None
|
||||
), f"Could not find class {dict_config._target_}" # pylint: disable=protected-access
|
||||
all_kwargs = dict_config_kwargs
|
||||
all_kwargs.update(kwargs)
|
||||
instantiated_class = uninstantiated_class(**all_kwargs) # type: ignore
|
||||
|
||||
Reference in new issue
Block a user