Skip to content

Fix bug causing failure to load local models in DeepSORT + ReID#163

Open
TserJay wants to merge 8 commits intoroboflow:release/stablefrom
TserJay:dev.load_local_checkpoint
Open

Fix bug causing failure to load local models in DeepSORT + ReID#163
TserJay wants to merge 8 commits intoroboflow:release/stablefrom
TserJay:dev.load_local_checkpoint

Conversation

@TserJay
Copy link

@TserJay TserJay commented Jan 21, 2026

What does this PR do?

This PR fixes issues related to loading local "vanilla" timm checkpoints (e.g., standard .safetensors files downloaded directly from HuggingFace).

Specifically, it addresses two problems:

Fixes NoneType Error on Missing Metadata: Standard timm checkpoints do not contain the custom "config" key in their metadata. Previously, this caused a TypeError when the code attempted to parse non-existent config data.

Enables Offline Loading: Previously, pretrained=True was hardcoded in _initialize_reid_model_from_timm. This forced a network connection to HuggingFace even when a local checkpoint_path was provided.This PR exposes the pretrained argument via init_kwargs.

Related Issue(s): #120

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

  • I have tested this change locally
  • I have added/updated tests for this change

Test details:
reid_model = ReIDModel.from_timm(
model_name_or_checkpoint_path="/path/to/local/model.safetensors",
config_path="path/to/local/config.json"
)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have updated the documentation accordingly (if applicable)

Additional Context

The standard timm weights only contain tensor data and basic metadata (format info), lacking the custom configuration dictionary expected by the previous implementation. By allowing pretrained to be set to False and bypassing the strict metadata parsing when a model name is explicitly provided, we can support a wider range of standard checkpoints.

@TserJay TserJay requested a review from SkalskiP as a code owner January 21, 2026 09:41
@CLAassistant
Copy link

CLAassistant commented Jan 21, 2026

CLA assistant check
All committers have signed the CLA.

@SkalskiP
Copy link
Collaborator

Hi @TserJay 👋🏻 Thanks for the interest in Trackers and for proposing a fix. After a long pause, the project has entered a buildup phase toward an upcoming release with ByteTrack support.

As part of this buildup, the team decided to remove the current DeepSORT and ReIDModel implementations from the codebase. See this PR for details: #161

For this reason, I need to close this PR, since DeepSORT and ReIDModel are scheduled to leave the project anyway. Stay tuned. New trackers are coming to the API soon.

@SkalskiP SkalskiP closed this Jan 21, 2026
@TserJay
Copy link
Author

TserJay commented Jan 21, 2026 via email

@SkalskiP
Copy link
Collaborator

Hi @TserJay. The new release ships this week. Work on this release happens on the develop branch.

To avoid leaving DeepSORT users without a working version, we should reopen this PR, triage it, and if successful, release 2.0.2 with the fixed DeepSORT version before dropping it.

@SkalskiP SkalskiP reopened this Jan 21, 2026
@TserJay
Copy link
Author

TserJay commented Jan 22, 2026

Hi @SkalskiP ,

I've pushed the fixes to resolve the ruff formatting and mypy type errors. The code should be fully compliant now.

Could you please approve the workflows so the CI tests can run? I believe the PR is ready for review.

💡 A suggestion for the future migration: When DeepSORT is eventually removed in favor of ByteTrack, it might be helpful to update the README's algorithm table with a "Last Supported Version" column (e.g., noting v2.0.2 for DeepSORT). This would provide a clear reference for users who still need access to legacy trackers.

Standing by for your feedback. Thanks!

@Borda Borda added the bug Something isn't working label Feb 5, 2026
@SkalskiP SkalskiP self-assigned this Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants