Skip to content

Fix TorchScript JSON string key bug - #9015

Merged
glenn-jocher merged 2 commits into
masterfrom
glenn-jocher-patch-1
Aug 18, 2022
Merged

glenn-jocher merged 2 commits into
masterfrom
glenn-jocher-patch-1

Conversation

@glenn-jocher

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

Copy link
Copy Markdown
Member

Resolves #9011

Signed-off-by: Glenn Jocher glenn.jocher@ultralytics.com

🛠️ 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 <glenn.jocher@ultralytics.com>
@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 <glenn.jocher@ultralytics.com>

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

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

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
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