4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 10:34:29 +08:00

Merge remote-tracking branch 'origin' into generative

This commit is contained in:
Matt Tancik 2023-02-22 10:58:19 -08:00
commit 57736cfafc
3 changed files with 16 additions and 20 deletions

View File

@ -69,7 +69,7 @@ class ExperimentConfig(InstantiateConfig):
}
)
"""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."""
data: Optional[Path] = None
"""Alias for --pipeline.datamanager.dataparser.data"""
@ -78,15 +78,15 @@ class ExperimentConfig(InstantiateConfig):
def is_viewer_enabled(self) -> bool:
"""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:
"""Checks if wandb is enabled."""
return "wandb" == self.vis
return ("wandb" == self.vis) | ("viewer+wandb" == self.vis)
def is_tensorboard_enabled(self) -> bool:
"""Checks if tensorboard is enabled."""
return "tensorboard" == self.vis
return ("tensorboard" == self.vis) | ("viewer+tensorboard" == self.vis)
def set_timestamp(self) -> None:
"""Dynamically set the experiment timestamp"""

View File

@ -49,13 +49,8 @@ from nerfstudio.data.dataparsers.nuscenes_dataparser import NuScenesDataParserCo
from nerfstudio.data.dataparsers.phototourism_dataparser import (
PhototourismDataParserConfig,
)
from nerfstudio.data.dataparsers.sdfstudio_dataparser import SDFStudioDataParserConfig
from nerfstudio.data.datasets.base_dataset import InputDataset
from nerfstudio.data.pixel_samplers import (
EquirectangularPixelSampler,
PatchPixelSampler,
PixelSampler,
)
from nerfstudio.data.pixel_samplers import EquirectangularPixelSampler, PixelSampler
from nerfstudio.data.utils.dataloaders import (
CacheDataloader,
FixedIndicesEvalDataloader,
@ -80,7 +75,6 @@ AnnotatedDataParserUnion = tyro.conf.OmitSubcommandPrefixes[ # Omit prefixes of
"dnerf-data": DNeRFDataParserConfig(),
"phototourism-data": PhototourismDataParserConfig(),
"dycheck-data": DycheckDataParserConfig(),
"sdfstudio-data": SDFStudioDataParserConfig(),
},
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
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
@ -352,9 +344,6 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
self, dataset: InputDataset, *args: Any, **kwargs: Any
) -> PixelSampler:
"""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
is_equirectangular = dataset.cameras.camera_type == CameraType.EQUIRECTANGULAR.value
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.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_dataset.cameras.to(self.device),
self.train_camera_optimizer, # should be shared between train and eval.
self.eval_camera_optimizer,
)
# for loading full images
self.fixed_indices_eval_dataloader = FixedIndicesEvalDataloader(

View File

@ -257,10 +257,14 @@ class Trainer:
@check_main_thread
def _check_viewer_warnings(self) -> None:
"""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 = (
"[NOTE] Not running eval iterations since only viewer is enabled."
" Use [yellow]--vis wandb[/yellow] or [yellow]--vis tensorboard[/yellow] to run with eval instead."
"[NOTE] Not running eval iterations since only viewer is enabled.\n"
"Use [yellow]--vis {wandb, tensorboard, viewer+wandb, viewer+tensorboard}[/yellow] to run with eval."
)
CONSOLE.print(f"{string}")