Skip to content

update RTMPose SimCCPredictor: expose apply_softmax and fix visibility thresholding#3306

Open
deruyter92 wants to merge 4 commits into
mainfrom
jaap/update_rtmpose_simcc_predictor
Open

update RTMPose SimCCPredictor: expose apply_softmax and fix visibility thresholding#3306
deruyter92 wants to merge 4 commits into
mainfrom
jaap/update_rtmpose_simcc_predictor

Conversation

@deruyter92
Copy link
Copy Markdown
Collaborator

@deruyter92 deruyter92 commented May 5, 2026

Motivation
A regression analysis revealed that naive training results in reduced mAP in recent versions of DeepLabCut (only scores and mAP are affected; keypoint predictions remain the same, so mAR, RMSE are stable).

Cause:
The cause could be pinpointed to the change in default value apply_softmax=True introduced in #3078. While this change is indeed required (output predictions should by default be normalized) this introduced two problems:

  • the combination of apply_softmax=True with decode_beta=150 produces a sharp function which does not work well for all datasets. Since apply_softmax is not exposed in the default config yaml, this causes a silent change in performance.
  • the visibility masking was not appropriately adjusted accordingly (locs[vals <= 0.0] = -1 effectively is a no-op for the now normalized output values in range 0 to 1)

Changes:

  • The apply_softmax=True is now exposed in the default config yaml, to facilitate reproducible benchmark results with frozen configs.
  • This PR fixes the visibility thresholding to a sensible value:
threshold = 1.0 / simcc_x.shape[-1] if apply_softmax else 0.0
    locs[vals <= threshold] = -1

Note that the current PR does not alter the default value for the decode_beta parameter (might need further discussion and systematic testing), but for the current benchmarking results (see figure above), a value ~0.2 worked better than 300, and fully restored the original performance of before #3078

Update: a quick hyperparameter analysis was performed with different values of decode_beta. See figures at the bottom. A separate PR will be opened to address this

image image




the original visibility thresholding `locs[vals <= 0] = 1` makes sense for unnormalized logits, but after softmaxing this becomes effectively a no-op. The current commit changes this to a reasonable threshold for the case when apply_softmax=True
@deruyter92 deruyter92 marked this pull request as ready for review May 8, 2026 09:48
@deruyter92 deruyter92 requested a review from Copilot May 8, 2026 09:48
Copy link
Copy Markdown
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 adjusts RTMPose’s SimCC decoding configuration and post-processing to make likelihood/visibility behavior reproducible across runs and to correct visibility masking when outputs are softmax-normalized.

Changes:

  • Exposes apply_softmax (and explicitly sets normalize_outputs) in the default RTMPose config YAMLs to avoid silent behavior changes.
  • Updates get_simcc_maximum() visibility masking by introducing a softmax-aware baseline threshold instead of <= 0.0.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
deeplabcut/pose_estimation_pytorch/models/predictors/sim_cc.py Adjusts SimCC visibility masking thresholding when apply_softmax is enabled.
deeplabcut/pose_estimation_pytorch/config/rtmpose/rtmpose_x.yaml Exposes apply_softmax and normalize_outputs for the SimCC predictor in the X config.
deeplabcut/pose_estimation_pytorch/config/rtmpose/rtmpose_s.yaml Exposes apply_softmax and normalize_outputs for the SimCC predictor in the S config.
deeplabcut/pose_estimation_pytorch/config/rtmpose/rtmpose_m.yaml Exposes apply_softmax and normalize_outputs for the SimCC predictor in the M config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread deeplabcut/pose_estimation_pytorch/models/predictors/sim_cc.py
@deruyter92 deruyter92 marked this pull request as draft May 8, 2026 11:52
@deruyter92 deruyter92 marked this pull request as ready for review May 12, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants