Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sanghyun518 opened this issue Jan 17, 2025 · 1 comment · May be fixed by #20784
Open

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

sanghyun518 opened this issue Jan 17, 2025 · 1 comment · May be fixed by #20784
Assignees

Comments

@sanghyun518
Copy link

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.

@Surya2k1
Copy link
Contributor

Seems right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants