From 99afaa7164471f9ffc9ca020a8b72421c2278f6e Mon Sep 17 00:00:00 2001 From: Alexander Kristoffersen Date: Thu, 9 Mar 2023 17:30:41 -0800 Subject: [PATCH] Patch Sampling bug fix (#1578) quick fix. --- nerfstudio/data/pixel_samplers.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nerfstudio/data/pixel_samplers.py b/nerfstudio/data/pixel_samplers.py index 8ac8e183d..244498df8 100644 --- a/nerfstudio/data/pixel_samplers.py +++ b/nerfstudio/data/pixel_samplers.py @@ -261,6 +261,14 @@ class PatchPixelSampler(PixelSampler): # pylint: disable=too-few-public-methods num_rays = (num_rays_per_batch // (self.patch_size**2)) * (self.patch_size**2) super().__init__(num_rays, keep_full_image, **kwargs) + def set_num_rays_per_batch(self, num_rays_per_batch: int): + """Set the number of rays to sample per batch. Overrided to deal with patch-based sampling. + + Args: + num_rays_per_batch: number of rays to sample per batch + """ + self.num_rays_per_batch = (num_rays_per_batch // (self.patch_size**2)) * (self.patch_size**2) + # overrides base method def sample_method( # pylint: disable=no-self-use self,