Skip to content

Incorrect implementation of "v" in "compute_ciou" function #20780

@sanghyun518

Description

@sanghyun518

Describe the bug

In the current implementation of v in compute_ciou function (keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/iou.py), the (4 / math.pi**2) term is included inside power and so gets squared together with the arctan term.

v = ops.squeeze(
ops.power(
(4 / math.pi**2)
* (ops.arctan(width_2 / height_2) - ops.arctan(width_1 / height_1)),
2,
),
axis=-1,
)

However, according to equation (8) in the original CIoU paper, (4 / math.pi**2) should NOT be squared (i.e., it should be outside the power op) - only the arctan term should be squared. This is correctly reflected in Ultralytics' implementation of CIoU here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions