Skip to content

Modified misleading num_classes Warnings #261

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

panagiotamoraiti
Copy link

@panagiotamoraiti panagiotamoraiti commented Jul 15, 2025

Description

I modified the misleading num_classes mismatch: pretrain weights has x classes, but your model has 90 classes, that was appearing during model loading.
I modified in both files used for training and inference. I just let the warnings report the correct number of classes that the head is reinitializing.

This issue had been addressed in issue #51.

@isaacrob-roboflow @SkalskiP

@panagiotamoraiti
Copy link
Author

panagiotamoraiti commented Jul 15, 2025

I have spotted another issue in this correction. In some coco style annotations, when label ids start from 0, this change reports the correct number of classes.
If a roboflow dataset is used, where ids start from 1, the warning reports one more class. So i think the most consistent way is to follow the official annotation format and start from 1.
In this case we have to subtract 1 from num_classes.

Do you have any suggestions about this issue?
Maybe also the num_classes that the head is initializing should be modified.

Finally, i left it as it was because if label ids don't start from 0 i observed that the argument num_classes initialize to a wrong value (num_classes + 1). So now the warning works well, but label ids in coco json should start from 0.

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 this pull request may close these issues.

1 participant