mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
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>
This commit is contained in:
parent
e6247b72d0
commit
5cb05a85c7
@ -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…
x
Reference in New Issue
Block a user