Repository navigation
fix(key_points): keep YOLO-NAS pose scores as detection confidence - #2909
Merged
Merged
Conversation
`KeyPoints.from_yolo_nas` ignored `prediction.scores`, so `detection_confidence` was `None` on YOLO-NAS output. `with_nms` then raised, and `as_detections` reported the mean key point confidence instead of the model's score. Read the per-pose score into `detection_confidence`, as the Ultralytics, Inference and Detectron2 connectors already do.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change preserving YOLO-NAS per-pose confidence.
No open issues 🎉
What changed in this PR
Extends the pose-score preservation introduced in #2633 to YOLO-NAS, addressing #2908. Keeping model scores enables KeyPoints.with_nms() and makes as_detections() return per-pose confidence instead of mean keypoint confidence.
Changes:
- Populate
detection_confidencefromprediction.scores. - Update test fixtures and expectations for populated and empty results.
- Document the behavior in the connector docstring and changelog.
| File | Description |
|---|---|
tests/key_points/test_core.py |
Expect pose scores as detection confidence and supply empty scores for empty results. |
tests/helpers.py |
Add required per-pose scores to the YOLO-NAS test fixture. |
src/supervision/key_points/core.py |
Preserve YOLO-NAS pose scores and update the return documentation. |
docs/changelog.md |
Describe the confidence fix and its effects on NMS and detection conversion. |
Review effort: Balanced
…confidence # Conflicts: # docs/changelog.md
…confidence # Conflicts: # docs/changelog.md
…confidence # Conflicts: # docs/changelog.md
Borda
approved these changes
Nov 9, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2909 +/- ##
=======================================
Coverage 95% 95%
=======================================
Files 83 83
Lines 14297 14298 +1
=======================================
+ Hits 13539 13543 +4
+ Misses 758 755 -3 🚀 New features to boost your workflow:
|
Borda
pushed a commit
that referenced
this pull request
Nov 10, 2026
…2909) `KeyPoints.from_yolo_nas` ignored `prediction.scores`, so `detection_confidence` was `None` on YOLO-NAS output. `with_nms` then raised, and `as_detections` reported the mean key point confidence instead of the model's score. Read the per-pose score into `detection_confidence`, as the Ultralytics, Inference and Detectron2 connectors already do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
sv.KeyPoints.from_yolo_nasignoresprediction.scores, sodetection_confidenceis alwaysNoneon YOLO-NAS pose output. As a result,KeyPoints.with_nms()cannot be used on it, andKeyPoints.as_detections()reports the mean key point confidence instead of the score the model returned.Minimal repro (the result has the same attributes as super-gradients'
PoseEstimationPrediction, which always carries one score per pose):With this change:
[0.95 0.6],[0.95 0.6], andwith_nmskeeps 1 of the 2 overlapping poses.Motivation and Context
#2633 made
from_ultralytics,from_inferenceandfrom_detectron2keep the detection score and listedfrom_yolo_nasas out of scope. This does the same for YOLO-NAS.sv.Detections.from_yolo_nasalready keeps its confidence.Closes #2908
Changes Made
KeyPoints.from_yolo_nas:detection_confidencecomes fromprediction.scores; updated itsReturnsdocstring.tests/helpers.py:_FakeYoloNasKeyPointtakesscores, like the real prediction.test_from_yolo_nas_inputnow expects the pose score asdetection_confidence.Unreleased.from_transformersandfrom_mediapipe; ViTPose and MediaPipe results carry no per-pose score.Testing
pytest tests/key_points/test_core.py -k from_yolo_nasondevelopwith the updated test:1 failed, 1 passed(assert KeyPoints(...) == KeyPoints(...),detection_confidenceisNone). With this change:2 passed.pytest(full suite):6504 passed, 247 skipped.pre-commit run --files <changed files>: ruff, ruff-format, docformatter, mypy, codespell and the doctest fence check pass.Added/updated tests, and the full suite passes locally
Updated docs (docstrings / mkdocs entry) for new or changed public API
Added a changelog entry in
docs/changelog.mdunderUnreleased(skip for lint/type/format-only or pure doc changes)Additional Notes
prediction.scoresis read directly, because it is a required field ofPoseEstimationPrediction(unlikelabels, which the connector already treats as optional).