Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TorchScript JSON string key bug #9015

Merged
merged 2 commits into from
Aug 18, 2022
Merged

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Aug 18, 2022

Resolves #9011

Signed-off-by: Glenn Jocher [email protected]

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improved metadata handling in YOLOv5 TorchScript model loading.

πŸ“Š Key Changes

  • Enhanced JSON parsing to convert string keys to integers when loading model metadata, if they are digits.
  • Maintained the previous structure of loading model metadata from an 'extra_files' dictionary.

🎯 Purpose & Impact

  • Purpose: To ensure that metadata such as stride values and class names can be accurately retrieved with correct data types, which is important for downstream tasks such as data preprocessing and inference.
  • Impact: Users can expect more robust model loading, especially when using TorchScript models in various deployment scenarios. This update reduces the risk of type-related errors when the model metadata is utilized during inference. πŸš€

Resolves #9011

Signed-off-by: Glenn Jocher <[email protected]>
@glenn-jocher glenn-jocher self-assigned this Aug 18, 2022
@glenn-jocher glenn-jocher merged commit 529aafd into master Aug 18, 2022
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch August 18, 2022 09:50
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* Fix TorchScript JSON string key bug

Resolves ultralytics#9011

Signed-off-by: Glenn Jocher <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: Glenn Jocher <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail to run torchscript after exporting
1 participant