From 1044defd1beda981fa20a05cd241261818cc1fb6 Mon Sep 17 00:00:00 2001 From: Matthew Tancik Date: Fri, 23 Sep 2022 16:24:32 -0700 Subject: [PATCH] Remove occluded samples during training. (#530) remove occluded samples during training. --- nerfactory/models/modules/ray_sampler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nerfactory/models/modules/ray_sampler.py b/nerfactory/models/modules/ray_sampler.py index 9411850e3..378558c9b 100644 --- a/nerfactory/models/modules/ray_sampler.py +++ b/nerfactory/models/modules/ray_sampler.py @@ -397,7 +397,7 @@ class VolumetricSampler(Sampler): ray_bundle: RayBundle, num_samples: Optional[int] = None, near_plane: float = 0.0, - remove_occluded_samples: bool = False, + remove_occluded_samples: bool = True, ) -> Tuple[RaySamples, TensorType["total_samples", 3], TensorType["total_samples", 2]]: """Generate ray samples in a bounding box. @@ -455,7 +455,7 @@ class VolumetricSampler(Sampler): if camera_indices is not None: camera_indices = camera_indices[ray_indices] - if remove_occluded_samples: + if remove_occluded_samples and self.training: with torch.no_grad(): positions = origins + dirs * (starts + ends) / 2.0 densities = self.density_fn(positions)