From cc49356d97d0f7b3e7e3398361ecba082c8314e7 Mon Sep 17 00:00:00 2001 From: Kevin Chen <79341521+kevinddchen@users.noreply.github.com> Date: Tue, 25 Oct 2022 13:49:31 -0700 Subject: [PATCH] Normalize depth for packed samples (#824) --- nerfstudio/model_components/renderers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nerfstudio/model_components/renderers.py b/nerfstudio/model_components/renderers.py index 025194ee4..9604a1d5f 100644 --- a/nerfstudio/model_components/renderers.py +++ b/nerfstudio/model_components/renderers.py @@ -234,6 +234,8 @@ class DepthRenderer(nn.Module): if ray_indices is not None and num_rays is not None: # Necessary for packed samples from volumetric ray sampler depth = nerfacc.accumulate_along_rays(weights, ray_indices, steps, num_rays) + accumulation = nerfacc.accumulate_along_rays(weights, ray_indices, None, num_rays) + depth = depth / (accumulation + eps) else: depth = torch.sum(weights * steps, dim=-2) / (torch.sum(weights, -2) + eps)