def ioa(box_mask_list1, box_mask_list2): """Computes pairwise intersection-over-area between box and mask collections. Intersection-over-area (ioa) between two masks mask1 and mask2 is defined as their intersection area over mask2's area. Note that ioa is not symmetric, that is, IOA(mask1, mask2) != IOA(mask2, mask1). Args: box_mask_list1: np_box_mask_list.BoxMaskList holding N boxes and masks box_mask_list2: np_box_mask_list.BoxMaskList holding M boxes and masks Returns: a numpy array with shape [N, M] representing pairwise ioa scores. """ return np_mask_ops.ioa(box_mask_list1.get_masks(), box_mask_list2.get_masks())
def testIOA(self): ioa21 = np_mask_ops.ioa(self.masks1, self.masks2) expected_ioa21 = np.array( [[1.0, 0.0, 8.0 / 25.0], [0.0, 9.0 / 15.0, 7.0 / 25.0]], dtype=np.float32) self.assertAllClose(ioa21, expected_ioa21)
def testIOA(self): ioa21 = np_mask_ops.ioa(self.masks1, self.masks2) expected_ioa21 = np.array([[1.0, 0.0, 8.0/25.0], [0.0, 9.0/15.0, 7.0/25.0]], dtype=np.float32) self.assertAllClose(ioa21, expected_ioa21)