import tensorflow as tf


    per_images_iou = []
    for batch_idx in range(batch_size):

        box_mask_for_image = tf.equal(proposal_boxes[:, 0], batch_idx)

        single_image_boxes = tf.boolean_mask(proposal_boxes, box_mask_for_image)
        single_image_boxes = single_image_boxes[:, 1:]
        single_image_gt_boxes = gt_boxes[batch_idx, 0:orig_gt_counts[batch_idx], :]
        single_image_iou = pairwise_iou(single_image_boxes, single_image_gt_boxes)

        per_images_iou.append(single_image_iou)
