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 OpenVINO NNCF Support (Using --int8 flag) #11706

Merged
merged 6 commits into from
Jun 17, 2023

Conversation

kisaragychihaya
Copy link
Contributor

@kisaragychihaya kisaragychihaya commented Jun 14, 2023

🤖 Generated by Copilot at 2925311

Summary

🚀🔧📝

Added INT8 quantization option for OpenVINO models in export.py. This allows users to reduce the model size and inference latency by quantizing the weights and activations to 8-bit integers.

Sing, O Muse, of the skillful coder who devised
a way to make the models of OpenVINO more wise,
by adding int8 quantization, a noble feat,
that shrinks the size and boosts the speed of export.py.

Walkthrough

  • Add support for INT8 quantization for OpenVINO models (link, link, link, link)

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Added INT8 quantization support for OpenVINO exports in the YOLOv5 repository.

📊 Key Changes

  • export_openvino function now takes additional parameters: int8, data.
  • New quantization process for INT8, including a new dataset generator gen_dataloader and a transformer function transform_fn for preparing input tensors.
  • Conditional logic to perform INT8 quantization if the int8 flag is set; otherwise, proceed with the existing model conversion.
  • New requirements checked for INT8 quantization: nncf library is now required for this process.

🎯 Purpose & Impact

  • Purpose: To improve the performance of YOLOv5 models on devices compatible with OpenVINO by enabling INT8 quantization, which reduces the model size and inference time while maintaining accuracy.
  • Impact: Users who rely on OpenVINO for deploying their models can now benefit from the reduced computational requirements of INT8 models, possibly allowing deployment on more resource-constrained devices. Enhanced flexibility and potentially better performance for AI models in production environments. 🚀🧠

@glenn-jocher
Copy link
Member

@kisaragychihaya this looks much better!! Thanks for the changes.

Redundant

Signed-off-by: Glenn Jocher <[email protected]>
@glenn-jocher
Copy link
Member

@kisaragychihaya I tested this and it works!! Merging now.

Can you do us a huge favor and also submit a similar PR for YOLOv8 at https://github.com/ultralytics/ultralytics?

@glenn-jocher glenn-jocher merged commit 7e21392 into ultralytics:master Jun 17, 2023
bandakopi pushed a commit to irajcode/yolov5 that referenced this pull request Jul 20, 2023
* Add OpenVINO NNCF support

* Add openvino to flag help text

Using --int8  --data  your_dataset.yaml to quant your ov model

Signed-off-by: 琪亚娜芽衣贴贴 <[email protected]>

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

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

* Update export.py

Redundant

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

---------

Signed-off-by: 琪亚娜芽衣贴贴 <[email protected]>
Signed-off-by: Glenn Jocher <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <[email protected]>
pleb631 pushed a commit to pleb631/yolov5 that referenced this pull request Jan 6, 2024
* Add OpenVINO NNCF support

* Add openvino to flag help text

Using --int8  --data  your_dataset.yaml to quant your ov model

Signed-off-by: 琪亚娜芽衣贴贴 <[email protected]>

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

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

* Update export.py

Redundant

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

---------

Signed-off-by: 琪亚娜芽衣贴贴 <[email protected]>
Signed-off-by: Glenn Jocher <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <[email protected]>
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