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

Add ONNX export metadata #7353

Merged
merged 1 commit into from
Apr 9, 2022
Merged

Add ONNX export metadata #7353

merged 1 commit into from
Apr 9, 2022

Conversation

glenn-jocher
Copy link
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

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

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
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