From af2072bf7cf72f7e58bc40eea222beb0b6a66344 Mon Sep 17 00:00:00 2001 From: Ethan Weber Date: Tue, 6 Feb 2024 00:48:20 -0800 Subject: [PATCH 1/3] Enable always returning depth for Gaussian Splatting (#2873) enable always returning depth, if specified in the config --- nerfstudio/models/splatfacto.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nerfstudio/models/splatfacto.py b/nerfstudio/models/splatfacto.py index b23eabe00..6733db406 100644 --- a/nerfstudio/models/splatfacto.py +++ b/nerfstudio/models/splatfacto.py @@ -155,6 +155,8 @@ class SplatfactoModelConfig(ModelConfig): """threshold of ratio of gaussian max to min scale before applying regularization loss from the PhysGaussian paper """ + output_depth_during_training: bool = False + """If True, output depth during training. Otherwise, only output depth during evaluation.""" class SplatfactoModel(Model): @@ -766,7 +768,7 @@ class SplatfactoModel(Model): alpha = alpha[..., None] rgb = torch.clamp(rgb, max=1.0) # type: ignore depth_im = None - if not self.training: + if self.config.output_depth_during_training or not self.training: depth_im = rasterize_gaussians( # type: ignore self.xys, depths, From 6127ec0f722d536b098ee882f0da9c61e2a852b5 Mon Sep 17 00:00:00 2001 From: Brent Yi Date: Tue, 6 Feb 2024 16:07:37 -0800 Subject: [PATCH 2/3] Update viewer legacy docs (#2875) --- README.md | 2 +- docs/developer_guides/viewer/local_viewer.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2b2203373..95ba60a48 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- + Documentation Status diff --git a/docs/developer_guides/viewer/local_viewer.md b/docs/developer_guides/viewer/local_viewer.md index 2931f8c0d..ef8b1ac1f 100644 --- a/docs/developer_guides/viewer/local_viewer.md +++ b/docs/developer_guides/viewer/local_viewer.md @@ -1,4 +1,8 @@ -# Local Server +# (Legacy Viewer) Local Server + +**Note:** this doc only applies to the legacy version of the viewer, which was the default in in Nerfstudio versions `<=0.3.4`. It was deprecated starting Nerfstudio version `1.0.0`, where it needs to be opted into via the `--vis viewer_legacy` argument. + +--- If you are unable to connect to `https://viewer.nerf.studio`, want to use Safari, or want to develop the viewer codebase, you can launch your own local viewer. From dc535175657bc35713dab37b4f93b0ecb14c8c54 Mon Sep 17 00:00:00 2001 From: Chung Min Kim Date: Tue, 6 Feb 2024 16:21:21 -0800 Subject: [PATCH 3/3] Add default depth output when no gaussians visible (#2874) * Add default depth output when no gaussians visible * Add accumulation to default output return * Change to using new_ones/zeros --- nerfstudio/models/splatfacto.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nerfstudio/models/splatfacto.py b/nerfstudio/models/splatfacto.py index 6733db406..a826599f9 100644 --- a/nerfstudio/models/splatfacto.py +++ b/nerfstudio/models/splatfacto.py @@ -669,7 +669,10 @@ class SplatfactoModel(Model): if self.crop_box is not None and not self.training: crop_ids = self.crop_box.within(self.means).squeeze() if crop_ids.sum() == 0: - return {"rgb": background.repeat(int(camera.height.item()), int(camera.width.item()), 1)} + rgb = background.repeat(int(camera.height.item()), int(camera.width.item()), 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} else: crop_ids = None camera_downscale = self._get_downscale_factor() @@ -734,7 +737,10 @@ class SplatfactoModel(Model): tile_bounds, ) # type: ignore if (self.radii).sum() == 0: - return {"rgb": background.repeat(int(camera.height.item()), int(camera.width.item()), 1)} + rgb = background.repeat(int(camera.height.item()), int(camera.width.item()), 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} # Important to allow xys grads to populate properly if self.training: