test tolerance loosenings

Summary: Increase some test tolerances so that they pass in more situations, and re-enable two tests.

Reviewed By: nikhilaravi

Differential Revision: D31379717

fbshipit-source-id: 06a25470cc7b6d71cd639d9fd7df500d4b84c079
This commit is contained in:
Jeremy Reizenstein 2021-10-07 10:46:46 -07:00 committed by Facebook GitHub Bot
parent 8fa438cbda
commit b26f4bc33a
3 changed files with 11 additions and 9 deletions

View File

@ -31,7 +31,6 @@ class TestCamerasAlignment(TestCaseMixin, unittest.TestCase):
"""
Checks the corresponding_cameras_alignment function.
"""
self.skipTest("Temporarily disabled pending investigation")
device = torch.device("cuda:0")
# try few different random setups
@ -134,10 +133,10 @@ class TestCamerasAlignment(TestCaseMixin, unittest.TestCase):
)
elif mode == "extrinsics":
angle_err = so3_relative_angle(
cameras_aligned.R, cameras_tgt.R
cameras_aligned.R, cameras_tgt.R, cos_angle=True
).mean()
self.assertClose(
angle_err, torch.zeros_like(angle_err), atol=add_noise * 10.0
angle_err, torch.ones_like(angle_err), atol=add_noise * 0.03
)
self.assertNormsClose(
cameras_aligned.T, cameras_tgt.T, _rmse, atol=add_noise * 7.0

View File

@ -159,12 +159,13 @@ class TestICP(TestCaseMixin, unittest.TestCase):
self.assertClose(s_init, s, atol=atol)
self.assertClose(Xt_init, Xt, atol=atol)
def test_heterogeneous_inputs(self, batch_size=10):
def test_heterogeneous_inputs(self, batch_size=7):
"""
Tests whether we get the same result when running ICP on
a set of randomly-sized Pointclouds and on their padded versions.
"""
torch.manual_seed(4)
device = torch.device("cuda:0")
for estimate_scale in (True, False):
@ -501,7 +502,6 @@ class TestCorrespondingPointsAlignment(TestCaseMixin, unittest.TestCase):
- use_pointclouds ... If True, passes the Pointclouds objects
to corresponding_points_alignment.
"""
self.skipTest("Temporarily disabled pending investigation")
# run this for several different point cloud sizes
for n_points in (100, 3, 2, 1):
# run this for several different dimensionalities
@ -640,7 +640,10 @@ class TestCorrespondingPointsAlignment(TestCaseMixin, unittest.TestCase):
if reflect and not allow_reflection:
# check that all rotations have det=1
self._assert_all_close(
torch.det(R_est), R_est.new_ones(batch_size), assert_error_message
torch.det(R_est),
R_est.new_ones(batch_size),
assert_error_message,
atol=2e-5,
)
else:
@ -665,13 +668,13 @@ class TestCorrespondingPointsAlignment(TestCaseMixin, unittest.TestCase):
desired_det = R_est.new_ones(batch_size)
if reflect:
desired_det *= -1.0
self._assert_all_close(torch.det(R_est), desired_det, msg, w)
self._assert_all_close(torch.det(R_est), desired_det, msg, w, atol=2e-5)
# check that the transformed point cloud
# X matches X_t
X_t_est = _apply_pcl_transformation(X, R_est, T_est, s=s_est)
self._assert_all_close(
X_t, X_t_est, assert_error_message, w[:, None, None], atol=1e-5
X_t, X_t_est, assert_error_message, w[:, None, None], atol=2e-5
)
def _assert_all_close(self, a_, b_, err_message, weights=None, atol=1e-6):

View File

@ -322,7 +322,7 @@ class TestRasterizeRectangleImagesMeshes(TestCaseMixin, unittest.TestCase):
# Finally check the gradients of the input vertices for
# the square and non square case
self.assertClose(verts_square.grad, grad_tensor.grad, rtol=3e-4)
self.assertClose(verts_square.grad, grad_tensor.grad, rtol=3e-4, atol=5e-3)
def test_gpu(self):
"""