mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 07:48:50 +08:00
Shorten dataparser subcommand (#420)
* Shorten dataparser subcommand * Rename
This commit is contained in:
1 parent
3a0807ec8c
commit
61022f7dbe
2 files changed
+18
-9
No files matched your search
@@ -19,7 +19,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Type, Union
|
from typing import Any, Dict, List, Literal, Optional, Tuple, Type
|
||||||
|
|
||||||
import dcargs
|
import dcargs
|
||||||
import torch
|
import torch
|
||||||
@@ -308,6 +308,21 @@ class Record3DDataParserConfig(DataParserConfig):
|
|||||||
more, images will be sampled approximately evenly. Defaults to 150."""
|
more, images will be sampled approximately evenly. Defaults to 150."""
|
||||||
|
|
||||||
|
|
||||||
|
AnnotatedDataParserUnion = dcargs.extras.subcommand_type_from_defaults(
|
||||||
|
{
|
||||||
|
"nerfactory-data": NerfactoryDataParserConfig(),
|
||||||
|
"blender-data": BlenderDataParserConfig(),
|
||||||
|
"friends-data": FriendsDataParserConfig(),
|
||||||
|
"mipnerf-360-data": MipNerf360DataParserConfig(),
|
||||||
|
"instant-ngp-data": InstantNGPDataParserConfig(),
|
||||||
|
"record3d-data": Record3DDataParserConfig(),
|
||||||
|
},
|
||||||
|
prefix_names=False,
|
||||||
|
)
|
||||||
|
"""Union over possible dataparser types, annotated with metadata for dcargs. This is the
|
||||||
|
same as the vanilla union, but results in shorter subcommand names."""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class VanillaDataManagerConfig(InstantiateConfig):
|
class VanillaDataManagerConfig(InstantiateConfig):
|
||||||
"""Configuration for data manager instantiation; DataManager is in charge of keeping the train/eval dataparsers;
|
"""Configuration for data manager instantiation; DataManager is in charge of keeping the train/eval dataparsers;
|
||||||
@@ -321,14 +336,7 @@ class VanillaDataManagerConfig(InstantiateConfig):
|
|||||||
|
|
||||||
_target: Type = VanillaDataManager
|
_target: Type = VanillaDataManager
|
||||||
"""target class to instantiate"""
|
"""target class to instantiate"""
|
||||||
train_dataparser: Union[
|
train_dataparser: AnnotatedDataParserUnion = BlenderDataParserConfig()
|
||||||
NerfactoryDataParserConfig,
|
|
||||||
BlenderDataParserConfig,
|
|
||||||
FriendsDataParserConfig,
|
|
||||||
MipNerf360DataParserConfig,
|
|
||||||
InstantNGPDataParserConfig,
|
|
||||||
Record3DDataParserConfig,
|
|
||||||
] = BlenderDataParserConfig()
|
|
||||||
"""specifies the dataparser used to unpack the data"""
|
"""specifies the dataparser used to unpack the data"""
|
||||||
train_num_rays_per_batch: int = 1024
|
train_num_rays_per_batch: int = 1024
|
||||||
"""number of rays per batch to use per training iteration"""
|
"""number of rays per batch to use per training iteration"""
|
||||||
|
|||||||
@@ -215,4 +215,5 @@ if __name__ == "__main__":
|
|||||||
# Create a subcommand for each base config.
|
# Create a subcommand for each base config.
|
||||||
SubcommandType = dcargs.extras.subcommand_type_from_defaults(base_configs)
|
SubcommandType = dcargs.extras.subcommand_type_from_defaults(base_configs)
|
||||||
instantiated_config = dcargs.cli(SubcommandType)
|
instantiated_config = dcargs.cli(SubcommandType)
|
||||||
|
|
||||||
main(config=instantiated_config)
|
main(config=instantiated_config)
|
||||||
Reference in new issue
Block a user