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 --half support for FP16 CoreML exports with #7446

Merged
merged 8 commits into from
Apr 16, 2022

Conversation

Cedric-Perauer
Copy link
Contributor

@Cedric-Perauer Cedric-Perauer commented Apr 16, 2022

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improved CoreML model export with optional quantization.

πŸ“Š Key Changes

  • Added int8 and half arguments to export_coreml() function enabling weight quantization.
  • Wrapped the CoreML weight quantization code with a check for macOS, as quantization is only supported on that OS.
  • Updated the run() function to conditionally enable FP16 (half) mode based on whether CoreML export is enabled.
  • Conditionally run weight quantization depending on the presence of int8 or half flags and the operating system.

🎯 Purpose & Impact

  • πŸ” Purpose: This update aims to provide users with the ability to export CoreML models with reduced size and potentially improved performance on devices by using weight quantization (either 8-bit or 16-bit precision).
  • ⚑ Impact: Users exporting YOLOv5 models to CoreML format can now choose to quantize their models, leading to more efficient models especially suitable for mobile and edge devices. However, the quantization features are limited to macOS users due to platform restrictions.

@glenn-jocher glenn-jocher changed the title add fp16 for coreml using --half Add --half support for FP16 CoreML exports with Apr 16, 2022
@glenn-jocher glenn-jocher merged commit 7926afc into ultralytics:master Apr 16, 2022
@glenn-jocher
Copy link
Member

@Cedric-Perauer PR is merged. Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐

BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* add fp16 for coreml using --half

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

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

* fix

* Cleanup

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

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

* Update export.py

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.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.

2 participants