You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PyTorch training metrics incorrectly use multi-animal evaluation for single-animal projects #3518
Training learning_stats.csv:
metrics/test.rmse,NaN
metrics/test.rmse_pcutoff,NaN
metrics/test.mAP,0
metrics/test.mAR,0
Direct evaluation of the same snapshot:
rmse : 1.4092687927219225
rmse_pcutoff : 1.33179851501842
mAP : 0
mAR : 0
Direct metric calculation with the same test data:
single_animal=True
rmse : 1.4092687927219225
rmse_pcutoff : 1.33179851501842
The project contains 33 test images, with valid ground-truth and prediction arrays of shape (1, 1, 3).
Thanks for opening this, and apologies for the late reply as we were focusing on the next release.
Your diagnosis is correct, this is the result of several edge cases not being handled entirely consistently in the code.
Note that this does not affect the actual training process in that the "latest" weights generated are still what you'd have gotten without the issue, however the "best" snapshot saved may not have been derived correctly.
Workaround (temporary, for 3.0.1-3.0.2)
In your project config.yaml, change: snapshotindex: -2 (should be -1 by default)
This will use the most trained (latest) snapshot instead of the early mislabeled "best" one.
This will not fix the metrics (see below for the upcoming fixes), but will at least use a model that is properly trained for the rest of your analysis. Note that after the fix is released this will no longer be appropriate and should be switched to -1 again.
You can also still diagnose training normally, in two ways:
Per epoch: use learning_stats.csv in the model folder, which records losses/train.total_loss and losses/eval.total_loss for every epoch
Per snapshot: set snapshotindex: all (same place as before) and run Evaluate Network. The results CSV in evaluation-results-pytorch has a row per snapshot with both train and test RMSE (in pixels).
For reference
Regarding the current code behavior:
The mAP/mAR metrics should not be defined in this case as there is only a single keypoint
The single animal parameter should indeed be propagated to the runner
After the fix is released, best snapshots can no longer be selected using invalid metrics.
If you would like best-snapshot selection then, you can select on RMSE instead, in pytorch_config.yaml:
Note that sadly we cannot include this in 3.0.2 so it will have to be shipped at a later time, so this will only work in a future version, not on 3.0.1/3.0.2.
Let me know if you have any questions and thanks again!
Activity
C-Achard commentedon Sep 17, 2026
Hello @Fabian97-Bumbee,
Thanks for opening this, and apologies for the late reply as we were focusing on the next release.
Your diagnosis is correct, this is the result of several edge cases not being handled entirely consistently in the code.
Note that this does not affect the actual training process in that the "latest" weights generated are still what you'd have gotten without the issue, however the "best" snapshot saved may not have been derived correctly.
Workaround (temporary, for 3.0.1-3.0.2)
In your project
config.yaml, change:snapshotindex: -2(should be -1 by default)This will use the most trained (latest) snapshot instead of the early mislabeled "best" one.
This will not fix the metrics (see below for the upcoming fixes), but will at least use a model that is properly trained for the rest of your analysis. Note that after the fix is released this will no longer be appropriate and should be switched to -1 again.
You can also still diagnose training normally, in two ways:
learning_stats.csvin the model folder, which records losses/train.total_loss and losses/eval.total_loss for every epochsnapshotindex: all(same place as before) and run Evaluate Network. The results CSV in evaluation-results-pytorch has a row per snapshot with both train and test RMSE (in pixels).For reference
Regarding the current code behavior:
This and a few additional edge cases are now handled and fixed in Fix silent OKS metrics failure on invalid computation and problematic metrics propagation #3519.
After the fix is released, best snapshots can no longer be selected using invalid metrics.
If you would like best-snapshot selection then, you can select on RMSE instead, in
pytorch_config.yaml:Note that sadly we cannot include this in 3.0.2 so it will have to be shipped at a later time, so this will only work in a future version, not on 3.0.1/3.0.2.
Let me know if you have any questions and thanks again!
Best,
Cyril