From c2bbdfa98f13b07af8e4dc13644501b19db02646 Mon Sep 17 00:00:00 2001 From: Francesco Mattioli Date: Mon, 12 May 2025 21:58:41 +0200 Subject: [PATCH] OpenVINO one-time message (#20538) Signed-off-by: dependabot[bot] Signed-off-by: Glenn Jocher Signed-off-by: Lakshantha Dissanayake Co-authored-by: UltralyticsAssistant Co-authored-by: Muhammad Rizwan Munawar Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher Co-authored-by: Laughing-q <1185102784@qq.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> Co-authored-by: Lakshantha Dissanayake --- ultralytics/engine/exporter.py | 12 ++++++++++-- ultralytics/utils/__init__.py | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 023e40a1..2e49c316 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -89,6 +89,7 @@ from ultralytics.utils import ( MACOS_VERSION, RKNN_CHIPS, ROOT, + SETTINGS, WINDOWS, YAML, callbacks, @@ -106,7 +107,7 @@ from ultralytics.utils.downloads import attempt_download_asset, get_github_asset from ultralytics.utils.export import export_engine, export_onnx from ultralytics.utils.files import file_size, spaces_in_path from ultralytics.utils.ops import Profile, nms_rotated -from ultralytics.utils.torch_utils import TORCH_1_13, get_latest_opset, select_device +from ultralytics.utils.torch_utils import TORCH_1_13, get_cpu_info, get_latest_opset, select_device def export_formats(): @@ -344,7 +345,6 @@ class Exporter: "See https://docs.ultralytics.com/models/yolo-world for details." ) model.clip_model = None # openvino int8 export error: https://github.com/ultralytics/ultralytics/pull/18445 - if self.args.int8 and not self.args.data: self.args.data = DEFAULT_CFG.data or TASK2DATA[getattr(model, "task", "detect")] # assign default data LOGGER.warning( @@ -352,6 +352,14 @@ class Exporter: ) if tfjs and (ARM64 and LINUX): raise SystemError("TF.js exports are not currently supported on ARM64 Linux") + # Recommend OpenVINO if export and Intel CPU + if SETTINGS.get("openvino_msg"): + if "intel" in get_cpu_info().lower(): + LOGGER.info( + "💡 ProTip: Export to OpenVINO format for best performance on Intel CPUs." + " Learn more at https://docs.ultralytics.com/integrations/openvino/" + ) + SETTINGS["openvino_msg"] = False # Input im = torch.zeros(self.args.batch, model.yaml.get("channels", 3), *self.imgsz).to(self.device) diff --git a/ultralytics/utils/__init__.py b/ultralytics/utils/__init__.py index c6b365ee..200cd519 100644 --- a/ultralytics/utils/__init__.py +++ b/ultralytics/utils/__init__.py @@ -1312,7 +1312,8 @@ class SettingsManager(JSONDict): "raytune": True, # Ray Tune integration "tensorboard": False, # TensorBoard logging "wandb": False, # Weights & Biases logging - "vscode_msg": True, # VSCode messaging + "vscode_msg": True, # VSCode message + "openvino_msg": True, # OpenVINO export on Intel CPU message } self.help_msg = (