예제 #1
0
    def test_highest_match_using_fit_and_chamfer_distance(self):
        d = load_test_files()
        base = d[2]

        def m(vg1, vg2):
            vg_fit = fit.icp(vg2, vg1, scale=0.1, max_iter=10, downsample=2)
            return -metrics.chamfer_distance(vg1, vg_fit, scale=0.1, downsample=2)

        ind, elem = metrics.highest_match(base, d, m)
        self.assertEqual(2, ind)
예제 #2
0
    def test_highest_match_using_fit_and_iou(self):
        d = load_test_files()
        base = d[0]

        def m(vg1, vg2):
            vg_fit = fit.icp(vg2, vg1, scale=0.1, max_iter=10, downsample=2)
            return metrics.iou(vg1, vg_fit)

        ind, elem = metrics.highest_match(base, d, m)
        self.assertEqual(0, ind)
예제 #3
0
 def test_highest_match(self):
     """
     Note that this test assumes that metric(a,b) is maximized when a==b
     """
     d = load_test_files()
     for i in range(3):
         test_vg = d[i]
         best_ind, best_elem = metrics.highest_match(test_vg, d)
         self.assertEqual(i, best_ind, "Wrong index returned")
         self.assertTrue((best_elem == d[i]).all(), "Returned element is not the best element")