def test_match_coco_at_150(self): matcher = MatchEngineEuclideanDistance(150, 'coco') assert np.all( matcher.match(detections, gt) == np.array( [[0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]))
def test_match_xview_at_200(self): matcher = MatchEngineEuclideanDistance(200, 'xview') assert np.all( matcher.match(detections, gt) == np.array( [[0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0]]))
def test_similarity(self, th): matcher = MatchEngineEuclideanDistance(th, 'coco') ref_iou = naive_compute_threshold_distance_similarity_matrix( sort_detection_by_confidence(detections), gt, th) iou = matcher.compute_similarity_matrix(detections, gt) print(iou) print(ref_iou) assert np.all(iou[np.logical_not(np.isinf(iou))] == ref_iou[ np.logical_not(np.isinf(iou))])