Skip to content

Inference API: add handling for (partially) unsuccessful 2d estimations#19

Merged
xiu-cs merged 8 commits intomainfrom
jaap/handle_invalid_2d_estimations
Feb 25, 2026
Merged

Inference API: add handling for (partially) unsuccessful 2d estimations#19
xiu-cs merged 8 commits intomainfrom
jaap/handle_invalid_2d_estimations

Conversation

@deruyter92
Copy link
Collaborator

@deruyter92 deruyter92 commented Feb 24, 2026

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:

  • The Pose2DResult and Pose3DResult now contain a property valid_frames_mask, indicating for each frame the validity of the prediction.
  • A convenience method get_status_info() is made available that returns a ResultStatus (and message):
    • none valid → EMPTY
    • some valid → PARTIAL
    • all valid → SUCCESS
    • malformed data/mismatch → INVALID
    • missing/unusable mask → UNKNOWN

- 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
@deruyter92 deruyter92 changed the title add handling for (partially) unsuccessful 2d estimations Inference API: add handling for (partially) unsuccessful 2d estimations Feb 24, 2026
@deruyter92 deruyter92 requested a review from Copilot February 24, 2026 10:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_mask and add validation/normalization of prediction shapes.
  • Add ResultStatus plus status / status_message derived properties on Pose2DResult and Pose3DResult.
  • Update predict() to raise on unusable 2D outputs and to mask invalid 3D frames to NaN when 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.

@deruyter92 deruyter92 requested a review from xiu-cs February 25, 2026 08:49
@deruyter92 deruyter92 marked this pull request as ready for review February 25, 2026 10:01
@xiu-cs
Copy link
Collaborator

xiu-cs commented Feb 25, 2026

@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!

@xiu-cs xiu-cs merged commit 16df595 into main Feb 25, 2026
5 checks passed
@xiu-cs xiu-cs deleted the jaap/handle_invalid_2d_estimations branch February 25, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants