From 45db2bcfabe6e0644a3a45a50ed80a9a685ddc34 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 13 Feb 2024 18:12:18 -0500 Subject: [PATCH] Call rescale_output_resolution before early return (#2897) * Call rescale_output_resolution before early return Co-authored-by: Chung Min Kim --- nerfstudio/models/splatfacto.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nerfstudio/models/splatfacto.py b/nerfstudio/models/splatfacto.py index 90bdccd70..071a063e3 100644 --- a/nerfstudio/models/splatfacto.py +++ b/nerfstudio/models/splatfacto.py @@ -747,10 +747,14 @@ class SplatfactoModel(Model): tile_bounds, ) # type: ignore + # rescale the camera back to original dimensions before returning + camera.rescale_output_resolution(camera_downscale) + if (self.radii).sum() == 0: - rgb = background.repeat(int(camera.height.item()), int(camera.width.item()), 1) + rgb = background.repeat(H, W, 1) depth = background.new_ones(*rgb.shape[:2], 1) * 10 accumulation = background.new_zeros(*rgb.shape[:2], 1) + return {"rgb": rgb, "depth": depth, "accumulation": accumulation, "background": background} # Important to allow xys grads to populate properly @@ -766,8 +770,6 @@ class SplatfactoModel(Model): else: rgbs = torch.sigmoid(colors_crop[:, 0, :]) - # rescale the camera back to original dimensions - camera.rescale_output_resolution(camera_downscale) assert (num_tiles_hit > 0).any() # type: ignore # apply the compensation of screen space blurring to gaussians