Skip to content

Add ONNX export metadata#7353

Merged
glenn-jocher merged 1 commit intomasterfrom
update/onnx_metadata
Apr 9, 2022
Merged

Add ONNX export metadata#7353
glenn-jocher merged 1 commit intomasterfrom
update/onnx_metadata

Conversation

@glenn-jocher
Copy link
Copy Markdown
Member

@glenn-jocher glenn-jocher commented Apr 9, 2022

Adds stride and names to ONNX export metadata for reading during inference. Resolves #7342, #7351

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhanced ONNX model export with metadata and improved model loading with custom metadata handling.

📊 Key Changes

  • 🏷️ Added custom metadata properties (such as 'stride' and 'names') to the ONNX model during export.
  • 📚 ONNX models now store additional information within their metadata properties.
  • 🧠 Updated the model loading code to parse and utilize the new metadata when models are loaded using ONNX runtime.

🎯 Purpose & Impact

  • 🛠️ Purpose: The inclusion of metadata in the ONNX models allows for more information to be packaged with the model itself, improving model portability and ease of use.
  • 🔍 Impact: Users can benefit from the additional model metadata, leading to more informed and potentially optimized model deployment, especially in environments where model parameters like stride are important for integration.
  • 🔄 Users relying on ONNX models from YOLOv5 will notice more robust integration with external tools due to enriched model metadata.

@axzakari
Copy link
Copy Markdown

Hi,

metadata are saved in onnx file. This can be confirmed by using netron.
But, we can not actually retrieve the metadata properties when using:
meta = session.get_modelmeta().custom_metadata_map, the value is always empty.

@glenn-jocher, have you checked that we can retrieve the metadata as expected ?

Thanks in advance ;-)

@axzakari
Copy link
Copy Markdown

Hi,

metadata are saved in onnx file. This can be confirmed by using netron. But, we can not actually retrieve the metadata properties when using: meta = session.get_modelmeta().custom_metadata_map, the value is always empty.

@glenn-jocher, have you checked that we can retrieve the metadata as expected ?

Thanks in advance ;-)

Never mind, buggy installation !!
It works

@glenn-jocher
Copy link
Copy Markdown
Member Author

@axzakari great to hear! If you have any other questions or issues, feel free to ask. We're here to help!

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.

Why is the default "stride" of common.DetectMultiBackend set to 64

2 participants