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

Update ImgExtractedDetection: Soften confidence check #166

Merged
merged 7 commits into from
Jan 31, 2025

Conversation

HonzaCuhel
Copy link
Contributor

This PR softens the confidence check in ImgDetectionExtended class, so that values like 1.0000001192092896 would pass.

@HonzaCuhel HonzaCuhel self-assigned this Jan 28, 2025
@github-actions github-actions bot added messages Changes affecting ml.messages fix Fixing a bug labels Jan 28, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 69.69697% with 20 lines in your changes missing coverage. Please review.

Project coverage is 36.54%. Comparing base (6cce15b) to head (dd6461a).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
depthai_nodes/utils/logging.py 71.05% 11 Missing ⚠️
depthai_nodes/ml/messages/keypoints.py 60.00% 6 Missing ⚠️
depthai_nodes/ml/messages/img_detections.py 66.66% 2 Missing ⚠️
depthai_nodes/ml/parsers/utils/yolo.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #166      +/-   ##
==========================================
+ Coverage   35.88%   36.54%   +0.66%     
==========================================
  Files          70       74       +4     
  Lines        4013     4085      +72     
==========================================
+ Hits         1440     1493      +53     
- Misses       2573     2592      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jkbmrz
Copy link
Collaborator

jkbmrz commented Jan 28, 2025

What's the use case of conf. values being higher than 1?

@HonzaCuhel
Copy link
Contributor Author

The reason behind this is, so that when the model is quantized or the values are just badly rounded, the DAI script won't crash. Which is exactly what happened when I tested YOLOv7 tiny inference on a RVC4 device. The parser returned the following confidences scores: [1.0000001192092896, 1.0000001192092896, 1.0000001192092896, 0.6650391221046448], which resulted in the script crash, as most of the values were > 1.

Copy link
Collaborator

@klemen1999 klemen1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anywhere else we have a similar issue that we could handle inside this PR CC: @sokovninn @aljazkonec1

depthai_nodes/ml/messages/img_detections.py Outdated Show resolved Hide resolved
@kkeroo
Copy link
Collaborator

kkeroo commented Jan 28, 2025

Can we rather clip the values to be between 0 and 1?

EDIT: Yeah I see Klemen already said that

@aljazkonec1
Copy link
Contributor

Is there anywhere else we have a similar issue that we could handle inside this PR CC: @sokovninn @aljazkonec1
Yes, Keypoints message also has similar clipping.

@klemen1999
Copy link
Collaborator

Yes, Keypoints message also has similar clipping.

Let's also include same checks and clips there inside this PR as well then.

@HonzaCuhel HonzaCuhel merged commit 95d97be into main Jan 31, 2025
11 checks passed
@HonzaCuhel HonzaCuhel deleted the fix/img-extended-abstract-soft-confidence branch January 31, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fixing a bug messages Changes affecting ml.messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants