tfm.vision.mask_ops.instance_masks_overlap

Calculates the IoUs and IoAs between the detection masks and the ground truth masks.

IoU: intersection over union. IoA: intersection over the area of the detection masks.

boxes a tensor with a shape of [batch_size, N, 4]. The last dimension is the pixel coordinates in [ymin, xmin, ymax, xmax] form.
masks a float tensor with a shape of [batch_size, N, mask_height, mask_width] representing the instance masks w.r.t. the boxes.
gt_boxes a tensor with a shape of [batch_size, M, 4]. The last dimension is the pixel coordinates in [ymin, xmin, ymax, xmax] form.
gt_masks a float tensor with a shape of [batch_size, M, gt_mask_height, gt_mask_width] representing the instance masks w.r.t. the gt_boxes.
output_size two integers that represent the height and width of the output masks.
mask_binarize_threshold a float representing the threshold for binarizing mask values. Default value is 0.5.

iou a tensor with as a shape of [batch_size, N, M].