(bboxes, bbox)
return iou
Compute iou of a batch of boxes with another box. Box format '[y_min, x_min, y_max, x_max]'.
  Args:
    bboxes: A batch of boxes. 2-D with shape `[B, 4]`.
    bbox: A single box. 1-D with shape `[4]`.

  Returns:
    Batch of IOUs
Compute iou of a batch of boxes with another box. Box format '[y_min, x_min, y_max, x_max]'.
  Args:
    bboxes: A batch of boxes. 2-D with shape `[B, 4]`.
    bbox: A single box. 1-D with shape `[4]`.
Compute iou of a batch of boxes with another box . Box format [ y_min x_min y_max x_max ] . Args : bboxes : A batch of boxes . 2 - D with shape [ B 4 ] . bbox : A single box . 1 - D with shape [ 4 ] .
def batch_iou(bboxes, bbox):
  """Compute iou of a batch of boxes with another box. Box format '[y_min, x_min, y_max, x_max]'.
  Args:
    bboxes: A batch of boxes. 2-D with shape `[B, 4]`.
    bbox: A single box. 1-D with shape `[4]`.

  Returns:
    Batch of IOUs
  """
  lr = tf.maximum(
    tf.minimum(bboxes[:, 3], bbox[3]) -
    tf.maximum(bboxes[:, 1], bbox[1]),
    0
  )
  tb = tf.maximum(
    tf.minimum(bboxes[:, 2], bbox[2]) -
    tf.maximum(bboxes[:, 0], bbox[0]),
    0
  )
  intersection = tf.multiply(tb, lr)
  union = tf.subtract(
    tf.multiply((bboxes[:, 3] - bboxes[:, 1]), (bboxes[:, 2] - bboxes[:, 0])) +
    tf.multiply((bbox[3] - bbox[1]), (bbox[2] - bbox[0])),
    intersection
  )
  iou = tf.div(intersection, union)
  return iou
def batch_iou ( bboxes , bbox ) : lr = tf . maximum ( tf . minimum ( bboxes [ : , 3 ] , bbox [ 3 ] ) - tf . maximum ( bboxes [ : , 1 ] , bbox [ 1 ] ) , 0 ) tb = tf . maximum ( tf . minimum ( bboxes [ : , 2 ] , bbox [ 2 ] ) - tf . maximum ( bboxes [ : , 0 ] , bbox [ 0 ] ) , 0 ) intersection = tf . multiply ( tb , lr ) union = tf . subtract ( tf . multiply ( ( bboxes [ : , 3 ] - bboxes [ : , 1 ] ) , ( bboxes [ : , 2 ] - bboxes [ : , 0 ] ) ) + tf . multiply ( ( bbox [ 3 ] - bbox [ 1 ] ) , ( bbox [ 2 ] - bbox [ 0 ] ) ) , intersection ) iou = tf . div ( intersection , union ) return iou