Skip to content

Default top-down rtmpose_x config: top_down_crop 256 but head input_size 384, training crashes at first step #3592

Open

Description

@tsievert

Disclosure: this issue was drafted by an AI assistant (Posit Assistant) from a local reproduction and then reviewed and filed by the reporter. The reproduction output below was produced by running the code shown.

I have searched the existing issues and pull requests (gh search, 2026-11-16) and found none for this problem.

Operating System

Windows 11 (the failing training run itself was on a Linux GPU cluster, DLC 3.0.2, same error)

DeepLabCut version

3.0.2, and git main at 209f0d5 (2026-11-14, version string still 3.0.2). Both affected.

Engine / mode

pytorch, top-down (net_type="rtmpose_x", single animal)

Device type

CPU for the reproduction below (torch 2.15.0+cpu, Python 3.11). The same error occurred in the first training step on a GPU node.

Bug description

For net_type="rtmpose_x" with top_down=True, the generated pytorch config has data.train.top_down_crop and data.inference.top_down_crop of 256x256, but model.heads.bodypart.input_size (and the SimCC target generator input_size) of 384x384 with in_featuremap_size: [12, 12]. The model then receives 256x256 crops, produces an 8x8 feature map and the RTMCC head fails with a shape mismatch. Training crashes in the first step. rtmpose_s and rtmpose_m are not affected (crop and head are both 256).

Probable cause: config/rtmpose/rtmpose_x.yaml sets top_down_crop to 384x384 for train and inference, but in build_pose_config_defaults (config/make_pose_config.py) the generic config/base/aug_top_down.yaml (256x256) is merged over the net-specific config (model_cfg = _update_config(model_cfg, aug_cfg)), which overwrites the 384 crop. I have not tested a fix.

Expected: the crop matches the head input_size (384), as written in rtmpose_x.yaml.

Workaround: set data.train.top_down_crop and data.inference.top_down_crop to 384x384 manually.

Steps To Reproduce

import torch
from deeplabcut.pose_estimation_pytorch.config import PoseConfig
from deeplabcut.pose_estimation_pytorch.models import PoseModel

proj = {"Task": "t", "scorer": "s", "date": "d", "multianimalproject": False,
        "identity": False, "project_path": ".", "engine": "pytorch", "video_sets": {},
        "bodyparts": [f"bp{i}" for i in range(18)], "skeleton": [], "numframes2pick": 20,
        "pcutoff": 0.6, "TrainingFraction": [0.95], "iteration": 0,
        "default_net_type": "resnet_50", "default_augmenter": "default",
        "snapshotindex": -1, "batch_size": 8, "cropping": False}

for net in ["rtmpose_s", "rtmpose_m", "rtmpose_x"]:
    cfg = PoseConfig.build(proj, f"pose_cfg_{net}.yaml", top_down=True, net_type=net).to_dict()
    d, h = cfg["data"], cfg["model"]["heads"]["bodypart"]
    print(net, "train", d["train"]["top_down_crop"], "inf", d["inference"]["top_down_crop"], "head", h["input_size"])
    c = d["train"]["top_down_crop"]
    try:
        PoseModel.build(cfg["model"])(torch.zeros(2, 3, c["height"], c["width"]))
        print("  forward OK")
    except Exception as e:
        print("  forward FAIL:", e)

Relevant log output

rtmpose_s train {'width': 256, 'height': 256} inf {'width': 256, 'height': 256} head [256, 256]
  forward OK
rtmpose_m train {'width': 256, 'height': 256} inf {'width': 256, 'height': 256} head [256, 256]
  forward OK
rtmpose_x train {'width': 256, 'height': 256} inf {'width': 256, 'height': 256} head [384, 384]
  forward FAIL: mm: mat1 and mat2 shapes cannot be multiplied (36x64 and 144x256)

From a real training run (GPU, first step): RuntimeError: mat1 and mat2 shapes cannot be multiplied (144x64 and 144x256)

Anything else?

aug_top_down.yaml has not changed since 2025-04, so this is probably not a recent regression.

Activity

  1. deruyter92 commented on Nov 19, 2026

    @deruyter92
    Collaborator

    @tsievert, Thanks for the clear report!

    This is a regression introduced in 3.0.1 (and present in 3.0.2, 3.0.3): the generic top-down defaults overrode the model-specific crop size, so rtmpose_x got a 256×256 crop for a 384×384 head.

    It's being fixed in #3593 and will be included in the next release.

    Until then, your suggested workaround is a good approach: editing pytorch_config.yaml and setting both data.train.top_down_crop and data.inference.top_down_crop to width: 384, height: 384.

  2. added
    bug
    config
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.0.3bugconfig

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions