-
Notifications
You must be signed in to change notification settings - Fork 655
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
fix #2968 #2986
fix #2968 #2986
Conversation
@@ -75,7 +75,7 @@ protected DetectedObjects processFromBoxOutput(NDList list) { | |||
float classProb = buf[index + c]; | |||
if (classProb > maxClassProb) { | |||
maxClassProb = classProb; | |||
maxIndex = c; | |||
maxIndex = c - 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxIndex = c is corret.
nClasses should be the same as classes.length. We might add a check to ensure we provide correct error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. maxIndex should start with 0, but not 4!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The labels 0, 1, 2, 3 should never be detected for the bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, for (int c = 4; c < nClasses; c++) should change to for (int c = 0; c < nClasses; c++)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this is correct:
for (int c = 0; c < nClasses; c++) {
float classProb = buf[index + 4 + c];
if (classProb > maxClassProb) {
maxClassProb = classProb;
maxIndex = c;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see where is the problem. Original COCO dataset has 80 classes, but in synset.txt contains 84 rows and first 4 are dummy:
0 = "# Classes for coco dataset on which yelov8 is trained"
1 = "# source config https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml."
2 = "# COCO dataset website: https://cocodataset.org/#home"
3 = "# Ultralytics Coco doc page: https://docs.ultralytics.com/datasets/detect/coco/"
So if you use YoloV8Translator, you need pad 4 dummy labels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (padding != 0 && padding != 4) { //means padding ==0 or padding ==4 is invalid, this is not true. the check should be removed and change for (int c = 4; c < nClasses; c++) { to for (int c = padding; c < nClasses; c++) {?
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2986 +/- ##
============================================
+ Coverage 72.08% 72.28% +0.19%
- Complexity 5126 7290 +2164
============================================
Files 473 722 +249
Lines 21970 32525 +10555
Branches 2351 3395 +1044
============================================
+ Hits 15838 23511 +7673
- Misses 4925 7391 +2466
- Partials 1207 1623 +416 ☔ View full report in Codecov by Sentry. |
The merging logic is not correct, it does not allow padding == 4. I think 0 <= padding < nClasses is valid. |
The output shape is (8400, 84) for COCO dataset, we should always ignore first 4 entries in the output. |
But 0 padding or 4 padding is not work now |
0 or 4 should work, it throw exception when not 0 and not 4
|
If padding is 0, the min label is 4, it should be 0 |
I think the variable name if |
I finetune yolov8 in my dataset and get a new yolov8 model for 96 classes, there are 96 entries in my synset.txt and has no dummy entries. now the diff is 4(doesn't have padding)? int padding = nClasses - classes.size();// nClasses is from synset.txt and equals to 96? classes.size() is from the model and equals to 96? So the padding(diff) is 0? |
If you trained your model with 96 classes, the output should should be (8400, 100)
|
fix #2968