Intel OpenVINO-Export
OpenVINO ist das Open-Source-Toolkit von Intel zur Optimierung und Ausführung von KI-Inferenz. Wenn du ein Ultralytics-YOLO26-Modell mit format="openvino" exportierst, wird ein Verzeichnis yolo26n_openvino_model/ mit einem OpenVINO-IR-Modell erstellt (.xml- und .bin-Dateien). Das Modell ist für Intel CPUs, integrierte und diskrete Intel GPUs sowie Intel NPUs und die Genauigkeiten FP32, FP16 oder INT8 vorgesehen.
Auf einen Blick#
| Eigenschaft | Details |
|---|---|
Argument format | openvino |
| Ausgabe | yolo26n_openvino_model/, ein Verzeichnis mit yolo26n.xml, yolo26n.bin und metadata.yaml; yolo26n_int8_openvino_model/ für einen quantize=8-Export |
| Ausführbar auf | Intel CPUs, integrierte und diskrete Intel GPUs sowie Intel NPUs. Das CPU-Gerät läuft auch auf anderen x86-64- und ARM64-Prozessoren, etwa von AMD und auf Apple-Chips. |
| Laufzeitumgebung | OpenVINO Runtime 2024.0.0 oder neuer (das Python-Paket openvino) |
| Precision | FP32, FP16, INT8. YOLO26n ist 10,1 MB groß in FP32, 5,3 MB in FP16 und 3,3 MB in INT8. |
| Exportrechner | Linux, macOS oder Windows. Der Export läuft auf der CPU und benötigt keine GPU. |
Die Ultralytics Platform kann ein trainiertes Modell für dich nach OpenVINO exportieren. Dafür brauchst du keine lokale Exportumgebung.
Schnellstart#
Installiere das Ultralytics-Paket mit den Abhängigkeiten für den OpenVINO-Export:
pip install "ultralytics[export-openvino]"Damit werden openvino und ab Python 3.9 nncf für die INT8-Quantisierung installiert. Bei einer einfachen Installation mit pip install ultralytics werden die fehlenden Pakete beim ersten Export installiert. Für den Export gelten folgende Versionsanforderungen:
| Paket | Erforderliche Version |
|---|---|
torch | 2.1 oder neuer |
openvino | 2024.0.0 oder neuer; ab macOS 15.4 ist 2025.2.0 oder neuer erforderlich |
nncf | 2.14.0 oder neuer, nur für quantize=8; niedriger als 3.0.0 bei PyTorch-Versionen unter 2.3 |
Weitere Installationsmethoden findest du in der Installationsanleitung. Exportiere dann dein Modell und lade das exportierte Verzeichnis, um Inferenz auszuführen oder die Genauigkeit zu validieren. Im Kurs zu OpenVINO auf der CPU werden dieselben Schritte erklärt.
from ultralytics import YOLO
# Ein YOLO26-Modell laden
model = YOLO("yolo26n.pt")
# Modell ins OpenVINO-Format exportieren
model.export(format="openvino") # creates 'yolo26n_openvino_model/'
# Ein INT8-quantisiertes OpenVINO-Modell mit Kalibrierungsdaten exportieren
model.export(format="openvino", quantize=8, data="coco8.yaml") # creates 'yolo26n_int8_openvino_model/'from ultralytics import YOLO
# Das exportierte OpenVINO-Modell laden
model = YOLO("yolo26n_openvino_model/")
# Inferenz ausführen
results = model("https://ultralytics.com/images/bus.jpg")
# Inferenz auf der Intel GPU ausführen; verwende "npu" für die Intel NPU oder "cpu" für die CPU
results = model("https://ultralytics.com/images/bus.jpg", device="xpu")from ultralytics import YOLO
# Das exportierte OpenVINO-Modell laden
model = YOLO("yolo26n_openvino_model/")
# Die Genauigkeit anhand des COCO8-Datensatzes validieren
metrics = model.val(data="coco8.yaml")Unterstützte Aufgaben#
Der OpenVINO-Export unterstützt alle sieben Ultralytics-Aufgaben mit den Modellen YOLOv8, YOLO11 und YOLO26: Objekterkennung, Segmentierung, semantische Segmentierung, Tiefenschätzung, Klassifizierung, Posenschätzung und OBB. Semantische Segmentierung und Tiefenschätzung sind nur mit YOLO26 verfügbar. YOLO26 ist die einzige Modellfamilie, die diese Köpfe enthält.
Exportargumente#
| Argument | Typ | Standard | Beschreibung |
|---|---|---|---|
format | str | 'openvino' | Zielformat des exportierten Modells, das die Kompatibilität mit verschiedenen Bereitstellungsumgebungen festlegt. |
imgsz | int oder tuple | 640 | Bildgröße der Modelleingabe: eine Ganzzahl für quadratische Bilder oder ein Tupel (height, width). Wenn nicht angegeben, verwendet der Export die Größe, mit der der Checkpoint trainiert wurde. Die offiziellen YOLO26-Checkpoints verwenden 640 für Erkennung, Segmentierung, Posenschätzung und auf ADE20K vortrainierte semantische Modelle, 1024 für OBB und auf Cityscapes vortrainierte semantische Modelle, 768 für Tiefenschätzung und 224 für Klassifizierung. |
quantize | int oder str | None | Quantisierungsgenauigkeit: 16 (FP16: Gewichte werden mit halber Genauigkeit gespeichert, Ein- und Ausgaben bleiben FP32) oder 8 (INT8-Quantisierung nach dem Training mit NNCF und Kalibrierungsbildern aus data, gespeichert in einem Verzeichnis _int8_openvino_model/); 32 bzw. ein nicht gesetzter Wert bedeutet FP32. Ein mit quantize=8 trainierter Checkpoint lässt sich nicht nach OpenVINO exportieren. Weitere Informationen findest du unter Einschränkungen und Fehlerbehebung. Diese Option ersetzt die veralteten Flags half und int8. |
data | str | None | Dataset-YAML-Datei für die INT8-Kalibrierung; bei der Klassifizierung wird stattdessen ein Dataset-Verzeichnis oder ein integrierter Dataset-Name verwendet. Für die Kalibrierung wird der Split val verwendet, sofern split nicht gesetzt ist. Wenn quantize=8 nicht angegeben ist, verwendet Ultralytics das kleine Standard-Dataset für die jeweilige Modellaufgabe, zum Beispiel coco8.yaml für die Objekterkennung. |
fraction | float, int oder list | 1.0 | Kalibrierungsteilstichprobe als Verhältnis, Bildanzahl oder [train, val, test]-Verhältnisse/-Anzahlen. Bei Listen mit zwei Elementen bleibt test vollständig erhalten, während 0 es überspringt. |
dynamic | bool | False | Macht Batchgröße, Höhe und Breite der Eingabe dynamisch, sodass ein Modell unterschiedliche Batchgrößen und Bildgrößen akzeptiert. Auf einer Intel NPU läuft ein dynamisches Modell weiterhin mit dem Exportwert imgsz. Weitere Informationen findest du unter Bereitstellung. |
nms | bool, optional | None | Wählt die Rohausgabe (None, Standard), eingebettetes NMS (True) oder den NMS-freien Kopf (False) aus. Siehe Ausgabeformat. |
batch | int | 1 | Batchgröße des exportierten Modells. Bei einem statischen Export ist diese Batchgröße in der Eingabeform festgelegt. Sie wird auch für die INT8-Kalibrierung verwendet. |
device | str | None | Der Export läuft immer auf der CPU. Mit quantize=8 wählt device=npu symmetrische INT8-Aktivierungen für YOLO-Modelle zur Objekterkennung, Segmentierung, Posenschätzung und OBB aus, die auf Intel NPUs bis zu doppelt so schnell laufen. |
Die für alle Formate geltenden Argumente findest du in der Dokumentation zum Exportmodus.
INT8-Quantisierung#
quantize=8 führt eine Quantisierung nach dem Training mit NNCF durch: Beim Export werden Kalibrierungsbilder durch das Modell geleitet. Wo möglich, werden Gewichte und Aktivierungen als 8-Bit-Ganzzahlen gespeichert.
- Kalibrierungsdaten: Der Export kalibriert mit jedem vollständigen Batch des Splits
valvondataoder mit dem Split, den du übersplitfestlegst. Verwendefraction, um die Anzahl der Bilder zu begrenzen. Bei weniger als 300 Bildern gibt der Export eine Warnung aus. - Erkennungskopf: Bei Modellen mit einem YOLO-Erkennungskopf (Objekterkennung, Segmentierung, Posenschätzung und OBB) sowie bei RT-DETR bleiben die Operationen zum Dekodieren der Ausgaben des Kopfes (Umformen, Konkatenation, Box-Dekodierung und DFL) und alle Sigmoid-Operationen im Gleitkommaformat. Die Faltungen des Kopfes werden hingegen quantisiert. Bei Klassifizierungs-, semantischen Segmentierungs- und Tiefenmodellen gibt es keine ausgenommenen Operationen.
- Ein- und Ausgaben: Ein INT8-Modell behält die
float32-Eingabe und -Ausgaben des FP32-Modells bei. Für das FP32-Modell geschriebener Inferenzcode läuft deshalb unverändert. - Intel NPU: Füge
device=npuzu einem INT8-Export hinzu, den du auf einer Intel NPU ausführen möchtest. Dadurch wird die Quantisierung der Aktivierungen bei YOLO-Modellen zur Objekterkennung, Segmentierung, Posenschätzung und OBB von asymmetrisch auf symmetrisch umgestellt.
from ultralytics import YOLO
model = YOLO("yolo26n.pt")
# Mit 10 % der COCO-Validierungsbilder kalibrieren (500 Bilder); coco.yaml durch deinen eigenen Datensatz ersetzen
model.export(format="openvino", quantize=8, data="coco.yaml", fraction=0.1)
# Das exportierte INT8-Modell laden und Inferenz ausführen
model = YOLO("yolo26n_int8_openvino_model/")
results = model("https://ultralytics.com/images/bus.jpg")In den Benchmarks liefen INT8-Modelle auf einer Server-CPU 1,02- bis 1,33-mal schneller als FP32-Modelle und büßten auf COCO val2017 0,5 bis 0,9 mAP ein. Auf Intel Core Ultra CPUs lief INT8 1,2- bis 3,8-mal schneller als FP32. Validiere ein INT8-Modell mit deinen eigenen Daten, bevor du es einsetzt.
Ausgabeformat#
Der Export erstellt ein Verzeichnis mit drei Dateien:
| Datei | Inhalt |
|---|---|
yolo26n.xml | Der Netzwerkgraph im OpenVINO-IR-Format |
yolo26n.bin | Die Gewichte |
metadata.yaml | Klassennamen, Aufgabe, Bildgröße, Batchgröße, Schrittweite und Exportargumente, die Ultralytics beim Laden des Modells ausliest |
Das Modell akzeptiert eine Eingabe der Form (batch, 3, height, width) in RGB, skaliert auf den Wertebereich 0 bis 1. Die Eingabe und Ausgaben sind bei FP32-, FP16- und INT8-Modellen float32, mit Ausnahme der Ausgabe für semantische Segmentierung: Sie ist eine Klassenkarte uint8 (int32 bei Modellen mit mehr als 256 Klassen). Die Tensoren übernehmen nicht die Namen images und output0 des ONNX-Exports. Greife daher in deinem eigenen Code über den Index auf die Eingabe und Ausgaben zu.
Die Ausgabeformen entsprechen denen des ONNX-Exports und hängen von der Aufgabe und dem Argument nms ab: Ein auf imgsz=640 exportiertes YOLO26n-Modell zur Objekterkennung gibt mit dem Standardwert nms=None ein (1, 84, 8400) zurück und mit nms=False oder nms=True ein (1, 300, 6). Die Formen und Inhalte aller Aufgaben findest du unter ONNX-Ausgabeformat. Mit nms=True werden der Konfidenzschwellenwert conf (Standardwert 0.25), der IoU-Schwellenwert iou, agnostic_nms und max_det beim Export fest in den Graphen eingebettet. Ein niedrigerer conf bei der Vorhersage oder Validierung kann bereits vom Graphen entfernte Erkennungen nicht wiederherstellen. Exportiere das Modell erneut, um diese Werte zu ändern.
Bereitstellen#
YOLO("yolo26n_openvino_model/") führt das Modell mit der OpenVINO Runtime aus und ordnet das Argument device einem OpenVINO-Gerät zu:
device | OpenVINO-Gerät |
|---|---|
| nicht festgelegt | AUTO lässt OpenVINO zwischen der CPU und Intel GPUs wählen (die Standardprioritätenliste schließt die NPU aus). Verwende CPU, wenn OpenVINO nur die CPU als Gerät erkennt. |
cpu | CPU |
xpu oder xpu:0 | GPU oder GPU.0 bezeichnet die integrierte oder diskrete Intel GPU. xpu:1 wählt GPU.1 auf einem Rechner mit zwei Intel GPUs aus. |
npu | NPU bezeichnet die neuronale Verarbeitungseinheit von Intel Core Ultra Prozessoren. |
Andere Werte wie 0 oder mps werden wie ein nicht gesetztes device behandelt. Die älteren Bezeichnungen intel:cpu, intel:gpu und intel:npu funktionieren weiterhin und geben eine Warnung über ihre Veraltung aus. Die Tabelle zu Inferenzgeräten vergleicht diese Bezeichnungen für verschiedene Formate. Die Protokollzeile Using OpenVINO LATENCY mode for batch=1 inference on CPU... nennt das von OpenVINO beim Laden des Modells gemeldete Gerät. Bei AUTO kann dies die CPU sein, während eine Intel GPU das Modell noch kompiliert. Setze daher device, wenn du sicherstellen möchtest, welches Gerät verwendet wird. Bei einem .pt-Modell wählt device="xpu" stattdessen das PyTorch-Backend für Intel GPUs aus. Dieses Backend wird auch beim Training auf Intel GPUs verwendet. device="npu" wählt eine Huawei-Ascend-NPU aus, nicht die Intel NPU.
Das Verhalten zur Inferenzzeit hängt davon ab, wie das Modell exportiert wurde:
- Statischer Export (Standard): Das Modell läuft immer mit den beim Export festgelegten Werten für
imgszundbatch, die Ultralytics ausmetadata.yamlausliest. Ein anpredictübergebenesimgszwird ignoriert. Größere Batches werden in Abschnitte mit der Export-Batchgröße aufgeteilt, kleinere Batches werden aufgefüllt. Daher funktioniert jede Anzahl von Bildern. - Dynamischer Export (
dynamic=True):predictakzeptiert unterschiedliche Batchgrößen und alleimgsz, die ein Vielfaches der Modellschrittweite sind. Intel NPUs und INT8-Modelle auf Intel-AMX-CPUs bilden Ausnahmen. Weitere Informationen findest du unter Einschränkungen und Fehlerbehebung. - Latenzmodus: Ultralytics kompiliert das Modell mit dem OpenVINO-Leistungshinweis
LATENCYund führt die Inferenz synchron aus. Um mit dem HinweisTHROUGHPUTviele parallele Anfragen zu bedienen, verwende die OpenVINO-Runtime-API wie in der Anleitung zu Latenz und Durchsatz gezeigt. - Intel NPU: Ultralytics kompiliert das Modell für Batchgröße 1 auf einer NPU und teilt größere Batches in einzelne Bilder auf. Auf einer NPU ist ein dynamischer Export auf den Exportwert
imgszfestgelegt.
Mit der OpenVINO-Runtime-API ausführen#
Um das Modell außerhalb des Ultralytics-Pakets auszuführen, lade die Datei .xml mit dem Paket openvino. Das Modell erwartet ein vorverarbeitetes Bild und gibt die unter Ausgabeformat beschriebenen Rohdaten zurück. Letterboxing und bei einem Standardexport auch NMS musst du daher in deinem Code umsetzen:
# Zuerst exportieren: yolo export model=yolo26n.pt format=openvino nms=False
import numpy as np
import openvino as ov
import yaml
core = ov.Core()
model = core.read_model("yolo26n_openvino_model/yolo26n.xml")
compiled = core.compile_model(model, "AUTO") # oder "CPU", "GPU", "NPU"
image = np.zeros((1, 3, 640, 640), dtype=np.float32) # dein vorverarbeitetes Bild: RGB, NCHW, 0-1
detections = compiled(image)[0][0] # erste Ausgabe, erstes Bild: Form (300, 6)
detections = detections[detections[:, 4] > 0.25] # Zeilen oberhalb des Konfidenzschwellenwerts beibehalten
with open("yolo26n_openvino_model/metadata.yaml") as f:
names = yaml.safe_load(f)["names"] # {0: 'person', 1: 'bicycle', ...}Leitfäden zur Bereitstellung#
- OpenVINO-Latenz- und Durchsatzmodi: Wähle zwischen möglichst geringer Latenz für einen einzelnen Datenstrom und maximalem Durchsatz für viele Datenströme.
- Intel DL Streamer: Führe exportierte Modelle in GStreamer-Pipelines für Videoanalyse auf Intel Core Ultra CPUs, GPUs und NPUs aus.
- OpenVINO-Inferenzgeräte: die Geräte CPU, GPU und NPU sowie der Modus
AUTOin der OpenVINO-Dokumentation. - OpenVINO-Notebooks: die Tutorial-Notebooks von Intel, darunter YOLO26-Optimierung.
Einschränkungen und Fehlerbehebung#
- PyTorch-Version: Bei älteren PyTorch-Versionen schlägt der Export mit
OpenVINO export requires torch>=2.1fehl. - macOS 15.4 und neuer: OpenVINO 2025.1.0 und ältere Versionen funktionieren unter diesen macOS-Versionen nicht. Der Export erfordert dort
openvino>=2025.2.0und aktualisiert ein älteres Paket. - Mit
quantize=8trainierte Checkpoints: Ein mit quantisierungsbewusstem Training feinabgestimmter Checkpoint lässt sich nicht mitformat='openvino' cannot export a QAT model: its Q/DQ ranges are only read by the 'onnx' and 'engine' backendsexportieren. Exportiere stattdessen den Checkpoint, von dem aus du die Feinabstimmung begonnen hast, mitquantize=8, oder exportiere den feinabgestimmten Checkpoint nach ONNX oder TensorRT. - INT8-Export ohne
data: Der Export gibtINT8 export requires a missing 'data' arg for calibration. Using default 'data=coco8.yaml'.aus und kalibriert mit dem kleinen Standard-Dataset für die jeweilige Aufgabe. Übergibdatamit Bildern, die deinen Bereitstellungsdaten entsprechen. - Größe der INT8-Kalibrierungsdaten: Wenn der Kalibrierungssplit weniger als 300 Bilder enthält, gibt der Export
>300 images recommended for INT8 calibration, found 4 images.aus.coco8.yamlhat nur 4 Validierungsbilder. Das reicht aus, um den Export zu testen, aber nicht, um ein Modell für den Einsatz zu kalibrieren. - Ausgabeverzeichnis: Jeder Export desselben Checkpoints – außer einem INT8-Export – schreibt in dasselbe Verzeichnis
yolo26n_openvino_model/, unabhängig vonquantize,imgsz,dynamic,nmsoderbatch. Ein späterer Export überschreibt daher den vorherigen. Alle INT8-Exporte verwenden dasselbe Verzeichnisyolo26n_int8_openvino_model/, unabhängig davon, obdevice=npugesetzt ist. - Gerät nicht verfügbar: Fehlt das angeforderte Gerät, gibt Ultralytics
OpenVINO device 'GPU' not available. Using 'AUTO' instead.aus (oderUsing 'CPU' instead.auf einem Rechner, auf dem OpenVINO nur die CPU erkennt) und fährt mit diesem Gerät fort. Vergewissere dich, dass dein Prozessor von OpenVINO unterstützt wird, und installiere den Intel-GPU- oder NPU-Treiber. - Intel NPU: Ultralytics führt eine NPU mit Batchgröße 1 und festgelegten Eingabeformen aus. Weitere Informationen findest du unter Bereitstellung. Übergib
device=npu, um die NPU zu verwenden. Ein nicht gesetztesdevicewählt die NPU nicht aus. - Dynamische Formen mit NMS: Ein Export mit
dynamic=Trueundnms=Truegibt'dynamic=True' export requires a maximum batch size, e.g. 'batch=16'.aus, wennbatchauf1gesetzt bleibt. Ultralytics führt größere Batches in Abschnitten der Export-Batchgrößebatchaus. - Dynamische INT8-Modelle auf Intel-AMX-CPUs: Unter Linux führt Ultralytics ein dynamisches INT8-Modell auf einer CPU mit AMX-Unterstützung (Intel Sapphire Rapids oder neuer) auf dem Gerät
CPUoderAUTOmit der beim Export festgelegten Batchgrößeimgszaus, wie bei einem statischen Modell. Ein anpredictodervalübergebenesimgszwird ignoriert, undvalverwendet die Export-Batchgrößebatch.predictakzeptiert weiterhin andere Batchgrößen und kompiliert das Modell für jede neue Batchgröße erneut. Daher dauert die erste Inferenz mit einer neuen Batchgröße länger. - Windows: Unter Windows setzt Ultralytics den Präzisionshinweis für die CPU-Inferenz auf FP32. Dadurch verwendet OpenVINO keine Gleitkommakernel mit geringerer Genauigkeit mehr (INT8-Modelle laufen weiterhin mit INT8), und oneDNN wird auf Befehlssätze unterhalb von AMX beschränkt. Lege die Umgebungsvariable
ONEDNN_MAX_CPU_ISAfest, bevor du das Modell lädst, um eine andere Begrenzung zu verwenden. - Linux auf ARM64: Ultralytics führt das Gerät
CPUim OpenVINO-Ausführungsmodus für hohe Genauigkeit mit FP32-Inferenzgenauigkeit aus. - Eingebettetes NMS:
nms=Truelöst bei der Klassifizierung'nms=True' is not valid for classification models.aus. Bei Modellen für semantische Segmentierung und Tiefenschätzung ('nms=True' is not valid for semantic models. Forcing 'nms=None'.) sowie RT-DETR-Modellen ('nms=True' is not available for end2end models or non-YOLO heads. Forcing 'nms=None'.) wird die Option mit einer Warnung ignoriert. - NMS-freier Kopf:
nms=Falseerfordert ein Modell mit NMS-freiem Kopf, etwa YOLO26 oder YOLOv10. Bei anderen Modellen, zum Beispiel YOLO11, gibt der Export die WarnungThis model has no one-to-one head; using one-to-many outputs.aus und schreibt die Rohausgabe(1, 84, 8400).
Weitere Fehler findest du im Leitfaden zu häufigen Problemen.
YOLO26-Benchmarks mit OpenVINO#
Die Tabellen unten vergleichen PyTorch mit OpenVINO-Modellen in FP32, FP16 und INT8 für alle YOLO26-Modelle zur Objekterkennung. Die erste Messreihe stammt von einer Server-CPU und enthält Genauigkeitswerte für COCO val2017. Die zweite Messreihe stammt von drei Intel Core Ultra Prozessoren und umfasst deren CPUs und GPUs sowie die NPUs von zwei Prozessoren. Auf der YOLO26-Modellseite findest du für jedes Modell die Genauigkeit, die ONNX-Geschwindigkeit auf der CPU und die TensorRT-Geschwindigkeit auf einer T4.
FP32, FP16 und INT8 auf einer Server-CPU#
Alle Werte in diesem Abschnitt wurden auf der CPU eines Servers mit zwei AMD EPYC 9655-Prozessoren mit jeweils 96 Kernen gemessen, nicht auf einer Intel CPU. PyTorch lief mit 8 Threads, OpenVINO mit 96 Threads – den Standardwerten, die Ultralytics und OpenVINO auf diesem Server ausgewählt haben. Die Spalten für PyTorch und OpenVINO unterscheiden sich also sowohl bei der Laufzeitumgebung als auch bei der Threadanzahl. PyTorch wurde außerdem mit rechteckiger Inferenz validiert: Jedes Bild wurde entsprechend seinem Seitenverhältnis auf ein Rechteck aufgefüllt (512x672 bei einem Bild mit 480x640 Pixeln). Die statischen OpenVINO-Modelle liefen dagegen immer mit 640x640.
Millisekunden pro Bild; niedrigere Werte sind besser. Das schnellste Format für jedes Modell ist fett hervorgehoben.
| Modell | imgsz | PyTorch | OpenVINO FP32 | OpenVINO FP16 | OpenVINO INT8 |
|---|---|---|---|---|---|
| YOLO26n | 640 | 13.31 | 3.41 | 3.33 | 3.35 |
| YOLO26s | 640 | 24.28 | 5.18 | 5.18 | 4.51 |
| YOLO26m | 640 | 49.94 | 8.39 | 8.34 | 6.60 |
| YOLO26l | 640 | 63.75 | 10.92 | 11.05 | 8.94 |
| YOLO26x | 640 | 115.11 | 17.12 | 17.16 | 12.83 |
YOLO26n auf denselben 8 CPUs (PyTorch und OpenVINO jeweils mit taskset an die CPUs 0–7 des Servers gebunden):
| Kennzahl | PyTorch | OpenVINO FP32 | OpenVINO FP16 | OpenVINO INT8 |
|---|---|---|---|---|
| Latenz (ms/Bild) | 9.28 | 7.13 | 7.14 | 6.71 |
| mAPval 50-95 | 40.8 | 40.9 | 40.9 | 40.3 |
- OpenVINO FP32 lief mit den oben genannten Standard-Threadzahlen 3,9- bis 6,7-mal schneller als PyTorch und erreichte eine Genauigkeit innerhalb von 0,1 mAP. Bei Bindung beider Modelle an dieselben 8 CPUs lief PyTorch schneller als in der Standardeinstellung. OpenVINO FP32 führte YOLO26n 1,3-mal schneller als PyTorch aus, INT8 lief 1,06-mal schneller als FP32.
- FP16 halbierte die Modellgröße bei einer Genauigkeit innerhalb von 0,1 mAP gegenüber FP32 und erreichte nahezu dieselbe Latenz wie FP32 (Abweichung unter 3 %).
- INT8 lief 1,02- bis 1,33-mal schneller als FP32, verkleinerte das Modell um den Faktor 3,1 bis 3,9 und büßte 0,5 bis 0,9 mAP ein.
Gemessen mit ultralytics 8.4.212, OpenVINO 2026.4.1, NNCF 3.4.0 und PyTorch 2.15.0 unter batch=1 am 14. November 2026. Die Latenz bezieht sich auf die von val gemeldete Inferenzphase und schließt Vor- und Nachverarbeitung nicht ein. Die Werte für PyTorch, FP32 und FP16 sind jeweils der Mittelwert aus drei Durchläufen. Die Abweichungen betrugen bei PyTorch bis zu 26 % und bei OpenVINO bis zu 6 %. INT8-Modelle wurden mit 591 Bildern aus COCO train2017 (split=train fraction=0.005) kalibriert und jeweils dreimal erstellt. Die INT8-Werte sind der Mittelwert dieser drei Erstellungen. Für die Tabelle mit 8 CPUs wurde dieselbe INT8-Erstellung dreimal ausgeführt.
Intel Core Ultra CPU, GPU und NPU#
Diese Tabellen wurden auf drei Intel Core Ultra Prozessoren mit openvino 2026.2.1 im Benchmarkmodus gemessen: model.benchmark(data="coco128.yaml", format="openvino", device=...), wobei device auf cpu, xpu oder npu gesetzt wurde. Die Genauigkeit ist der mAP50-95-Wert auf dem COCO128-Dataset mit 128 Bildern und daher nicht mit den obigen Werten für COCO val2017 vergleichbar. PyTorch lief auf der CPU desselben Prozessors. YOLO26-Modelle laufen nur auf den NPUs der Intel Core Ultra 2xxV- und 3xx-Prozessorserien sowie neuerer Prozessoren.
Intel Core Ultra X7 358H#
Der Intel Core Ultra X7 358H (Panther Lake) vereint CPU-Kerne, eine integrierte Intel Arc GPU und eine Intel AI Boost NPU.
Millisekunden pro Bild, je niedriger, desto besser. Der schnellste Wert für jedes Modell ist fett hervorgehoben.
| Modell | PyTorch-CPU | CPU FP32 | CPU FP16 | CPU INT8 | GPU FP32 | GPU FP16 | GPU INT8 | NPU FP32 | NPU FP16 | NPU INT8 |
|---|---|---|---|---|---|---|---|---|---|---|
| YOLO26n | 29.28 | 14.35 | 14.23 | 9.99 | 4.09 | 4.03 | 4.24 | 7.68 | 7.71 | 8.60 |
| YOLO26s | 59.32 | 35.03 | 33.55 | 16.68 | 5.08 | 5.14 | 4.47 | 9.89 | 9.94 | 10.69 |
| YOLO26m | 143.21 | 90.53 | 88.82 | 33.33 | 7.10 | 7.06 | 5.61 | 13.02 | 13.13 | 14.84 |
| YOLO26l | 181.16 | 112.83 | 111.31 | 43.27 | 8.45 | 8.49 | 6.25 | 14.53 | 14.55 | 15.64 |
| YOLO26x | 379.75 | 241.21 | 236.87 | 78.92 | 13.03 | 12.98 | 8.74 | 23.48 | 23.41 | 21.56 |
Frühere Intel Core Ultra Prozessoren#
Intel Core Ultra 7 258V (Lunar Lake)
Millisekunden pro Bild, je niedriger, desto besser. Der schnellste Wert für jedes Modell ist fett hervorgehoben.
| Modell | PyTorch-CPU | CPU FP32 | CPU FP16 | CPU INT8 | GPU FP32 | GPU FP16 | GPU INT8 | NPU FP32 | NPU FP16 | NPU INT8 |
|---|---|---|---|---|---|---|---|---|---|---|
| YOLO26n | 27.33 | 16.84 | 16.73 | 8.62 | 3.33 | 3.34 | 3.46 | 23.71 | 23.70 | 23.96 |
| YOLO26s | 60.20 | 54.71 | 54.45 | 20.19 | 4.66 | 4.65 | 3.99 | 26.62 | 26.62 | 25.89 |
| YOLO26m | 152.87 | 178.59 | 179.25 | 53.07 | 9.03 | 8.98 | 5.70 | 32.94 | 33.01 | 30.95 |
| YOLO26l | 201.57 | 238.15 | 233.70 | 67.73 | 11.32 | 11.36 | 7.45 | 36.02 | 35.77 | 32.64 |
| YOLO26x | 431.04 | 567.22 | 561.39 | 151.11 | 19.08 | 19.63 | 13.69 | 49.64 | 49.69 | 41.75 |
Intel Core Ultra 7 155H (Meteor Lake)
Millisekunden pro Bild, je niedriger, desto besser. Der schnellste Wert für jedes Modell ist fett hervorgehoben.
| Modell | PyTorch-CPU | CPU FP32 | CPU FP16 | CPU INT8 | GPU FP32 | GPU FP16 | GPU INT8 |
|---|---|---|---|---|---|---|---|
| YOLO26n | 33.19 | 13.43 | 13.20 | 11.40 | 9.13 | 9.07 | 5.79 |
| YOLO26s | 70.92 | 36.16 | 36.07 | 15.54 | 16.37 | 16.65 | 9.27 |
| YOLO26m | 192.45 | 102.52 | 101.88 | 35.72 | 34.47 | 35.71 | 15.46 |
| YOLO26l | 239.19 | 129.24 | 128.50 | 45.38 | 43.24 | 43.40 | 19.72 |
| YOLO26x | 511.89 | 293.40 | 296.48 | 85.24 | 79.49 | 79.45 | 34.66 |
Auf allen drei Prozessoren:
- CPU: INT8 lief 1,2- bis 3,8-mal schneller als FP32 und 2,9- bis 6,0-mal schneller als PyTorch. FP32 lief auf dem X7 358H und dem 155H 1,6- bis 2,5-mal schneller als PyTorch, auf dem 258V bei YOLO26m, YOLO26l und YOLO26x jedoch langsamer als PyTorch.
- GPU: Die integrierte GPU führte FP32-Modelle 3,6- bis 29,1-mal schneller aus als PyTorch auf der CPU. Bei allen Modellen außer YOLO26n auf dem X7 358H und dem 258V war INT8 schneller als FP32, und zwar um bis zu das 2,3-Fache.
- NPU (X7 358H und 258V): FP32-Modelle liefen 1,2- bis 16,2-mal schneller als PyTorch auf der CPU, und INT8 lief 0,88- bis 1,19-mal so schnell wie FP32. Diese INT8-Modelle wurden exportiert, bevor
device=npusymmetrische Aktivierungen auswählte; daher zeigen die Tabellen nicht den für die NPU optimierten INT8-Export. - Die Latenz von FP16 lag auf allen Geräten innerhalb von 5 % der Latenz von FP32, und INT8 verlor 0,1 bis 2,7 Punkte bei mAP50-95.
Über OpenVINO#
OpenVINO, kurz für Open Visual Inference und Optimierung neuronaler Netze, konvertiert Modelle aus Frameworks wie PyTorch in sein IR-Format und führt sie über eine API auf Intel-CPUs, -GPUs und -NPUs aus. Die vollständige Referenz findest du in der OpenVINO-Dokumentation.
Ansehen: So exportierst du Ultralytics YOLO26 ins Intel OpenVINO-Format, um die Inferenz zu beschleunigen 🚀
Häufig gestellte Fragen#
Ja, auf der CPU. Das OpenVINO-Gerät
CPUläuft auf x86-64- und ARM64-Prozessoren: Die Server-CPU-Benchmarks auf dieser Seite wurden auf AMD-EPYC-Prozessoren gemessen, und derselbe Export läuft auf Apple-Chips. Die GeräteGPUundNPUbenötigen Intel-Hardware, daher greifendevice=xpuunddevice=npuauf anderen Rechnern mit einer Warnung auf eine Ausweichlösung zurück. Weitere Zielplattformen findest du im Leitfaden zu Modellbereitstellungsoptionen.Das hängt vom Gerät ab. FP16 (
quantize=16) benötigt keine Kalibrierungsdaten, halbiert die Modellgröße und behielt in den Benchmarks die Genauigkeit und Latenz von FP32 bei. Verwende FP16 also, wenn die Modellgröße wichtig ist. INT8 (quantize=8) erzielte bei den meisten Modellen die niedrigste CPU-Latenz: Auf der Server-CPU sank die Latenz von YOLO26s von 5,18 ms auf 4,51 ms pro Bild, bei 47,6 mAPval 50-95 gegenüber 48,5 bei FP32; auf Intel Core Ultra CPUs lief INT8 1,2- bis 3,8-mal schneller als FP32. Auf den integrierten Intel-GPUs fiel der INT8-Gewinn mit bis zu 2,3-mal geringer aus, und auf den NPUs waren die INT8-Modelle dieser Durchläufe, die ohnedevice=npuexportiert wurden, etwa so schnell wie FP32. INT8 benötigt repräsentative Kalibrierungsdaten. Überprüfe das INT8-Modell daher mit deinen eigenen Daten, bevor du dich dafür entscheidest.Exportiere mit
dynamic=Trueund übergib bei der Vorhersage den benötigten Stapel undimgsz. Die Bildgröße muss ein Vielfaches des Modell-Strides sein, bei den offiziellen YOLO26-Checkpoints außer für die Klassifizierung 32. Ausnahmen findest du unter Bereitstellung.Dynamischer Exportfrom ultralytics import YOLO model = YOLO("yolo26n.pt") model.export(format="openvino", dynamic=True) model = YOLO("yolo26n_openvino_model/") results = model(["https://ultralytics.com/images/bus.jpg"] * 4, imgsz=320) # ein Stapel mit 4 Bildern mit einer Größe von 320 PixelnVerwende OpenVINO, wenn die Zielhardware von Intel stammt:
device=xpuunddevice=npuwählen die Intel-GPU und -NPU aus, und INT8-OpenVINO-Modelle liefen auf Intel Core Ultra CPUs in den Benchmarks 1,2- bis 3,8-mal schneller als FP32. Verwende ONNX, wenn eine Datei auch auf NVIDIA- oder AMD-GPUs oder in anderen Laufzeitumgebungen als OpenVINO laufen muss. Unter Windows kann Windows ML Intel-Hardware für ein ONNX-Modell auswählen.
Kommentare23
Stell eine Frage, teile deine Ergebnisse oder hilf jemand anderem.
Heyujie96
how can i export a trained cls or obb kind model to openvino kind
EduardoNew
I encountered some difficulties while trying to run the official video demo. Here is my code:
from ultralytics import YOLO
def main(): # Load a YOLOv8n PyTorch model model = YOLO("yolov8n.pt")
# Export the model model.export(format="openvino") # creates 'yolov8n_openvino_model/' # Load the exported OpenVINO model with explicit task definition ov_model = YOLO("yolov8n_openvino_model\\", task='detect') # Explicitly define task as 'detect' # Run inference results_original = model("D:\\python_YOLO_test\\bus.jpg") # Run ov inference results_ov = ov_model("D:\\python_YOLO_test\\bus.jpg")if name == "main": main() Additional notes: My environment is openvino==2024.0.0, and I executed pip install --upgrade torch ultralytics.
The issue I encountered is as follows:
Results saved to D:\python_YOLO_test Ultralytics YOLOv8.2.57 🚀 Python-3.11.9 torch-2.1.1+cu118 CPU (11th Gen Intel Core(TM) i7-11800H 2.30GHz) YOLOv8n summary (fused): 168 layers, 3,151,904 parameters, 0 gradients, 8.7 GFLOPs
PyTorch: starting from 'yolov8n.pt' with input shape (1, 3, 640, 640) BCHW and output shape(s) (1, 84, 8400) (6.2 MB)
OpenVINO: starting export with openvino 2024.0.0-14509-34caeefd078-releases/2024/0... OpenVINO: export success ✅ 2.8s, saved as 'yolov8n_openvino_model' (12.3 MB)
Export complete (5.2s) Results saved to D:\python_YOLO_test Predict: yolo predict task=detect model=yolov8n_openvino_model imgsz=640
Validate: yolo val task=detect model=yolov8n_openvino_model imgsz=640 data=coco.yaml
Visualize: https://netron.appimage 1/1 D:\python_YOLO_test\bus.jpg: 640x480 4 persons, 1 bus, 1 stop sign, 324.0ms Speed: 24.0ms preprocess, 324.0ms inference, 21.0ms postprocess per image at shape (1, 3, 640, 480) Loading yolov8n_openvino_model for OpenVINO inference... Using OpenVINO LATENCY mode for batch=1 inference...
Process finished with exit code -1073741819 (0xC0000005)
Process finished with exit code -1073740791 (0xC0000409) The model was successfully exported but did not perform inference, instead, it terminated directly. How should I resolve this issue?
Glenn JocherUltralytics(bearbeitet)@EduardoNew the exit code 0xC0000005 often indicates a memory access violation. Let's address this step-by-step:
-
Path Format: Try using forward slashes in your OpenVINO model path:
"yolov8n_openvino_model/"instead of backslashes. -
OpenVINO Version: Ultralytics requires
openvino>=2024.0.0. Try upgrading to a recent release:
pip install -U openvino- Hardware Compatibility: Ensure you have the latest Intel drivers installed from Intel's official site.
If issues persist, please create a Minimum Reproducible Example and open a GitHub Issue following our bug report guidelines. We'll be happy to investigate further!
-
Ranjith3436
You mentioned that the core CPU inference model takes 23.53 ms. I would like to know if the processing time decreases when we increase the number of CPU cores ? currently i am using 12 thread CPU.
Glenn JocherUltralytics@Ranjith3436 increasing the number of CPU cores can potentially reduce processing time, as it allows for parallel processing, but the actual speedup will depend on the model's ability to leverage multi-threading effectively.
Ranjith3436
how do i can know about model's ability?
Glenn JocherUltralyticsTo assess a model's ability to utilize multiple CPU cores, you can check its support for multi-threading or parallel processing in the documentation or by running benchmarks on your hardware configuration.
kimchi2020
hey i am working on object detection in videos and came across openvino that helps in increasing speed. how can i use openvino and yolov8 together to find objects in a video
Glenn JocherUltralytics@kimchi2020 hi there! It's great to hear that you're exploring OpenVINO to enhance the speed of your object detection tasks in videos. OpenVINO can indeed provide significant performance improvements, especially on Intel hardware.
To get started with using YOLOv8 and OpenVINO together, follow these steps:
Exporting YOLOv8 to OpenVINO Format
-
Export the Model: You can export your YOLOv8 model to the OpenVINO format using the following Python code:
from ultralytics import YOLO # Load a YOLOv8n PyTorch model model = YOLO("yolov8n.pt") # Export the model to OpenVINO format model.export(format="openvino") # creates 'yolov8n_openvino_model/'Alternatively, you can use the CLI:
yolo export model=yolov8n.pt format=openvino # creates 'yolov8n_openvino_model/' -
Run Inference with the Exported Model: After exporting, you can run inference using the exported OpenVINO model. Here’s how you can do it in Python:
from ultralytics import YOLO # Load the exported OpenVINO model ov_model = YOLO("yolov8n_openvino_model/") # Run inference results = ov_model("https://ultralytics.com/images/bus.jpg")Or using the CLI:
yolo predict model=yolov8n_openvino_model source='https://ultralytics.com/images/bus.jpg'
Running Inference on Videos
To process videos, you can modify the inference code to read frames from a video file and run the model on each frame. Here’s an example in Python:
import cv2 from ultralytics import YOLO # Load the exported OpenVINO model model = YOLO("yolov8n_openvino_model/") # Open the video file video_path = "path/to/your/video.mp4" cap = cv2.VideoCapture(video_path) # Loop through the video frames while cap.isOpened(): ret, frame = cap.read() if not ret: break # Run inference on the frame results = model(frame) # Visualize the results on the frame annotated_frame = results[0].plot() # Display the annotated frame cv2.imshow("YOLOv8 OpenVINO Inference", annotated_frame) # Break the loop if 'q' is pressed if cv2.waitKey(1) & 0xFF == ord('q'): break # Release the video capture object and close the display window cap.release() cv2.destroyAllWindows()Additional Resources
For more detailed information and advanced usage, you can refer to the OpenVINO documentation. This guide covers everything from exporting models to running inference and optimizing performance.
Feel free to reach out if you have any more questions. Happy coding! 🚀
-
kimchi2020
Traceback (most recent call last): File "/home/kimchi/Desktop/yolov8/onnx.py", line 18, in results = model(frame) ^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/model.py", line 174, in call return self.predict(source, stream, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/model.py", line 442, in predict return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/predictor.py", line 168, in call return list(self.stream_inference(source, model, *args, **kwargs)) # merge list of Result into one ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 35, in generator_context response = gen.send(None) ^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/predictor.py", line 234, in stream_inference self.model.warmup(imgsz=(1 if self.model.pt or self.model.triton else self.dataset.bs, 3, *self.imgsz)) File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/nn/autobackend.py", line 626, in warmup import torchvision # noqa (import here so torchvision import time not recorded in postprocess time) ^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torchvision/init.py", line 6, in from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torchvision/models/init.py", line 2, in from .convnext import * File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torchvision/models/convnext.py", line 8, in from ..ops.misc import Conv2dNormActivation, Permute File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torchvision/ops/init.py", line 1, in from ._register_onnx_ops import _register_custom_op File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torchvision/ops/_register_onnx_ops.py", line 5, in from torch.onnx import symbolic_opset11 as opset11 File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torch/onnx/init.py", line 59, in from ._internal.onnxruntime import ( File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torch/onnx/_internal/onnxruntime.py", line 36, in import onnx File "/home/kimchi/Desktop/yolov8/onnx.py", line 18, in results = model(frame) ^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/model.py", line 174, in call return self.predict(source, stream, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/model.py", line 442, in predict return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/predictor.py", line 168, in call return list(self.stream_inference(source, model, *args, **kwargs)) # merge list of Result into one ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 35, in generator_context response = gen.send(None) ^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/engine/predictor.py", line 261, in stream_inference self.results = self.postprocess(preds, im, im0s) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/models/yolo/detect/predict.py", line 25, in postprocess preds = ops.non_max_suppression( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kimchi/Desktop/yolov8/myvenv/lib/python3.12/site-packages/ultralytics/utils/ops.py", line 291, in non_max_suppression i = torchvision.ops.nms(boxes, scores, iou_thres) # NMS ^^^^^^^^^^^^^^^ AttributeError: partially initialized module 'torchvision' has no attribute 'ops' (most likely due to a circular import). Did you mean: 'os'?
I am getting this error, how to get rid of it and what does it mean
Glenn JocherUltralyticsHi @kimchi2020,
Thank you for reaching out! The error you're encountering seems to be related to a circular import issue with the
torchvisionlibrary. This can happen if there's a naming conflict or an import loop in your code.Steps to Resolve the Issue:
-
Check for Naming Conflicts: Ensure that your script name (
onnx.py) is not conflicting with any library names. Rename your script to something unique, likerun_inference.py. -
Verify Installation: Make sure you have the latest versions of
torch,torchvision, andultralyticsinstalled. You can update them using:pip install --upgrade torch torchvision ultralytics -
Reproduce the Issue: If the issue persists, please provide a minimum reproducible example. This helps us diagnose the problem more effectively. You can refer to our guide on creating a reproducible example here: Minimum Reproducible Example.
Example Code for Inference with OpenVINO:
Here's a quick example of how to export your YOLOv8 model to OpenVINO and run inference on a video:
import cv2 from ultralytics import YOLO # Load a YOLOv8n PyTorch model model = YOLO("yolov8n.pt") # Export the model to OpenVINO format model.export(format="openvino") # creates 'yolov8n_openvino_model/' # Load the exported OpenVINO model ov_model = YOLO("yolov8n_openvino_model/") # Open the video file video_path = "path/to/your/video.mp4" cap = cv2.VideoCapture(video_path) # Loop through the video frames while cap.isOpened(): ret, frame = cap.read() if not ret: break # Run inference on the frame results = ov_model(frame) # Visualize the results on the frame annotated_frame = results[0].plot() # Display the annotated frame cv2.imshow("YOLOv8 OpenVINO Inference", annotated_frame) # Break the loop if 'q' is pressed if cv2.waitKey(1) & 0xFF == ord('q'): break # Release the video capture object and close the display window cap.release() cv2.destroyAllWindows()For more detailed information on exporting and using OpenVINO, please refer to our OpenVINO Integration Guide.
Feel free to reach out if you have any more questions or need further assistance. Happy coding! 🚀
-
YA12SHYAM
Hi @glenn-jocher , what if i want to use intel GPU's for the inference, using device=GPU doesn't seems to works , it looks for cuda i.e nvidia gpu
Glenn JocherUltralytics(bearbeitet)To use Intel GPUs for inference, export your YOLOv8 model to OpenVINO format with
model.export(format="openvino"), then run inference with the exported model and select the GPU withdevice="intel:gpu", for exampleov_model("bus.jpg", device="intel:gpu"). For more details, please refer to the OpenVINO integration guide.YA12SHYAM
ok, just to confirm i can't use ultralytics python api for inference with intel gpu like i usually do within the ultralytics ecosystem for example ?
from ultralytics import YOLO model = YOLO(path/to/model)here the path/to/model works with onnx, engine, opnevino;s xml , but it use cpu in case of openvino , i want to use my intel GPU
Glenn JocherUltralytics(bearbeitet)@YA12SHYAM to use Intel GPUs with YOLOv8, export your model to OpenVINO format and select the GPU at inference with
device="intel:gpu", e.g.model("bus.jpg", device="intel:gpu"). For detailed steps, refer to the OpenVINO integration guide.
kanishkasw
Hi Im getting the following error when attempting to convert the model to openVino. Tried with both 2024.1.0 and 2024.0.0. Im on ubuntu 20.04 with python 3.8 $ yolo export model=runs/classify/train/weights/best.pt format=openvino Ultralytics YOLOv8.2.31 🚀 Python-3.8.10 torch-2.3.1+cu121 CPU (Intel Core(TM) i9-7900X 3.30GHz) YOLOv8n-cls summary (fused): 73 layers, 1438723 parameters, 0 gradients, 3.3 GFLOPs
PyTorch: starting from 'runs/classify/train/weights/best.pt' with input shape (1, 3, 320, 320) BCHW and output shape(s) (1, 3) (2.8 MB) OpenVINO: export failure ❌ 0.0s: module 'openvino' has no attribute 'version' Traceback (most recent call last): File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/bin/yolo", line 8, in sys.exit(entrypoint()) File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/lib/python3.8/site-packages/ultralytics/cfg/init.py", line 591, in entrypoint getattr(model, mode)(**overrides) # default args from model File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/lib/python3.8/site-packages/ultralytics/engine/model.py", line 602, in export return Exporter(overrides=args, _callbacks=self.callbacks)(model=self.model) File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/lib/python3.8/site-packages/ultralytics/engine/exporter.py", line 308, in call f[3], _ = self.export_openvino() File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/lib/python3.8/site-packages/ultralytics/engine/exporter.py", line 142, in outer_func raise e File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/lib/python3.8/site-packages/ultralytics/engine/exporter.py", line 137, in outer_func f, model = inner_func(*args, **kwargs) File "/home/Kanishka/v5.0/YOLOV8_classification/.venv/lib/python3.8/site-packages/ultralytics/engine/exporter.py", line 454, in export_openvino LOGGER.info(f"\n{prefix} starting export with openvino {ov.version}...") AttributeError: module 'openvino' has no attribute 'version'
Paula DerrengerUltralytics(bearbeitet)@kanishkasw hi there,
Thank you for reaching out and providing detailed information about the issue you're encountering. It looks like you're experiencing an error when attempting to export your model to OpenVINO format. Let's work through this together.
First, let's ensure that you are using the latest versions of
torchandultralytics. Please run the following commands to update your packages:pip install --upgrade torch ultralyticsNext, it seems the error is related to the OpenVINO package. The error message
module 'openvino' has no attribute '__version__'suggests there might be an issue with the OpenVINO installation. Please make sure you have a recent version of OpenVINO installed (Ultralytics requiresopenvino>=2024.0.0). You can install it using the following command:pip install -U openvinoOnce you've updated the packages, try exporting the model again:
yolo export model=runs/classify/train/weights/best.pt format=openvinoIf the issue persists, could you please provide a minimum reproducible example? This will help us investigate the problem more effectively. You can find guidance on creating a minimum reproducible example here: Minimum Reproducible Example.
Additionally, here's a Python example to ensure everything is set up correctly:
from ultralytics import YOLO # Load a YOLOv8n PyTorch model model = YOLO("runs/classify/train/weights/best.pt") # Export the model to OpenVINO format model.export(format="openvino") # creates 'best_openvino_model/' # Load the exported OpenVINO model ov_model = YOLO("best_openvino_model/") # Run inference results = ov_model("https://ultralytics.com/images/bus.jpg")For more detailed instructions on using OpenVINO, please refer to our OpenVINO Integration Guide.
Feel free to reach out if you have any further questions or run into any other issues. We're here to help! 😊
renato-rodrig
hello everything is fine? I have a question about the results exposed in the article above. Is the time shown in the graphs in relation to the inference time that the model takes to return the detections or is it the time for image reading, image pre-processing and model inference? I ask this because on my computer (intel core i7 12 generation CPU) the yolov8n model ran with an inference time of 40ms and the gain from using OpenVINO was not that great.
Paula DerrengerUltralytics@renato-rodrig hello! 👋 Regarding your question about the times shown in the graphs, they typically refer to the total inference time, which includes the actual model inference as well as the time taken for pre-processing the input data (like image reading and resizing).
The difference you observed with OpenVINO on your Intel Core i7 may vary due to several factors such as the specific configuration of your system, the type of tasks being run, and the optimizations that the YOLOv8n model can leverage on that platform. Generally, OpenVINO tends to show more significant performance gains on integrated Intel GPUs and some specific CPU configurations.
If you haven't seen a major performance improvement, you might want to look into further tuning your OpenVINO deployment or explore using other optimization techniques provided by OpenVINO. Additionally, ensure all drivers and software components are up to date for optimal performance.
Here’s a quick example of ensuring you're using the model in the most optimized manner:
from ultralytics import YOLO # Load YOLOv8n PyTorch model model = YOLO('yolov8n.pt') # Export the model to OpenVINO model.export(format='openvino') # Creates 'yolov8n_openvino_model/' # Load the exported OpenVINO model ov_model = YOLO('yolov8n_openvino_model/') # Run inference to see if performance improves results = ov_model('https://ultralytics.com/images/bus.jpg')Feel free to experiment with different configurations and settings! 😊
1
YouROS12
I wanna do inferences with my exported pre-trained yolov8 model using Raspberry PI with a Neural Network Computing 2 (NCS2) plugged in.. but its doesn't support opset 11 or above.. only opset10.. I specified onnx opset to 10 and convert it to Openvino but it didn't work.
Anyway please to export openvino model directly in opset10 ? Does even yolov8 support this specified opset format ?
Thank you.
Glenn JocherUltralytics(bearbeitet)@YouROS12 the current OpenVINO export no longer goes through ONNX: Ultralytics converts the PyTorch model directly to OpenVINO IR with
openvino.convert_model, so the ONNXopsetargument does not apply and the oldmoModel Optimizer step isn't needed. Export with:from ultralytics import YOLO # Load a pretrained YOLOv8 model model = YOLO('yolov8n.pt') # Export the model to OpenVINO model.export(format='openvino') # creates 'yolov8n_openvino_model/'The export requires
openvino>=2024.0.0. If your target requires an older OpenVINO that cannot load these models, you can still trymodel.export(format='onnx', opset=10)and convert the ONNX file with that toolkit's own tools, but some YOLOv8 operations may not be supported in older opsets, which could lead to errors during export or inference.YouROS12
Where can I find documentation about YOLOv8's operations with opset 10 ? Updating OpenVINO toolkit is not an option because NCS2 works only at opset 10 and lower.
Paula DerrengerUltralytics@YouROS12 the documentation for ONNX opset versions and the operations they support can be found on the ONNX GitHub repository or the official ONNX documentation. However, there isn't specific documentation for YOLOv8's operations with opset 10, as this would be a combination of YOLOv8's implementation details and ONNX's opset specifications.
To check which operations are supported in opset 10, you can refer to the ONNX Operators documentation for that specific version. This documentation lists all the operators available in opset 10 and their details.
For YOLOv8, you would need to look at the model's architecture and identify which operations are used. Then, cross-reference these operations with the ONNX opset 10 documentation to see if they are supported. If certain operations are not supported in opset 10, you might need to modify the model or the export script to use alternative operations that are compatible with opset 10.
Since updating OpenVINO is not an option for you, if you find that YOLOv8 uses operations not supported in opset 10, you might need to consider using a different model architecture that is compatible with opset 10, or reach out to the community or Ultralytics for further assistance on how to proceed with your specific use case and hardware constraints.
