From c3e67ffd5f36840152068b4acddffd5477c0ee1e Mon Sep 17 00:00:00 2001 From: Ethan Weber Date: Fri, 7 Apr 2023 22:00:04 +0000 Subject: [PATCH] fix tests --- docs/nerfology/methods/cleanerf.md | 14 ++++++++++++++ docs/nerfology/methods/index.md | 1 + nerfstudio/data/utils/dataloaders.py | 8 -------- scripts/render.py | 15 +++++++-------- 4 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 docs/nerfology/methods/cleanerf.md diff --git a/docs/nerfology/methods/cleanerf.md b/docs/nerfology/methods/cleanerf.md new file mode 100644 index 000000000..9f3faef43 --- /dev/null +++ b/docs/nerfology/methods/cleanerf.md @@ -0,0 +1,14 @@ +# CleaNeRF + +### Running the Method + +```bash +pip install cleanerf +ns-train cleanerf --help +``` + +## Method + +### Overview + +TODO diff --git a/docs/nerfology/methods/index.md b/docs/nerfology/methods/index.md index 9eb1af0a5..9a821b623 100644 --- a/docs/nerfology/methods/index.md +++ b/docs/nerfology/methods/index.md @@ -31,4 +31,5 @@ In addition to their implementations, we have provided guides that walk through Nerfacto Instant-NGP Semantic NeRF-W + CleaNeRF ``` diff --git a/nerfstudio/data/utils/dataloaders.py b/nerfstudio/data/utils/dataloaders.py index 93d309dd8..b695a36c2 100644 --- a/nerfstudio/data/utils/dataloaders.py +++ b/nerfstudio/data/utils/dataloaders.py @@ -230,14 +230,6 @@ class RandIndicesEvalDataloader(EvalDataloader): device: Device to load data to """ - def __init__( - self, - input_dataset: InputDataset, - device: Union[torch.device, str] = "cpu", - **kwargs, - ): - super().__init__(input_dataset, device, **kwargs) - def __iter__(self): return self diff --git a/scripts/render.py b/scripts/render.py index e7c24d0cb..2d59a0735 100644 --- a/scripts/render.py +++ b/scripts/render.py @@ -36,7 +36,6 @@ from nerfstudio.cameras.camera_paths import ( from nerfstudio.cameras.cameras import Cameras, CameraType from nerfstudio.data.scene_box import SceneBox from nerfstudio.model_components import renderers -from nerfstudio.model_components.renderers import DepthRenderer from nerfstudio.pipelines.base_pipeline import Pipeline from nerfstudio.utils import colormaps, install_checks from nerfstudio.utils.eval_utils import eval_setup @@ -57,6 +56,7 @@ def _render_trajectory_video( camera_type: CameraType = CameraType.PERSPECTIVE, depth_near_plane: Optional[float] = None, depth_far_plane: Optional[float] = None, + using_eval_images: bool = False, ) -> None: """Helper function to create a video of the spiral trajectory. @@ -72,16 +72,15 @@ def _render_trajectory_video( camera_type: Camera projection format type. depth_near_plane: Closest depth to consider. If None, use min image value. depth_far_plane: Furthest depth to consider. If None, use max image value. + using_eval_images: Whether the eval images are being used or not. + depth_method: Method to use for depth rendering. If None, use model default. """ + # pylint: disable=too-many-statements CONSOLE.print("[bold green]Creating trajectory " + output_format) cameras.rescale_output_resolution(rendered_resolution_scaling_factor) cameras = cameras.to(pipeline.device) fps = len(cameras) / seconds - # set the pipeline to use median depth - # TODO(ethan): don't hardcode this... - pipeline.model.renderer_depth = DepthRenderer(method="median") - progress = Progress( TextColumn(":movie_camera: Rendering :movie_camera:"), BarColumn(), @@ -153,9 +152,8 @@ def _render_trajectory_video( output_image = np.concatenate((output_image,) * 3, axis=-1) render_image.append(output_image) - # TODO: check for eval-images mode - # if, so then save the GT image as well! - if True: + if using_eval_images: + # if in the eval-images mode, then save the GT images as well batch = pipeline.datamanager.eval_dataloader.input_dataset[camera_idx] rgb_gt = batch["image"] # resize to match the rendered image @@ -390,6 +388,7 @@ class RenderTrajectory: camera_type=camera_type, depth_near_plane=self.depth_near_plane, depth_far_plane=self.depth_far_plane, + using_eval_images=self.traj == "eval-images", )