From 74d25a3b7c529aadf62c60d033607a5e313d9d48 Mon Sep 17 00:00:00 2001 From: Cyril Achard Date: Fri, 14 Aug 2026 15:02:52 +0200 Subject: [PATCH 1/6] Fix snapshot download rename mapping arg Update `download_super_animal_snapshot` to pass `model_filename` directly as `rename_mapping` when downloading from Hugging Face. This aligns with the expected argument shape and prevents false download failures when validating that the model file exists. --- deeplabcut/pose_estimation_pytorch/modelzoo/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py index 991115610..f98ed8102 100644 --- a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py +++ b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py @@ -129,7 +129,8 @@ def download_super_animal_snapshot(dataset: str, model_name: str) -> Path: download_huggingface_model( model_name, target_dir=str(snapshot_dir), - rename_mapping={model_filename: model_filename}, + # rename_mapping={model_filename: model_filename}, + rename_mapping=model_filename, ) if not model_path.exists(): raise RuntimeError(f"Failed to download {model_name} to {model_path}") From d59eb2491833238a536e67c3096de8fe3c93eae5 Mon Sep 17 00:00:00 2001 From: Cyril Achard Date: Fri, 14 Aug 2026 15:05:57 +0200 Subject: [PATCH 2/6] Warn when model zoo inference returns no poses Add module-level logging to PyTorch model zoo inference and emit a warning when video inference produces no pose predictions, making empty-detection runs easier to diagnose. --- deeplabcut/pose_estimation_pytorch/modelzoo/inference.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py b/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py index 3582d20d9..1cd449d54 100644 --- a/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py +++ b/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py @@ -9,6 +9,7 @@ # Licensed under GNU Lesser General Public License v3.0 # import json +import logging from pathlib import Path import numpy as np @@ -30,6 +31,8 @@ ) from deeplabcut.utils.make_labeled_video import create_video +logger = logging.getLogger(__name__) + class NumpyEncoder(json.JSONEncoder): """Special json encoder for numpy types.""" @@ -170,6 +173,8 @@ def _video_inference_superanimal( pose_runner=pose_runner, detector_runner=detector_runner, ) + if not predictions: + logger.warning(f"No pose predictions were made for video {video_path}. Were no individuals detected?") bbox_keys_in_predictions = {"bboxes", "bbox_scores"} bboxes_list = [ From d8dd415f23b584f67801d3af4424c1e4bc7a5692 Mon Sep 17 00:00:00 2001 From: C-Achard Date: Mon, 17 Aug 2026 10:42:16 +0200 Subject: [PATCH 3/6] Fix model download filename remapping Add an explicit source-to-target filename mapping for SuperAnimal models, including `superanimal_humanbody_rtmpose_x`, and pass `rename_mapping` as the expected dict. This ensures snapshots are saved with the standard `.pt` filename even when the upstream Hugging Face artifact name differs. --- deeplabcut/pose_estimation_pytorch/modelzoo/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py index f98ed8102..1b31a3868 100644 --- a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py +++ b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py @@ -26,6 +26,9 @@ # COCO category ID for the "person" class. COCO_PERSON_CATEGORY_ID = 1 +MODEL_FILENAME_MAPPING = { + "superanimal_humanbody_rtmpose_x": "rtmpose-x_simcc-body7.pt", +} def get_model_configs_folder_path() -> Path: @@ -126,11 +129,11 @@ def download_super_animal_snapshot(dataset: str, model_name: str) -> Path: model_filename = f"{model_name}.pt" model_path = snapshot_dir / model_filename + source_filename = MODEL_FILENAME_MAPPING.get(model_name, model_filename) download_huggingface_model( model_name, target_dir=str(snapshot_dir), - # rename_mapping={model_filename: model_filename}, - rename_mapping=model_filename, + rename_mapping={source_filename: model_filename}, ) if not model_path.exists(): raise RuntimeError(f"Failed to download {model_name} to {model_path}") From b62981397b38e8fe8e1150921fc96c4dd1de43ac Mon Sep 17 00:00:00 2001 From: C-Achard Date: Mon, 17 Aug 2026 10:42:35 +0200 Subject: [PATCH 4/6] Raise error when video pose predictions are empty Update superanimal video inference to raise a `RuntimeError` instead of logging a warning when no pose predictions are produced. This makes the failure explicit and prevents downstream processing from continuing with missing detections. --- deeplabcut/pose_estimation_pytorch/modelzoo/inference.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py b/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py index 1cd449d54..766abe5d9 100644 --- a/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py +++ b/deeplabcut/pose_estimation_pytorch/modelzoo/inference.py @@ -174,7 +174,7 @@ def _video_inference_superanimal( detector_runner=detector_runner, ) if not predictions: - logger.warning(f"No pose predictions were made for video {video_path}. Were no individuals detected?") + raise RuntimeError(f"No pose predictions were made for video {video_path}. Were no individuals detected?") bbox_keys_in_predictions = {"bboxes", "bbox_scores"} bboxes_list = [ From 1008670906e41b3600c5e1cce0dd4dc1bad8a309 Mon Sep 17 00:00:00 2001 From: Cyril Achard Date: Tue, 18 Aug 2026 16:37:28 +0200 Subject: [PATCH 5/6] Fix snapshot download rename mapping Update `download_super_animal_snapshot` to only pass a rename mapping when the Hugging Face source filename differs from the expected local model filename. This avoids unnecessary renaming when the source already matches the `.pt` naming pattern and prevents download failures from mismatched rename rules. --- deeplabcut/pose_estimation_pytorch/modelzoo/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py index 1b31a3868..64cbaeed5 100644 --- a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py +++ b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py @@ -130,10 +130,14 @@ def download_super_animal_snapshot(dataset: str, model_name: str) -> Path: model_path = snapshot_dir / model_filename source_filename = MODEL_FILENAME_MAPPING.get(model_name, model_filename) + if model_filename + ".pt" == source_filename: + rename_mapping = None + else: + rename_mapping = {source_filename: model_filename} download_huggingface_model( model_name, target_dir=str(snapshot_dir), - rename_mapping={source_filename: model_filename}, + rename_mapping=rename_mapping, ) if not model_path.exists(): raise RuntimeError(f"Failed to download {model_name} to {model_path}") From d0d4a9e298f56986a61c76e9f08ea7bdaeb113a6 Mon Sep 17 00:00:00 2001 From: C-Achard Date: Wed, 19 Aug 2026 10:43:00 +0200 Subject: [PATCH 6/6] Fix super animal snapshot rename check --- deeplabcut/pose_estimation_pytorch/modelzoo/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py index 64cbaeed5..de9bfd05b 100644 --- a/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py +++ b/deeplabcut/pose_estimation_pytorch/modelzoo/utils.py @@ -130,7 +130,7 @@ def download_super_animal_snapshot(dataset: str, model_name: str) -> Path: model_path = snapshot_dir / model_filename source_filename = MODEL_FILENAME_MAPPING.get(model_name, model_filename) - if model_filename + ".pt" == source_filename: + if model_filename == source_filename: rename_mapping = None else: rename_mapping = {source_filename: model_filename}