feat: ✨ Add ExecuTorch benchmark and update export settings and add format validation in benchmarks (#22552)

Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
This commit is contained in:
Onuralp SEZER 2025-10-31 21:20:13 +03:00 committed by GitHub
parent a7253c6b43
commit b237818d94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -158,7 +158,7 @@ def export_formats():
["NCNN", "ncnn", "_ncnn_model", True, True, ["batch", "half"]],
["IMX", "imx", "_imx_model", True, True, ["int8", "fraction", "nms"]],
["RKNN", "rknn", "_rknn_model", False, False, ["batch", "name"]],
["ExecuTorch", "executorch", "_executorch_model", False, False, ["batch"]],
["ExecuTorch", "executorch", "_executorch_model", True, False, ["batch"]],
]
return dict(zip(["Format", "Argument", "Suffix", "CPU", "GPU", "Arguments"], zip(*x)))

View File

@ -25,6 +25,7 @@ MNN | `mnn` | yolo11n.mnn
NCNN | `ncnn` | yolo11n_ncnn_model/
IMX | `imx` | yolo11n_imx_model/
RKNN | `rknn` | yolo11n_rknn_model/
ExecuTorch | `executorch` | yolo11n_executorch_model/
"""
from __future__ import annotations
@ -153,6 +154,9 @@ def benchmark(
assert not is_end2end, "End-to-end models not supported by RKNN yet"
assert LINUX, "RKNN only supported on Linux"
assert not is_rockchip(), "RKNN Inference only supported on Rockchip devices"
if format == "executorch":
assert not isinstance(model, YOLOWorld), "YOLOWorldv2 ExecuTorch exports not supported yet"
assert not is_end2end, "End-to-end models not supported by ExecuTorch yet"
if "cpu" in device.type:
assert cpu, "inference not supported on CPU"
if "cuda" in device.type:
@ -172,6 +176,7 @@ def benchmark(
# Predict
assert model.task != "pose" or format != "pb", "GraphDef Pose inference is not supported"
assert model.task != "pose" or format != "executorch", "ExecuTorch Pose inference is not supported"
assert format not in {"edgetpu", "tfjs"}, "inference not supported"
assert format != "coreml" or platform.system() == "Darwin", "inference only supported on macOS>=10.13"
if format == "ncnn":