Skip to content

Fix NaN handling in PredictKeypointIdentities postprocessor - #3378

Merged
MMathisLab merged 2 commits into
mainfrom
jaap/fix_postprocessor_nan_pafs
Jun 25, 2026
Merged

Fix NaN handling in PredictKeypointIdentities postprocessor#3378
MMathisLab merged 2 commits into
mainfrom
jaap/fix_postprocessor_nan_pafs

Conversation

@deruyter92

Copy link
Copy Markdown
Collaborator

Summary
Fixes #3376 - RuntimeWarning: invalid value encountered in cast during analyze_videos on multi-animal models with identity enabled. PAF assembly leaves missing bodyparts as NaN; PredictKeypointIdentities now indexes the identity heatmap using only finite x/y coordinates and skips invalid keypoints.

Added a new test that reproduces the original issue, which is now fixed: tests/pose_estimation_pytorch/data/test_postprocessor.py::test_predict_keypoint_identities_handles_nan_keypoints

@C-Achard C-Achard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice, clean fix!

Comment thread deeplabcut/pose_estimation_pytorch/data/postprocessor.py Outdated
@deruyter92
deruyter92 marked this pull request as ready for review June 25, 2026 14:09
@MMathisLab
MMathisLab merged commit 97a2fad into main Jun 25, 2026
30 checks passed
@MMathisLab
MMathisLab deleted the jaap/fix_postprocessor_nan_pafs branch June 25, 2026 19:36
@C-Achard C-Achard added this to the v3.0.1 milestone Jun 26, 2026
@deruyter92 deruyter92 mentioned this pull request Jul 20, 2026
9 tasks
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.

RuntimeWarning: invalid value encountered in cast in pose_estimation_pytorch/data/postprocessor.py

3 participants