Skip to content

add torchvision detector functionality#164

Open
deruyter92 wants to merge 4 commits intomainfrom
jaap/add_torchvision_detector
Open

add torchvision detector functionality#164
deruyter92 wants to merge 4 commits intomainfrom
jaap/add_torchvision_detector

Conversation

@deruyter92
Copy link
Collaborator

@deruyter92 deruyter92 commented Feb 18, 2026

Motivation:
In the existing code, the TorchvisionDetectorAdaptor is excluded for regular use (e.g. missing from the model registry). This means that pretrained torchvision detectors cannot be loaded automatically, requiring workarounds such as downloading the weights manually, and cleaning up the state dicts. An exemplary case is when working with the superanimal_humanbody_rtmpose_x from the modelzoo. This model requires a pretrained torchvision detector as it does not have any saved detector weights, and can therefore not be used directly in combination with the export functionality.

This PR aims to address this issue by including the TorchVisionDetectorAdaptor as a regular detector model, and updating the runner accordingly. The modelzoo export is also updated to enable export of the superanimal_humanbody_rtmpose_x

Changes:

  • The TorchVisionDetectorAdaptor is registered as detector model
  • The runner is adapted to load a model either when model weights are provided OR when config specifies pretrained=true
  • A specific export functionality is added for the superanimal_humanbody_rtmpose_x, by including a hardcoded config (hacky..) .
# Example destination path
destination_path = "_chekpoints/my_exported_humanbody.pt"
model_name = "rtmpose_x"
super_animal = "superanimal_humanbody"
detector_name = "fasterrcnn_mobilenet_v3_large_fpn"

export_modelzoo_model(
    export_path= destination_path,
    super_animal=super_animal,
    model_name=model_name,
    detector_name=detector_name ,
)

Copy link
Collaborator

@C-Achard C-Achard left a comment

Choose a reason for hiding this comment

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

Nice!
Is this ready to test, or how can I help ?
Otherwise what do you think a sensible way of exposing/documenting any built-in configs would be ? I think it's fine if we clearly centralize/document it.

@deruyter92 deruyter92 marked this pull request as ready for review February 19, 2026 13:16
@deruyter92 deruyter92 changed the title [dev] add torchvision detector functionality add torchvision detector functionality Feb 19, 2026
@deruyter92
Copy link
Collaborator Author

@C-Achard yes feel free to test & merge if you agree and it works.

@C-Achard C-Achard added the lint required Please run: pre-commit run --files [files] locally ONLY on changed files label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lint required Please run: pre-commit run --files [files] locally ONLY on changed files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeepLabCut-live fails to run exported superanimal_humanbody model from DeepLabCut

2 participants