From 4ceae420a6c16e91df6de12333cf2bc671a8d3ef Mon Sep 17 00:00:00 2001 From: AdamRashid96 Date: Thu, 3 Aug 2023 21:06:14 +0000 Subject: [PATCH] fix config.pixel_sampler check --- nerfstudio/data/datamanagers/base_datamanager.py | 2 +- nerfstudio/data/pixel_samplers.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nerfstudio/data/datamanagers/base_datamanager.py b/nerfstudio/data/datamanagers/base_datamanager.py index 3e553b953..52fd0af0f 100644 --- a/nerfstudio/data/datamanagers/base_datamanager.py +++ b/nerfstudio/data/datamanagers/base_datamanager.py @@ -461,7 +461,7 @@ class VanillaDataManager(DataManager, Generic[TDataset]): def _get_pixel_sampler(self, dataset: TDataset, num_rays_per_batch: int) -> PixelSampler: """Infer pixel sampler to use.""" - if self.config.patch_size > 1 and isinstance(self.config.pixel_sampler, PixelSamplerConfig): + if self.config.patch_size > 1 and type(self.config.pixel_sampler) is PixelSamplerConfig: return PatchPixelSamplerConfig().setup( patch_size=self.config.patch_size, num_rays_per_batch=num_rays_per_batch ) diff --git a/nerfstudio/data/pixel_samplers.py b/nerfstudio/data/pixel_samplers.py index 332697163..41d457458 100644 --- a/nerfstudio/data/pixel_samplers.py +++ b/nerfstudio/data/pixel_samplers.py @@ -318,7 +318,6 @@ class PatchPixelSampler(PixelSampler): device: Union[torch.device, str] = "cpu", ) -> Int[Tensor, "batch_size 3"]: if isinstance(mask, Tensor): - # Note: if there is a mask, should switch to the base PixelSampler class raise NotImplementedError( "Masked sampling not implemented for PairPixelSampler. Change Config to PixelSamplerConfig instead." ) @@ -382,7 +381,6 @@ class PairPixelSampler(PixelSampler): # pylint: disable=too-few-public-methods device: Union[torch.device, str] = "cpu", ) -> Int[Tensor, "batch_size 3"]: if isinstance(mask, Tensor): - # Note: if there is a mask, should switch to the base PixelSampler class raise NotImplementedError( "Masked sampling not implemented for PairPixelSampler. Change Config to PixelSamplerConfig instead." )