Inference API: add handling for (partially) unsuccessful 2d estimations#19
Merged
Inference API: add handling for (partially) unsuccessful 2d estimations#19
Conversation
- add a _validate_predictions method for the Estimator2D's - add return parameter valid_frames_mask for Estimator2D's - Add status/valid_frames_mask fields for Pose2DResults - Inference api: predict raises ValueError for invalid / empty pose2d results.
- results for missing 2d predicitons are set to NaN - Pose3DResults now contain status and valid_frames_mask
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the FMPose3D inference API by validating 2D estimator outputs and propagating frame-level validity into 3D results, so callers can reliably detect empty/partial predictions instead of treating them as fully successful.
Changes:
- Extend 2D estimators to return a
valid_frames_maskand add validation/normalization of prediction shapes. - Add
ResultStatusplusstatus/status_messagederived properties onPose2DResultandPose3DResult. - Update
predict()to raise on unusable 2D outputs and to mask invalid 3D frames toNaNwhen 2D is partial.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
fmpose3d/inference_api/fmpose3d.py |
Adds frame-validity mask plumbing, status derivation, and end-to-end behavior changes for empty/partial 2D results. |
tests/fmpose3d_api/test_fmpose3d.py |
Updates mocks/expectations for new estimator return signature and adds status/masking assertions. |
fmpose3d/inference_api/README.md |
Documents new validity/status behavior and the updated estimator predict() return values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Collaborator
|
@deruyter92 Thanks a lot for this PR! I was aware of the potential issue in the 2D part, but I hadn't had time to fix it yet. Thanks for taking care of it! |
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.
Motivation:
Previously, 2D pose predictions were always treated as successful (even when no detections were made), leaving the validation of results to the API user, or in some cases, breaking the results when no valid 2D predictions are found in all frames.
This PR introduces validation and explicit frame-level status reporting so downstream users can safely detect empty/partial outputs instead of treating low-quality predictions as successful.
Commits:
4193b92 — Adds strict 2D validation so bad/missing detections are caught early instead of silently degrading 3D results.
6edcef8 — Extends validation into 3D outputs to make prediction quality explicit and reliably propagated to callers.
58d2397 — Aligns docs/tests with the new status + frame-mask behavior so users can trust and correctly integrate the API signals.
Changes:
valid_frames_mask, indicating for each frame the validity of the prediction.get_status_info()is made available that returns aResultStatus(and message):