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

Inconsistency between PyCOCOCallback and BoxCOCOMetrics #2402

Open
tu6berk opened this issue Mar 22, 2024 · 2 comments
Open

Inconsistency between PyCOCOCallback and BoxCOCOMetrics #2402

tu6berk opened this issue Mar 22, 2024 · 2 comments

Comments

@tu6berk
Copy link

tu6berk commented Mar 22, 2024

Current Behavior:

While constructing the ground truth dataset, PyCOCOCallback computes the number of detections within annotations as follows:

num_detections = ops.sum(ops.cast(gt_classes > 0, "int32"), axis=-1)

at line 102.

In constrast, BoxCOCOMetrics tackles it via this approach:

ground_truth["num_detections"] = [ ops.sum(ops.cast(y_true["classes"] >= 0, "int32"), axis=-1) ]

at lines 300-302.

Consequently, the results produced by the two are quite different, especially when your data set has only a few distinct labels and the encoding is plain integer assignment with enumeration starting from 0.

Expected Behavior:

Since label encoding schemes in most Keras CV models enumerate the classes starting from 0, which holds in my case as well, I believe that BoxCOCOMetrics approach should be applied to PyCOCOCallback. Alternatively this could be made a parameter to be determined by the user.

Steps To Reproduce:

Version:

  • 0.8.2

Anything else:

@tu6berk
Copy link
Author

tu6berk commented Apr 9, 2024

hi, any updates, please?

@LukeWood
Copy link
Contributor

I also agree that the PyCOCOCallback is incorrect here, and that it should be updated to match the BoxCOCOMetrics (Assuming that the package still uses 0 as the first class index across the repo)

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

No branches or pull requests

4 participants