mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 07:48:50 +08:00
Move dataset parser configs to files (#476)
* Move parser configs to files * fixed circular import errors Co-authored-by: Ethan Weber <eweb0124@gmail.com>
This commit is contained in:
1 parent
c7c4ac5a4d
commit
00c3ae73b2
9 files changed
+159
-123
No files matched your search
@@ -15,8 +15,9 @@
|
||||
"""Data parser for blender dataset"""
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Type
|
||||
|
||||
import imageio
|
||||
import numpy as np
|
||||
@@ -30,13 +31,29 @@ from nerfactory.utils.colors import get_color
|
||||
from nerfactory.utils.io import get_absolute_path, load_from_json
|
||||
|
||||
|
||||
@dataclass
|
||||
class BlenderDataParserConfig(cfg.DataParserConfig):
|
||||
"""Blender dataset parser config"""
|
||||
|
||||
_target: Type = field(default_factory=lambda: Blender)
|
||||
"""target class to instantiate"""
|
||||
data_directory: Path = Path("data/blender/lego")
|
||||
"""directory specifying location of data"""
|
||||
scale_factor: float = 1.0
|
||||
"""How much to scale the camera origins by."""
|
||||
alpha_color: str = "white"
|
||||
"""alpha color of background"""
|
||||
|
||||
|
||||
@dataclass
|
||||
class Blender(DataParser):
|
||||
"""Blender Dataset
|
||||
Some of this code comes from https://github.com/yenchenlin/nerf-pytorch/blob/master/load_blender.py#L37.
|
||||
"""
|
||||
|
||||
def __init__(self, config: cfg.BlenderDataParserConfig):
|
||||
config: cfg.BlenderDataParserConfig
|
||||
|
||||
def __init__(self, config: BlenderDataParserConfig):
|
||||
super().__init__(config=config)
|
||||
self.data_directory: Path = config.data_directory
|
||||
self.scale_factor: float = config.scale_factor
|
||||
|
||||
Reference in new issue
Block a user