def batch_iou_(anchors, bboxes):
""" Compute iou of two batch of boxes. Box format '[y_min, x_min, y_max, x_max]'.
Args:
anchors: know shape
bboxes: dynamic shape
Return:
ious: 2-D with shape '[num_bboxes, num_anchors]'
indices: [num_bboxes, 1]
"""
num_anchors = anchors.get_shape().as_list()[0]
ious_list = []
for i in range(num_anchors):
anchor = anchors[i]
_ious = batch_iou(bboxes, anchor)
ious_list.append(_ious)
ious = tf.stack(ious_list, axis=0)
ious = tf.transpose(ious)
indices = tf.arg_max(ious, dimension=1)
return ious, indices
评论列表
文章目录