|
|
@ -454,7 +454,21 @@ class Exporter: |
|
|
|
if n < 300: |
|
|
|
if n < 300: |
|
|
|
LOGGER.warning(f"{prefix} WARNING ⚠️ >300 images recommended for INT8 calibration, found {n} images.") |
|
|
|
LOGGER.warning(f"{prefix} WARNING ⚠️ >300 images recommended for INT8 calibration, found {n} images.") |
|
|
|
quantization_dataset = nncf.Dataset(dataset, transform_fn) |
|
|
|
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( |
|
|
|
quantized_ov_model = nncf.quantize( |
|
|
|
ov_model, quantization_dataset, preset=nncf.QuantizationPreset.MIXED, ignored_scope=ignored_scope |
|
|
|
ov_model, quantization_dataset, preset=nncf.QuantizationPreset.MIXED, ignored_scope=ignored_scope |
|
|
|
) |
|
|
|
) |
|
|
|