Stay organized with collections Save and categorize content based on your preferences.

Class to compute similarity based on Intersection over Union (IOU) metric.



View source

Compute pairwise IOU similarity between ground truth boxes and anchors.

B: batch_size N: Number of groundtruth boxes. M: Number of anchor boxes.

boxes_1 a float Tensor with M or B * M boxes.
boxes_2 a float Tensor with N or B * N boxes, the rank must be less than or equal to rank of boxes_1.
boxes_1_masks a boolean Tensor with M or B * M boxes. Optional.
boxes_2_masks a boolean Tensor with N or B * N boxes. Optional.

A Tensor with shape [M, N] or [B, M, N] representing pairwise iou scores, anchor per row and groundtruth_box per colulmn.

Input shape
boxes_1 [N, 4], or [B, N, 4]
boxes_2 [M, 4], or [B, M, 4]
boxes_1_masks [N, 1], or [B, N, 1]
boxes_2_masks [M, 1], or [B, M, 1]

Output shape
[M, N], or [B, M, N]