`ultralytics 8.1.11` expand OpenVINO INT8 ops for improved mAP (#7516)

Co-authored-by: AdamP <7806910+adamp87@users.noreply.github.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
pull/7955/head^2 v8.1.11
Glenn Jocher 12 months ago committed by GitHub
parent e6247b72d0
commit 5cb05a85c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/__init__.py
  2. 16
      ultralytics/engine/exporter.py

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.1.10"
__version__ = "8.1.11"
from ultralytics.data.explorer.explorer import Explorer
from ultralytics.models import RTDETR, SAM, YOLO

@ -454,7 +454,21 @@ class Exporter:
if n < 300:
LOGGER.warning(f"{prefix} WARNING ⚠ >300 images recommended for INT8 calibration, found {n} images.")
quantization_dataset = nncf.Dataset(dataset, transform_fn)
ignored_scope = nncf.IgnoredScope(types=["Multiply", "Subtract", "Sigmoid"]) # ignore operation
ignored_scope = None
if isinstance(self.model.model[-1], (Detect, RTDETRDecoder)): # Segment and Pose use Detect base class
# get detection module name in onnx
head_module_name = ".".join(list(self.model.named_modules())[-1][0].split(".")[:2])
ignored_scope = nncf.IgnoredScope( # ignore operations
patterns=[
f"/{head_module_name}/Add",
f"/{head_module_name}/Sub",
f"/{head_module_name}/Mul",
f"/{head_module_name}/Div",
f"/{head_module_name}/dfl",
],
names=[f"/{head_module_name}/Sigmoid"],
)
quantized_ov_model = nncf.quantize(
ov_model, quantization_dataset, preset=nncf.QuantizationPreset.MIXED, ignored_scope=ignored_scope
)

Loading…
Cancel
Save