--- title: Utility functions keywords: fastai sidebar: home_sidebar summary: "Utility functions for deepflash2" description: "Utility functions for deepflash2" nb_path: "nbs/06_utils.ipynb" ---
test_eq(iou(mask, mask), 1)
test_eq(iou(mask, empty_mask), 0)
tst_lbl_a = label_mask(mask, min_pixel=0)
test_eq(tst_lbl_a.max(), 2)
test_eq(tst_lbl_a.min(), 0)
plt.imshow(tst_lbl_a);
tst_lbl_b = label_mask(mask, min_pixel=150)
test_eq(tst_lbl_b.max(), 1)
plt.imshow(tst_lbl_b);
test_eq(iou_mapping(tst_lbl_a, tst_lbl_a), ([0., 1., 1], [0, 1, 2], [0, 1, 2], 2, 2))
test_eq(iou_mapping(tst_lbl_a, tst_lbl_b), ([0., 1.], [0, 2], [0, 1], 2, 1))
test_eq(calculate_roi_measures(mask, mask), (1.0, 1.0, 1.0))
test_eq(calculate_roi_measures(mask, mask, min_pixel=150), (1.0, 1.0, 1.0))