Skip to content

Latest commit

 

History

History
104 lines (68 loc) · 3.2 KB

File metadata and controls

104 lines (68 loc) · 3.2 KB

YOLO26 Detection C++ Inference with ExecuTorch

This example demonstrates how to perform inference of YOLO26 family detection models in C++ leveraging the Executorch backends:

Instructions

Step 1: Install ExecuTorch

To install ExecuTorch, follow this guide.

Step 2: Install the backend of your choice

NOTE: Please install the OpenVINO nightly version that supports the YOLO26 model.

python -m pip install --pre openvino==2026.1.0.dev20260131 --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly

Step 3: Install the demo requirements

Python Demo Requirements

The demo requires the ultralytics package, which depends on torch and torchvision. Since these packages are already installed as dev dependencies, use --upgrade-strategy only-if-needed to avoid version conflicts:

python -m pip install --upgrade-strategy only-if-needed --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt

Step 4: Export the YOLO26 model to the ExecuTorch

OpenVINO:

python export_and_validate.py --model_name yolo26s --input_dims=[1920,1080]  --backend openvino --device CPU

OpenVINO quantized model:

python export_and_validate.py --model_name yolo26s --input_dims=[1920,1080]  --backend openvino --quantize --video_path /path/to/calibration/video --device CPU

XNNPACK:

python export_and_validate.py --model_name yolo26s --input_dims=[1920,1080] --backend xnnpack

Exported model could be validated using the --validate key:

python export_and_validate.py --model_name yolo26s --backend ... --validate dataset_name.yaml

A list of available datasets and instructions on how to use a custom dataset can be found here. Validation only supports the default --input_dims; please do not specify this parameter when using the --validate flag.

To get a full parameters description please use the following command:

python export_and_validate.py --help

Step 5: Build the demo project

OpenVINO:

cd examples/models/yolo26
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_OPENVINO_BACKEND=ON ..
make -j$(nproc)

XNNPACK:

cd examples/models/yolo26
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_XNNPACK_BACKEND=ON ..
make -j$(nproc)

Step 6: Run the demo

./build/Yolo26DetectionDemo -model_path /path/to/exported/model -input_path /path/to/video/file -output_path /path/to/output/annotated/video

To get a full parameters description please use the following command:

./build/Yolo26DetectionDemo --help

Credits

Ultralytics examples: https://github.com/ultralytics/ultralytics/tree/main/examples