examples/cpp/OpenVINO/README.md
A single C++ application that runs every Ultralytics YOLO task and model generation with the Intel OpenVINO™ toolkit and OpenCV. Point it at an OpenVINO IR (.xml) or an .onnx file — the program reads the class names from the model and picks the right post-processing automatically.
.xml/.bin) and ONNX — the OpenVINO runtime reads both.task field, so the task is inferred from the output shapes and class-label count. Class names come from the IR rt_info (labels); models without that metadata fall back to the 80 COCO names in ../common.common/yolo_postprocess.hpp used by the other examples.| Dependency | Version |
|---|---|
| OpenVINO | >=2023.3 |
| OpenCV | >=4.5.0 |
| C++ | >=17 |
| CMake | >=3.12.0 |
yolo export model=yolo26n.pt imgsz=640 format=openvino # detect IR (also -seg / -pose / -obb / -cls / -sem)
yolo export model=yolo26n.pt imgsz=640 format=onnx # or ONNX, read directly by OpenVINO
YOLOv8 and YOLO11 grid models work too — the output layout is detected automatically.
See the Export documentation. The OpenVINO export produces a *_openvino_model/ directory containing the .xml, .bin, and metadata.
git clone https://github.com/ultralytics/ultralytics.git
cd ultralytics/examples/cpp/OpenVINO
mkdir build && cd build
cmake .. && cmake --build . --config Release
OpenVINO is found via find_package(OpenVINO) and the shared helpers in ../common are added to the include path automatically.
# Defaults: --model yolo26n.onnx --source bus.jpg --conf 0.25 --iou 0.45 --device AUTO --out result.jpg
./yolo_openvino --model yolo26n_openvino_model/yolo26n.xml --source bus.jpg
./yolo_openvino --model yolo26n-seg.onnx --source bus.jpg --out seg.jpg
./yolo_openvino --model yolo26n-pose.onnx --source bus.jpg --show
| Argument | Default | Description |
|---|---|---|
--model | yolo26n.onnx | OpenVINO IR (.xml) or ONNX (.onnx) model. |
--source | bus.jpg | Input image. |
--conf | 0.25 | Confidence threshold. |
--iou | 0.45 | NMS IoU threshold (grid models only). |
--device | AUTO | OpenVINO device: AUTO, CPU, or GPU. |
--out | result.jpg | Output image path. |
--show | off | Also open a display window. |
The annotated result is always written to --out and the detections are printed to the console. The detected task is shown at startup, e.g. Model: yolo26n.xml | task: detect | classes: 80.
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the main Ultralytics repository.