fix tests

This commit is contained in:
Ethan Weber committed 2023-04-07 22:00:04 +00:00
1 parent 984f36738a
commit c3e67ffd5f
4 files changed
+22 -16

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
# CleaNeRF
### Running the Method
```bash
pip install cleanerf
ns-train cleanerf --help
```
## Method
### Overview
TODO
+1
View File
@@ -31,4 +31,5 @@ In addition to their implementations, we have provided guides that walk through
Nerfacto<nerfacto.md> Nerfacto<nerfacto.md>
Instant-NGP<instant_ngp.md> Instant-NGP<instant_ngp.md>
Semantic NeRF-W<semantic_nerfw.md> Semantic NeRF-W<semantic_nerfw.md>
CleaNeRF<cleanerf.md>
``` ```
-8
View File
@@ -230,14 +230,6 @@ class RandIndicesEvalDataloader(EvalDataloader):
device: Device to load data to 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): def __iter__(self):
return self return self
+7 -8
View File
@@ -36,7 +36,6 @@ from nerfstudio.cameras.camera_paths import (
from nerfstudio.cameras.cameras import Cameras, CameraType from nerfstudio.cameras.cameras import Cameras, CameraType
from nerfstudio.data.scene_box import SceneBox from nerfstudio.data.scene_box import SceneBox
from nerfstudio.model_components import renderers from nerfstudio.model_components import renderers
from nerfstudio.model_components.renderers import DepthRenderer
from nerfstudio.pipelines.base_pipeline import Pipeline from nerfstudio.pipelines.base_pipeline import Pipeline
from nerfstudio.utils import colormaps, install_checks from nerfstudio.utils import colormaps, install_checks
from nerfstudio.utils.eval_utils import eval_setup from nerfstudio.utils.eval_utils import eval_setup
@@ -57,6 +56,7 @@ def _render_trajectory_video(
camera_type: CameraType = CameraType.PERSPECTIVE, camera_type: CameraType = CameraType.PERSPECTIVE,
depth_near_plane: Optional[float] = None, depth_near_plane: Optional[float] = None,
depth_far_plane: Optional[float] = None, depth_far_plane: Optional[float] = None,
using_eval_images: bool = False,
) -> None: ) -> None:
"""Helper function to create a video of the spiral trajectory. """Helper function to create a video of the spiral trajectory.
@@ -72,16 +72,15 @@ def _render_trajectory_video(
camera_type: Camera projection format type. camera_type: Camera projection format type.
depth_near_plane: Closest depth to consider. If None, use min image value. 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. 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) CONSOLE.print("[bold green]Creating trajectory " + output_format)
cameras.rescale_output_resolution(rendered_resolution_scaling_factor) cameras.rescale_output_resolution(rendered_resolution_scaling_factor)
cameras = cameras.to(pipeline.device) cameras = cameras.to(pipeline.device)
fps = len(cameras) / seconds 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( progress = Progress(
TextColumn(":movie_camera: Rendering :movie_camera:"), TextColumn(":movie_camera: Rendering :movie_camera:"),
BarColumn(), BarColumn(),
@@ -153,9 +152,8 @@ def _render_trajectory_video(
output_image = np.concatenate((output_image,) * 3, axis=-1) output_image = np.concatenate((output_image,) * 3, axis=-1)
render_image.append(output_image) render_image.append(output_image)
# TODO: check for eval-images mode if using_eval_images:
# if, so then save the GT image as well! # if in the eval-images mode, then save the GT images as well
if True:
batch = pipeline.datamanager.eval_dataloader.input_dataset[camera_idx] batch = pipeline.datamanager.eval_dataloader.input_dataset[camera_idx]
rgb_gt = batch["image"] rgb_gt = batch["image"]
# resize to match the rendered image # resize to match the rendered image
@@ -390,6 +388,7 @@ class RenderTrajectory:
camera_type=camera_type, camera_type=camera_type,
depth_near_plane=self.depth_near_plane, depth_near_plane=self.depth_near_plane,
depth_far_plane=self.depth_far_plane, depth_far_plane=self.depth_far_plane,
using_eval_images=self.traj == "eval-images",
) )