ยป Keras API reference / KerasCV / Bounding box formats and utilities / Bounding box utilities / Compute intersection over union of bounding boxes

Compute intersection over union of bounding boxes

[source]

compute_iou function

keras_cv.bounding_box.compute_iou(boxes1, boxes2, bounding_box_format)

Computes a lookup table vector containing the ious for a given set boxes.

The lookup vector is to be indexed by [boxes1_index,boxes2_index] if boxes are unbatched and by [batch, boxes1_index,boxes2_index] if the boxes are batched.

Arguments

  • boxes1: a list of bounding boxes in 'corners' format. Can be batched or unbatched.
  • boxes2: a list of bounding boxes in 'corners' format. This should match the rank and shape of boxes1.
  • bounding_box_format: a case-insensitive string which is one of "xyxy", "rel_xyxy", "xyWH", "center_xyWH", "yxyx", "rel_yxyx". For detailed information on the supported format, see the KerasCV bounding box documentation.

Returns

  • iou_lookup_table: a vector containing the pairwise ious of boxes1 and boxes2.