This commit is contained in:
terrance committed 2023-01-16 18:43:24 +00:00
commit 49bbd5405d
66 files changed
+5757 -4441

No files matched your search

@@ -42,6 +42,7 @@ from nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConf
from nerfstudio.data.dataparsers.instant_ngp_dataparser import (
InstantNGPDataParserConfig,
)
from nerfstudio.data.dataparsers.minimal_dataparser import MinimalDataParserConfig
from nerfstudio.data.dataparsers.nerfstudio_dataparser import NerfstudioDataParserConfig
from nerfstudio.data.dataparsers.nuscenes_dataparser import NuScenesDataParserConfig
from nerfstudio.data.dataparsers.phototourism_dataparser import (
@@ -65,6 +66,7 @@ AnnotatedDataParserUnion = tyro.conf.OmitSubcommandPrefixes[ # Omit prefixes of
tyro.extras.subcommand_type_from_defaults(
{
"nerfstudio-data": NerfstudioDataParserConfig(),
"minimal-parser": MinimalDataParserConfig(),
"blender-data": BlenderDataParserConfig(),
"friends-data": FriendsDataParserConfig(),
"instant-ngp-data": InstantNGPDataParserConfig(),
@@ -296,6 +298,8 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
train_dataset: InputDataset
eval_dataset: InputDataset
train_dataparser_outputs: DataparserOutputs
train_pixel_sampler: Optional[PixelSampler] = None
eval_pixel_sampler: Optional[PixelSampler] = None
def __init__(
self,
@@ -406,6 +410,7 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
"""Returns the next batch of data from the train dataloader."""
self.train_count += 1
image_batch = next(self.iter_train_image_dataloader)
assert self.train_pixel_sampler is not None
batch = self.train_pixel_sampler.sample(image_batch)
ray_indices = batch["indices"]
ray_bundle = self.train_ray_generator(ray_indices)
@@ -415,6 +420,7 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
"""Returns the next batch of data from the eval dataloader."""
self.eval_count += 1
image_batch = next(self.iter_eval_image_dataloader)
assert self.eval_pixel_sampler is not None
batch = self.eval_pixel_sampler.sample(image_batch)
ray_indices = batch["indices"]
ray_bundle = self.eval_ray_generator(ray_indices)
@@ -0,0 +1,48 @@
# Copyright 2022 The Nerfstudio Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Depth datamanager.
"""
from dataclasses import dataclass, field
from typing import Type
from nerfstudio.data.datamanagers import base_datamanager
from nerfstudio.data.datasets.depth_dataset import DepthDataset
@dataclass
class DepthDataManagerConfig(base_datamanager.VanillaDataManagerConfig):
"""A depth datamanager - required to use with .setup()"""
_target: Type = field(default_factory=lambda: DepthDataManager)
class DepthDataManager(base_datamanager.VanillaDataManager): # pylint: disable=abstract-method
"""Data manager implementation for data that also requires processing depth data.
Args:
config: the DataManagerConfig used to instantiate class
"""
def create_train_dataset(self) -> DepthDataset:
self.train_dataparser_outputs = self.dataparser.get_dataparser_outputs(split="train")
return DepthDataset(
dataparser_outputs=self.train_dataparser_outputs,
)
def create_eval_dataset(self) -> DepthDataset:
return DepthDataset(
dataparser_outputs=self.dataparser.get_dataparser_outputs(split=self.test_split),
)
@@ -41,6 +41,7 @@ class SemanticDataManager(VanillaDataManager): # pylint: disable=abstract-metho
"""
def create_train_dataset(self) -> SemanticDataset:
self.train_dataparser_outputs = self.dataparser.get_dataparser_outputs(split="train")
return SemanticDataset(
dataparser_outputs=self.train_dataparser_outputs,
scale_factor=self.config.camera_res_scale_factor,