From 74bb54ebd1ea371b062ddbc933afb9ae952f148a Mon Sep 17 00:00:00 2001 From: Ruilong Li Date: Sun, 9 Apr 2023 11:16:33 +0000 Subject: [PATCH] fix test --- nerfstudio/cameras/cameras.py | 2 +- tests/cameras/test_cameras.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nerfstudio/cameras/cameras.py b/nerfstudio/cameras/cameras.py index 699c1e920..844c0d605 100644 --- a/nerfstudio/cameras/cameras.py +++ b/nerfstudio/cameras/cameras.py @@ -657,7 +657,7 @@ class Cameras(TensorDataclass): coord_stack[coord_mask, :].reshape(3, -1, 2), distortion_params[mask, :], ).reshape(-1, 2) - except ImportError: + except (RuntimeError, ImportError): coord_stack[coord_mask, :] = camera_utils.radial_and_tangential_undistort( coord_stack[coord_mask, :].reshape(3, -1, 2), distortion_params[mask, :], diff --git a/tests/cameras/test_cameras.py b/tests/cameras/test_cameras.py index 4f1b469cc..c50326475 100644 --- a/tests/cameras/test_cameras.py +++ b/tests/cameras/test_cameras.py @@ -39,7 +39,7 @@ CX_YS = [ torch.ones(BATCH_SIZE, 1) * CX_Y, torch.ones((BATCH_SIZE, BATCH_SIZE, 1)) * CX_Y, ] -DISTORTION_PARAMS = [None, torch.zeros(6), torch.zeros((BATCH_SIZE, 6)), torch.zeros((BATCH_SIZE, BATCH_SIZE, 6))] +DISTORTION_PARAMS = [None, torch.zeros(8), torch.zeros((BATCH_SIZE, 8)), torch.zeros((BATCH_SIZE, BATCH_SIZE, 8))] camera_types = [ 1, torch.tensor([1]), @@ -303,7 +303,7 @@ def _check_cam_shapes(cam: Cameras, _batch_size): assert cam.cy.shape == (*_batch_size, 1) assert cam.height.shape == (*_batch_size, 1) assert cam.width.shape == (*_batch_size, 1) - assert cam.distortion_params is None or cam.distortion_params.shape == (*_batch_size, 6) + assert cam.distortion_params is None or cam.distortion_params.shape == (*_batch_size, 8) assert cam.camera_type.shape == (*_batch_size, 1) return True