Repository navigation
Conversation
`KeyPoints.from_ultralytics`, `from_inference` and `from_detectron2` dropped each object's detection score and only kept the per-keypoint scores, leaving `detection_confidence` as `None`. `with_nms` then raised on their output, and `as_detections` fell back to the mean key point confidence, which differs from the score the model reported and from `Detections.from_ultralytics` / `Detections.from_inference`. Read the score from `boxes.conf`, each prediction's `confidence`, and `instances.scores` respectively.
MohammadHijjawi97
force-pushed
the
fix/keypoints-connector-detection-confidence
branch
from
September 28, 2026 12:59
54fd110 to
ba1bd2c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2633 +/- ##
=======================================
Coverage 92% 92%
=======================================
Files 78 78
Lines 11703 11707 +4
=======================================
+ Hits 10721 10728 +7
+ Misses 982 979 -3 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation is consistent across connectors and adequately covered by regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Preserves model-level confidence scores across pose connectors, enabling accurate conversion and NMS.
Changes:
- Populates
detection_confidencefor Inference, Ultralytics, and Detectron2. - Adds focused regression tests.
- Documents the behavior change in the changelog.
Assessment: Code quality 5/5 · Testing 4/5 · Documentation 5/5
| File | Description |
|---|---|
src/supervision/key_points/core.py |
Preserves detection scores in pose connectors. |
tests/key_points/test_core.py |
Tests confidence propagation and conversion. |
docs/changelog.md |
Records the user-visible fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3 tasks done
Changes: - Merge the refreshed develop target, including its 22 changed files, into the PR branch. - Preserve the PR keypoint-confidence changelog entry alongside all three target entries. Impact: - Brings the PR branch up to the fetched develop tip while retaining both sides' changelog updates. - Leaves the reviewed confidence finding open for the upcoming scope decision. Verification: - git diff --cached --check passed. - git diff --name-only --diff-filter=U returned no paths. Residual limits: - CR-2633-1 and review confidence-gap disposition remain pending. --- Co-authored-by: Codex <codex@openai.com>
Changes: - Define `from_inference` object-score availability as all-or-none: any absent or null prediction score leaves `detection_confidence=None` for the batch. - Document `as_detections()` keypoint-mean fallback for mixed batches and add regressions for absent and null scores. Impact: - Consumers receive a consistent object-score vector or `None`; mixed batches use keypoint means for every prediction. - The policy intentionally drops present model scores when another prediction has no score. Verification: - Focused regressions: 2 passed. - Full suite: 4,539 passed, 1 skipped; lint, format, and configured mypy gates passed. - Staged diff check: passed. Residual limits: - PR roboflow#2633 still has unresolved blind-ordering and fresh-coverage obligations; pytest-cov collected no coverage data. --- Co-authored-by: Codex <codex@openai.com>
…//github.com/MohammadHijjawi97/supervision into fix/keypoints-connector-detection-confidence
Borda
approved these changes
Sep 29, 2026
Borda
added a commit
that referenced
this pull request
Sep 29, 2026
`KeyPoints.from_ultralytics`, `from_inference` and `from_detectron2` dropped each object's detection score and only kept the per-keypoint scores, leaving `detection_confidence` as `None`. `with_nms` then raised on their output, and `as_detections` fell back to the mean key point confidence, which differs from the score the model reported and from `Detections.from_ultralytics` / `Detections.from_inference`. Read the score from `boxes.conf`, each prediction's `confidence`, and `instances.scores` respectively. --------- Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com> Co-authored-by: Codex <codex@openai.com>
This was referenced Nov 8, 2026
Closed
Borda
added a commit
that referenced
this pull request
Nov 9, 2026
…etections.keypoints field (#2895) The API design principles still told integrations to use `Detections.keypoints`, a field added in #2290 and reverted in #2291; `sv.Detections` has no such field. Point integrations to `sv.KeyPoints` instead, with the instance score in `KeyPoints.detection_confidence` when the source provides one. The Ultralytics and Detectron2 connectors, and Inference when every prediction carries a confidence, already keep the instance score there (#2633); `as_detections()` derives boxes when a `Detections` object is needed. Prepared with AI assistance (Claude Code); reviewed by the author. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Borda
added a commit
that referenced
this pull request
Nov 10, 2026
…etections.keypoints field (#2895) The API design principles still told integrations to use `Detections.keypoints`, a field added in #2290 and reverted in #2291; `sv.Detections` has no such field. Point integrations to `sv.KeyPoints` instead, with the instance score in `KeyPoints.detection_confidence` when the source provides one. The Ultralytics and Detectron2 connectors, and Inference when every prediction carries a confidence, already keep the instance score there (#2633); `as_detections()` derives boxes when a `Detections` object is needed. Prepared with AI assistance (Claude Code); reviewed by the author. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
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_ultralytics,sv.KeyPoints.from_inferenceandsv.KeyPoints.from_detectron2drop each object's detection score and only keep the per-keypoint scores, sodetection_confidenceis alwaysNoneon their output. Two things follow:KeyPoints.with_nms()cannot be used on connector output at all:KeyPoints.as_detections()falls back to the mean keypoint confidence, so the confidence it reports differs from the score the model returned and fromsv.Detections.from_ultralytics/sv.Detections.from_inferenceon the same result. For Inference it is pulled down further: key points below the request'skeypoint_confidenceare omitted and loaded as zero-confidence slots (fix(key_points): place Inference key points by their skeleton index #2575), so a person scored 0.9 with two of three key points returned at 0.6 and 0.4 became a detection with confidence 0.33.This PR reads the score each framework already provides (
boxes.conf, each prediction'sconfidence,instances.scores) intodetection_confidence.Motivation and Context
detection_confidencewas added in #2286, but none of the connectors populate it, so everything built on it (with_nms,as_detections) only works on hand-builtKeyPoints.Changes Made
from_ultralytics:detection_confidencefromboxes.conf.from_inference:detection_confidencefrom each prediction'sconfidence. A hand-built result dict without a predictionconfidencestill loads, withdetection_confidence=None.from_detectron2:detection_confidencefrominstances.scores.Returnsdocstrings of those connectors.from_yolo_nas,from_transformersandfrom_mediapipe, and the mean-keypoint fallback inas_detectionsitself.Testing
New tests in
tests/key_points/test_core.py(Ultralytics, Inference, Detectron2) fail ondevelop(3 failed:assert None is not None) and pass with this change.pytest tests/key_points: 237 passed; doctests forkey_points/core.pypass;ruff check/ruff format,mypyanddocformatter --checkclean on the changed files.tests/key_pointsand the doctests, not the full suite)docs/changelog.mdunderUnreleased(skip for lint/type/format-only or pure doc changes)Additional Notes
as_detections()on connector output now returns the model's detection score instead of the keypoint mean, which is a visible (intended) behavior change noted in the changelog.