mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-01 21:39:06 +08:00
Merge remote-tracking branch 'origin' into generative
This commit is contained in:
commit
57736cfafc
3 files changed
+16
-20
No files matched your search
@@ -69,7 +69,7 @@ class ExperimentConfig(InstantiateConfig):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
"""Dictionary of optimizer groups and their schedulers"""
|
"""Dictionary of optimizer groups and their schedulers"""
|
||||||
vis: Literal["viewer", "wandb", "tensorboard"] = "wandb"
|
vis: Literal["viewer", "wandb", "tensorboard", "viewer+wandb", "viewer+tensorboard"] = "wandb"
|
||||||
"""Which visualizer to use."""
|
"""Which visualizer to use."""
|
||||||
data: Optional[Path] = None
|
data: Optional[Path] = None
|
||||||
"""Alias for --pipeline.datamanager.dataparser.data"""
|
"""Alias for --pipeline.datamanager.dataparser.data"""
|
||||||
@@ -78,15 +78,15 @@ class ExperimentConfig(InstantiateConfig):
|
|||||||
|
|
||||||
def is_viewer_enabled(self) -> bool:
|
def is_viewer_enabled(self) -> bool:
|
||||||
"""Checks if a viewer is enabled."""
|
"""Checks if a viewer is enabled."""
|
||||||
return "viewer" == self.vis
|
return ("viewer" == self.vis) | ("viewer+wandb" == self.vis) | ("viewer+tensorboard" == self.vis)
|
||||||
|
|
||||||
def is_wandb_enabled(self) -> bool:
|
def is_wandb_enabled(self) -> bool:
|
||||||
"""Checks if wandb is enabled."""
|
"""Checks if wandb is enabled."""
|
||||||
return "wandb" == self.vis
|
return ("wandb" == self.vis) | ("viewer+wandb" == self.vis)
|
||||||
|
|
||||||
def is_tensorboard_enabled(self) -> bool:
|
def is_tensorboard_enabled(self) -> bool:
|
||||||
"""Checks if tensorboard is enabled."""
|
"""Checks if tensorboard is enabled."""
|
||||||
return "tensorboard" == self.vis
|
return ("tensorboard" == self.vis) | ("viewer+tensorboard" == self.vis)
|
||||||
|
|
||||||
def set_timestamp(self) -> None:
|
def set_timestamp(self) -> None:
|
||||||
"""Dynamically set the experiment timestamp"""
|
"""Dynamically set the experiment timestamp"""
|
||||||
|
|||||||
@@ -49,13 +49,8 @@ from nerfstudio.data.dataparsers.nuscenes_dataparser import NuScenesDataParserCo
|
|||||||
from nerfstudio.data.dataparsers.phototourism_dataparser import (
|
from nerfstudio.data.dataparsers.phototourism_dataparser import (
|
||||||
PhototourismDataParserConfig,
|
PhototourismDataParserConfig,
|
||||||
)
|
)
|
||||||
from nerfstudio.data.dataparsers.sdfstudio_dataparser import SDFStudioDataParserConfig
|
|
||||||
from nerfstudio.data.datasets.base_dataset import InputDataset
|
from nerfstudio.data.datasets.base_dataset import InputDataset
|
||||||
from nerfstudio.data.pixel_samplers import (
|
from nerfstudio.data.pixel_samplers import EquirectangularPixelSampler, PixelSampler
|
||||||
EquirectangularPixelSampler,
|
|
||||||
PatchPixelSampler,
|
|
||||||
PixelSampler,
|
|
||||||
)
|
|
||||||
from nerfstudio.data.utils.dataloaders import (
|
from nerfstudio.data.utils.dataloaders import (
|
||||||
CacheDataloader,
|
CacheDataloader,
|
||||||
FixedIndicesEvalDataloader,
|
FixedIndicesEvalDataloader,
|
||||||
@@ -80,7 +75,6 @@ AnnotatedDataParserUnion = tyro.conf.OmitSubcommandPrefixes[ # Omit prefixes of
|
|||||||
"dnerf-data": DNeRFDataParserConfig(),
|
"dnerf-data": DNeRFDataParserConfig(),
|
||||||
"phototourism-data": PhototourismDataParserConfig(),
|
"phototourism-data": PhototourismDataParserConfig(),
|
||||||
"dycheck-data": DycheckDataParserConfig(),
|
"dycheck-data": DycheckDataParserConfig(),
|
||||||
"sdfstudio-data": SDFStudioDataParserConfig(),
|
|
||||||
},
|
},
|
||||||
prefix_names=False, # Omit prefixes in subcommands themselves.
|
prefix_names=False, # Omit prefixes in subcommands themselves.
|
||||||
)
|
)
|
||||||
@@ -287,8 +281,6 @@ class VanillaDataManagerConfig(InstantiateConfig):
|
|||||||
"""The scale factor for scaling spatial data such as images, mask, semantics
|
"""The scale factor for scaling spatial data such as images, mask, semantics
|
||||||
along with relevant information about camera intrinsics
|
along with relevant information about camera intrinsics
|
||||||
"""
|
"""
|
||||||
patch_size: int = 1
|
|
||||||
"""Size of patch to sample from. If >1, patch-based sampling will be used."""
|
|
||||||
|
|
||||||
|
|
||||||
class VanillaDataManager(DataManager): # pylint: disable=abstract-method
|
class VanillaDataManager(DataManager): # pylint: disable=abstract-method
|
||||||
@@ -352,9 +344,6 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
|
|||||||
self, dataset: InputDataset, *args: Any, **kwargs: Any
|
self, dataset: InputDataset, *args: Any, **kwargs: Any
|
||||||
) -> PixelSampler:
|
) -> PixelSampler:
|
||||||
"""Infer pixel sampler to use."""
|
"""Infer pixel sampler to use."""
|
||||||
if self.config.patch_size > 1:
|
|
||||||
return PatchPixelSampler(*args, **kwargs, patch_size=self.config.patch_size)
|
|
||||||
|
|
||||||
# If all images are equirectangular, use equirectangular pixel sampler
|
# If all images are equirectangular, use equirectangular pixel sampler
|
||||||
is_equirectangular = dataset.cameras.camera_type == CameraType.EQUIRECTANGULAR.value
|
is_equirectangular = dataset.cameras.camera_type == CameraType.EQUIRECTANGULAR.value
|
||||||
if is_equirectangular.all():
|
if is_equirectangular.all():
|
||||||
@@ -402,9 +391,12 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
|
|||||||
)
|
)
|
||||||
self.iter_eval_image_dataloader = iter(self.eval_image_dataloader)
|
self.iter_eval_image_dataloader = iter(self.eval_image_dataloader)
|
||||||
self.eval_pixel_sampler = self._get_pixel_sampler(self.eval_dataset, self.config.eval_num_rays_per_batch)
|
self.eval_pixel_sampler = self._get_pixel_sampler(self.eval_dataset, self.config.eval_num_rays_per_batch)
|
||||||
|
self.eval_camera_optimizer = self.config.camera_optimizer.setup(
|
||||||
|
num_cameras=self.eval_dataset.cameras.size, device=self.device
|
||||||
|
)
|
||||||
self.eval_ray_generator = RayGenerator(
|
self.eval_ray_generator = RayGenerator(
|
||||||
self.eval_dataset.cameras.to(self.device),
|
self.eval_dataset.cameras.to(self.device),
|
||||||
self.train_camera_optimizer, # should be shared between train and eval.
|
self.eval_camera_optimizer,
|
||||||
)
|
)
|
||||||
# for loading full images
|
# for loading full images
|
||||||
self.fixed_indices_eval_dataloader = FixedIndicesEvalDataloader(
|
self.fixed_indices_eval_dataloader = FixedIndicesEvalDataloader(
|
||||||
|
|||||||
@@ -257,10 +257,14 @@ class Trainer:
|
|||||||
@check_main_thread
|
@check_main_thread
|
||||||
def _check_viewer_warnings(self) -> None:
|
def _check_viewer_warnings(self) -> None:
|
||||||
"""Helper to print out any warnings regarding the way the viewer/loggers are enabled"""
|
"""Helper to print out any warnings regarding the way the viewer/loggers are enabled"""
|
||||||
if self.config.is_viewer_enabled():
|
if (
|
||||||
|
self.config.is_viewer_enabled()
|
||||||
|
and not self.config.is_tensorboard_enabled()
|
||||||
|
and not self.config.is_wandb_enabled()
|
||||||
|
):
|
||||||
string = (
|
string = (
|
||||||
"[NOTE] Not running eval iterations since only viewer is enabled."
|
"[NOTE] Not running eval iterations since only viewer is enabled.\n"
|
||||||
" Use [yellow]--vis wandb[/yellow] or [yellow]--vis tensorboard[/yellow] to run with eval instead."
|
"Use [yellow]--vis {wandb, tensorboard, viewer+wandb, viewer+tensorboard}[/yellow] to run with eval."
|
||||||
)
|
)
|
||||||
CONSOLE.print(f"{string}")
|
CONSOLE.print(f"{string}")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user