Config restructure (#283)

* starting docs for pipelines

* working on an example

* clearing output

* starting to implement config changes and add documentation

* wip: removed cicular imports; porting basic config into python; todo: get python setups workin

* circular imports again

* wip: pausing at dataloader sort of working

* break for today

* running vanilla

* wip need to get all the config docs working

* laptop about to die

* instant ngp working

* added all configs for all methods; not tested yet: [mipnerf360, nerfw, semantic_nerf]

* unpacking later

* done with pylinting

* mostly done. just need to do docs and one test

* added import order to docs

* fixing near/far plane and other config things

* making loggers also instantiable via configs

* docs

* lint

* making --help work with dcargs

* moving configs back into flat

* convert list to tuples; fixed post init function with mutable params

* lint

* made run_eval and benchmarking scripts compatible with new config/dcargs

* lint

* added option to load configs from presaved config

Co-authored-by: evonneng <evonne_ng@berkeley.edu>
This commit is contained in:
Ethan Weberandevonneng authored and GitHub committed 2022-08-26 17:25:10 -07:00
1 parent e0856e3afc
commit 7e9a56fac4
46 files changed
+987 -916

No files matched your search

+9 -5
View File
@@ -16,6 +16,8 @@
Implementation of Instant NGP.
"""
from __future__ import annotations
from typing import Dict, List
import torch
@@ -26,6 +28,7 @@ from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
import nerfactory.cuda as nerfactory_cuda
from nerfactory.cameras.rays import RayBundle
from nerfactory.configs import base as cfg
from nerfactory.fields.instant_ngp_field import field_implementation_to_class
from nerfactory.fields.modules.field_heads import FieldHeadNames
from nerfactory.models.base import Model
@@ -43,11 +46,10 @@ class NGPModel(Model):
kwargs: additional params to pass up to the parent class model
"""
def __init__(self, field_implementation="torch", **kwargs) -> None:
assert field_implementation in field_implementation_to_class
self.field_implementation = field_implementation
def __init__(self, config: cfg.InstantNGPModelConfig, **kwargs) -> None:
assert config.field_implementation in field_implementation_to_class
self.field = None
super().__init__(**kwargs)
super().__init__(config=config, **kwargs)
def get_training_callbacks(self) -> List[Callback]:
assert self.density_field is not None
@@ -62,7 +64,7 @@ class NGPModel(Model):
def populate_fields(self):
"""Set the fields."""
# torch or tiny-cuda-nn version
self.field = field_implementation_to_class[self.field_implementation](self.scene_bounds.aabb)
self.field = field_implementation_to_class[self.config.field_implementation](self.scene_bounds.aabb)
def populate_misc_modules(self):
# samplers
@@ -76,6 +78,8 @@ class NGPModel(Model):
self.ssim = structural_similarity_index_measure
self.lpips = LearnedPerceptualImagePatchSimilarity()
# no colliders default
def get_param_groups(self) -> Dict[str, List[Parameter]]:
param_groups = {}
if self.field is None: