def test_track_all(self):
     tracker = FragmentRegistrationTracker(MockDataset(), stage="test", tau_2=0.83, num_points=100)
     model = MockModel()
     tracker.reset("test")
     model.iter = 0
     for i in range(4):
         tracker.track(model)
         model.iter += 1
     metrics = tracker.get_metrics()
     self.assertAlmostEqual(metrics["test_hit_ratio"], (4 * 1.0 + 4 * 0.9 + 4 * 0.8 + 0.9 + 0.84 + 0.8 + 0.7) / 16)
     self.assertAlmostEqual(metrics["test_feat_match_ratio"], (4 * 1 + 4 * 1 + 4 * 0 + 2 * 1 + 2 * 0) / 16)
 def test_track_batch(self):
     tracker = FragmentRegistrationTracker(MockDataset(), stage="test", tau_2=0.83, num_points=100)
     model = MockModel()
     list_hit_ratio = [1.0, 0.9, 0.8, (0.9 + 0.84 + 0.8 + 0.7) / 4]
     list_feat_match_ratio = [1.0, 1.0, 0.0, 0.5]
     for i in range(4):
         tracker.track(model)
         metrics = tracker.get_metrics()
         # the most important metrics in registration
         self.assertAlmostEqual(metrics["test_hit_ratio"], list_hit_ratio[i])
         self.assertAlmostEqual(metrics["test_feat_match_ratio"], list_feat_match_ratio[i])
         tracker.reset("test")
         model.iter += 1