def test_not_gt_boxes_for_box_matching(self): gt = make_representation(["0 0 0 5 5"], is_ground_truth=True) pred = make_representation(["1 0 0 5 5"], score=1) metric = _test_metric_wrapper(Recall, multi_class_dataset_without_background()) assert 0 == metric(gt, pred)[0] assert metric.meta.get('names') == ['cat']
def test_on_dataset_without_background(self): gt = make_representation(["0 0 0 5 5; 1 10 10 20 20", "1 0 0 5 5"], is_ground_truth=True) pred = make_representation(["0 0 0 5 5; 1 10 10 20 20", "1 0 0 5 5"], score=1) with pytest.warns(None) as warnings: _test_metric_wrapper(Recall, multi_class_dataset_without_background())(gt, pred) assert len(warnings) == 0
def test_detection_on_dataset_without_background(self): gt = make_representation(["0 0 0 5 5; 1 10 10 20 20", "1 0 0 5 5"], is_ground_truth=True) pred = make_representation(["0 0 0 5 5; 1 10 10 20 20", "1 0 0 5 5"], score=1) with pytest.warns(None) as warnings: map_ = _test_metric_wrapper(DetectionMAP, multi_class_dataset_without_background())(gt, pred) mean = np.mean(map_) assert 1.0 == mean assert len(warnings) == 0