Numerical stability of ePnP.

Summary: lg-zhang found the problem with the quadratic part of ePnP implementation: n262385 . It was caused by a coefficient returned from the linear equation solver being equal to exactly 0.0, which caused `sign()` to return 0, something I had not anticipated. I also made sure we avoid division by zero by clamping all relevant denominators.

Reviewed By: nikhilaravi, lg-zhang

Differential Revision: D21531200

fbshipit-source-id: 9eb2fa9d4f4f8f5f411d4cf1cffcc44b365b7e51
This commit is contained in:
Roman Shapovalov
2020-05-15 01:35:00 -07:00
committed by Facebook GitHub Bot
parent a0e14cae1e
commit a8377f1f06
2 changed files with 15 additions and 10 deletions

View File

@@ -51,7 +51,7 @@ class TestPerspectiveNPoints(TestCaseMixin, unittest.TestCase):
return t.norm(dim=-1)
self.assertNormsClose(
T, sol.T[:, None, :], rtol=1e-2, norm_fn=norm_fn, msg=assert_msg
T, sol.T[:, None, :], rtol=3e-3, norm_fn=norm_fn, msg=assert_msg
)
self.assertNormsClose(
R_quat, R_est_quat, rtol=3e-4, norm_fn=norm_fn, msg=assert_msg