Пример #1
0
    def calculate_iou(self, pred_masks, labels):
        best_ious = []
        for image_masks, gt_image_masks in zip(pred_masks, labels):
            ious = mask_iou(image_masks, gt_image_masks)
            best_ious.append(self.xp.max(ious, axis=1))

        return best_ious
Пример #2
0
 def test_mask_iou_invalid(self):
     with self.assertRaises(IndexError):
         mask_iou(self.mask_a, self.mask_b)
Пример #3
0
    def check(self, mask_a, mask_b, expected):
        iou = mask_iou(mask_a, mask_b)

        self.assertIsInstance(iou, type(expected))
        np.testing.assert_equal(cuda.to_cpu(iou), cuda.to_cpu(expected))