Skip to content
Snippets Groups Projects
Commit 48646927 authored by Daniel CARRON's avatar Daniel CARRON :b:
Browse files

[tests] Remove outdated tests

parent 87bd101d
No related branches found
No related tags found
1 merge request!46Create common library
Pipeline #89597 failed
......@@ -9,76 +9,11 @@ from mednet.classify.config.data.tbx11k.datamodule import (
from mednet.classify.engine.saliency.interpretability import (
_compute_avg_saliency_focus,
_compute_binary_mask,
_compute_max_iou_and_ioda,
_compute_proportional_energy,
_compute_simultaneous_iou_and_ioda,
_process_sample,
)
def test_compute_max_iou_and_ioda():
detected_box = BoundingBox(-1, 10, 10, 100, 100)
gt_box_dict = BoundingBox(1, 50, 50, 50, 50)
gt_box_dict2 = BoundingBox(1, 20, 20, 60, 60)
gt_boxes = BoundingBoxes([gt_box_dict, gt_box_dict2])
iou, ioda = _compute_max_iou_and_ioda(detected_box, gt_boxes)
expected_iou = 0.36
expected_ioda = 0.36
assert iou == expected_iou
assert ioda == expected_ioda
def test_compute_max_iou_and_ioda_zero_detected_area():
detected_box = BoundingBox(-1, 10, 10, 0, 0)
gt_box_dict = BoundingBox(1, 50, 50, 50, 50)
gt_boxes = BoundingBoxes([gt_box_dict])
iou, ioda = _compute_max_iou_and_ioda(detected_box, gt_boxes)
# Should be zero as the detected box has no area
assert iou == 0
assert ioda == 0
def test_compute_max_iou_and_ioda_zero_gt_area():
detected_box = BoundingBox(-1, 10, 10, 100, 100)
gt_box_dict = BoundingBox(1, 50, 50, 0, 0)
gt_boxes = BoundingBoxes([gt_box_dict])
iou, ioda = _compute_max_iou_and_ioda(detected_box, gt_boxes)
# Should be zero as there is no ground truth box
assert iou == 0
assert ioda == 0
def test_compute_max_iou_and_ioda_zero_intersection():
detected_box = BoundingBox(-1, 10, 10, 100, 100)
gt_box_dict = BoundingBox(1, 0, 0, 5, 5)
gt_boxes = BoundingBoxes([gt_box_dict])
iou, ioda = _compute_max_iou_and_ioda(detected_box, gt_boxes)
assert iou == 0
assert ioda == 0
def test_compute_simultaneous_iou_and_ioda():
detected_box = BoundingBox(-1, 10, 10, 100, 100)
gt_box_dict = BoundingBox(1, 50, 50, 50, 50)
gt_box_dict2 = BoundingBox(1, 70, 70, 30, 30)
gt_boxes = BoundingBoxes([gt_box_dict, gt_box_dict2])
iou, ioda = _compute_simultaneous_iou_and_ioda(detected_box, gt_boxes)
assert iou == 0.34
assert ioda == 0.34
def test_compute_avg_saliency_focus():
grayscale_cams = np.ones((200, 200))
grayscale_cams2 = np.full((512, 512), 0.5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment