added yolo11 support

mct-2.1.1
Francesco Mattioli 2 months ago
parent 442797a420
commit 047a3b3f31
  1. 8
      ultralytics/engine/exporter.py

@ -1041,7 +1041,6 @@ class Exporter:
@try_export
def export_mct(self, prefix=colorstr("Sony MCT:")):
# pip install --upgrade -force-reinstall git+https://github.com/ambitious-octopus/model_optimization.git@get-output-fix
check_requirements("mct-nightly")
import model_compression_toolkit as mct
import onnx
@ -1102,6 +1101,7 @@ class Exporter:
# Configure MCT manually for specific layers
bit_cfg = BitWidthConfig()
if "C2f" in self.model.__str__(): # yolov8 model
bit_cfg.set_manual_activation_bit_width(
[
NodeNameScopeFilter("mul"),
@ -1111,6 +1111,12 @@ class Exporter:
],
16,
)
else: # yolo11 model
bit_cfg.set_manual_activation_bit_width(
[NodeNameScopeFilter("sub")],
16,
)
config = mct.core.CoreConfig(
mixed_precision_config=mct.core.MixedPrecisionQuantizationConfig(num_of_images=10),

Loading…
Cancel
Save