def _compare(self, boxlist1, boxlist2):
    """Compute pairwise IOU similarity between the two BoxLists and score.

    Args:
      boxlist1: BoxList holding N boxes. Must have a score field.
      boxlist2: BoxList holding M boxes.

    Returns:
      A tensor with shape [N, M] representing scores threholded by pairwise
      iou scores.
    """
    ious = box_list_ops.iou(boxlist1, boxlist2)
    scores = boxlist1.get_field(fields.BoxListFields.scores)
    scores = tf.expand_dims(scores, axis=1)
    row_replicated_scores = tf.tile(scores, [1, tf.shape(ious)[-1]])
    thresholded_ious = tf.where(ious > self._iou_threshold,
                                row_replicated_scores, tf.zeros_like(ious))

    return thresholded_ious
Compute pairwise IOU similarity between the two BoxLists and score.

    Args:
      boxlist1: BoxList holding N boxes. Must have a score field.
      boxlist2: BoxList holding M boxes.

    Returns:
      A tensor with shape [N, M] representing scores threholded by pairwise
      iou scores.
    
inference_api/src/main/object_detection/core/region_similarity_calculator.py