mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-18 22:04:02 +08:00
Add generic type interface
This commit is contained in:
1 parent
4545dcb6b3
commit
1e036372cf
28 files changed
+86
-116
No files matched your search
@@ -31,14 +31,8 @@ class NerfactoModelConfig(ModelConfig):
|
||||
_target: Type = field(default_factory=lambda: NerfactoModel)
|
||||
...
|
||||
|
||||
class NerfactoModel(Model):
|
||||
"""Nerfacto model
|
||||
|
||||
Args:
|
||||
config: Nerfacto configuration to instantiate model
|
||||
"""
|
||||
|
||||
config: NerfactoModelConfig
|
||||
class NerfactoModel(Model[NerfactoModelConfig]):
|
||||
"""Nerfacto model"""
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
@@ -73,11 +73,9 @@ class NerfstudioDataParserConfig(DataParserConfig):
|
||||
"""The fraction of images to use for training. The remaining images are for eval."""
|
||||
|
||||
@dataclass
|
||||
class Nerfstudio(DataParser):
|
||||
class Nerfstudio(DataParser[NerfstudioDataParserConfig]):
|
||||
"""Nerfstudio DatasetParser"""
|
||||
|
||||
config: NerfstudioDataParserConfig
|
||||
|
||||
def _generate_dataparser_outputs(self, split="train"):
|
||||
meta = load_from_json(self.config.data / "transforms.json")
|
||||
image_filenames = []
|
||||
|
||||
@@ -111,14 +111,8 @@ There are a lot of options! Thankfully, our config system makes this easy to han
|
||||
Furthermore, you have Python autocomplete and static checking working in your favor. At the top of every Model, we specify the config and then can easily pull of values throughout the implementation. Let's take a look at the beginning of the NerfactoModel implementation.
|
||||
|
||||
```python
|
||||
class NerfactoModel(Model):
|
||||
"""Nerfacto model
|
||||
|
||||
Args:
|
||||
config: Nerfacto configuration to instantiate model
|
||||
"""
|
||||
|
||||
config: NerfactoModelConfig
|
||||
class NerfactoModel(Model[NerfactoModelConfig]):
|
||||
"""Nerfacto model"""
|
||||
|
||||
def populate_modules(self):
|
||||
"""Set the fields and modules."""
|
||||
|
||||
Reference in new issue
Block a user