def intersection(box_mask_list1, box_mask_list2): """Compute pairwise intersection areas between masks. Args: box_mask_list1: BoxMaskList holding N boxes and masks box_mask_list2: BoxMaskList holding M boxes and masks Returns: a numpy array with shape [N*M] representing pairwise intersection area """ return np_mask_ops.intersection(box_mask_list1.get_masks(), box_mask_list2.get_masks())
def testIntersection(self): intersection = np_mask_ops.intersection(self.masks1, self.masks2) expected_intersection = np.array([[8.0, 0.0, 8.0], [0.0, 9.0, 7.0]], dtype=np.float32) self.assertAllClose(intersection, expected_intersection)
def testIntersection(self): intersection = np_mask_ops.intersection(self.masks1, self.masks2) expected_intersection = np.array( [[8.0, 0.0, 8.0], [0.0, 9.0, 7.0]], dtype=np.float32) self.assertAllClose(intersection, expected_intersection)