View source on GitHub
|
Computes the Complete IoU (CIoU) between two bounding boxes or between two batches of bounding boxes.
tf.keras.utils.bounding_boxes.compute_ciou(
boxes1, boxes2, bounding_box_format, image_shape=None
)
CIoU loss is an extension of GIoU loss, which further improves the IoU optimization for object detection. CIoU loss not only penalizes the bounding box coordinates but also considers the aspect ratio and center distance of the boxes. The length of the last dimension should be 4 to represent the bounding boxes.
Args | |
|---|---|
box1
|
tensor
tensor representing the first bounding box with shape (..., 4). |
box2
|
tensor
tensor representing the second bounding box with shape (..., 4). |
bounding_box_format
|
a case-insensitive string (for example, "xyxy"). Each bounding box is defined by these 4 values. For detailed information on the supported formats, see the KerasCV bounding box documentation. |
image_shape
|
Tuple[int]. The shape of the image (height, width, 3).
When using relative bounding box format for box_format the
image_shape is used for normalization.
|
Returns | |
|---|---|
tensor
|
The CIoU distance between the two bounding boxes. |
View source on GitHub