-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved OpenVINO quantization code (#12614)
* Improved OpenVINO quantization code * Auto-format by Ultralytics actions --------- Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
- Loading branch information
1 parent
9abbef5
commit de64179
Showing
1 changed file
with
11 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
de64179
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that with export.py under this repo, the exported OpenVINO model is not as clean as the export flow under the new https://github.com/ultralytics/ultralytics.git repo. Specifically for yolov5m6, there are extra normalization nodes and fakequantize nodes.
Per the code in https://github.com/ultralytics/ultralytics.git, could we also add ignore_scope for multiply, subtract and sigmoid as shown below:
ds = gen_dataloader(data, imgsz=imgsz[0])
quantization_dataset = nncf.Dataset(ds, transform_fn)
ignored_scope = nncf.IgnoredScope(types=['Multiply', 'Subtract', 'Sigmoid']) # ignore operation
ov_model = nncf.quantize(onnx_model, quantization_dataset, preset=nncf.QuantizationPreset.MIXED, ignored_scope=ignored_scope)
Further, the export.py flow currently hard-code imgsz to 640. This can be enhanced by passing down the imgsz input to gen_dataloader API.