> This is the documentation for LibreYOLO 1.6.0. Current version: https://www.libreyolo.com/docs/export/openvino

# OpenVINO
OpenVINO IR is Intel's runtime format, a model.xml graph beside a model.bin weight blob. LibreYOLO exports an ONNX intermediate, converts it with ov.convert_model, and writes a metadata.yaml into the same directory.
Verified against LibreYOLO v1.5.0.

## Install

**Install**

```bash
# The IR is converted from an ONNX intermediate, so both extras are needed.
pip install "libreyolo[onnx,openvino]"
```

**INT8 additionally needs NNCF**

```bash
pip install nncf
```

The conversion goes through an ONNX intermediate, so the `onnx` extra is part of
the requirement rather than an optional companion. NNCF is a separate install and
is only needed for `int8=True`.

## Export

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("LibreYOLO9t.pt")

# Writes the directory weights/LibreYOLO9t_openvino
path = model.export(format="openvino")
print(path)
```

**CLI**

```bash
libreyolo export --model LibreYOLO9t.pt --format openvino
```

**Arguments**

```python
model.export(
    format="openvino",
    imgsz=640,
    batch=1,
    dynamic=False,    # True keeps a dynamic batch axis through the IR
    half=False,       # True stores FP16 weights
    int8=False,       # True runs NNCF post-training quantization
    data=None,        # required when int8=True
    output_path=None, # None writes weights/<stem>_openvino
)
```

The artifact is a directory, not a file. `weights/LibreYOLO9t_openvino` holds
`model.xml`, `model.bin` and `metadata.yaml`, and `_fp16` is inserted before the
suffix when `half=True`. Move or copy the whole directory; the three files are one
artifact.

`half=True` sets `compress_to_fp16` on save. That is weight compression in the IR,
not a change to the inference precision the device chooses at run time.

### INT8

**INT8 with calibration data**

```python
from libreyolo import LibreYOLO

LibreYOLO("LibreYOLO9t.pt").export(
    format="openvino",
    int8=True,
    data="coco128.yaml",   # required: there is no default for this format
    fraction=1.0,
)
```

`int8=True` runs NNCF post-training quantization over a LibreYOLO calibration
loader with the mixed preset, and `data` is mandatory: this format has no
eight-image fallback. Missing NNCF raises an `ImportError` naming the install
command.

## Run the artifact

**Through LibreYOLO**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("weights/LibreYOLO9t_openvino")
result = model.predict(SAMPLE_IMAGE)
print(result.boxes.xyxy[:3])
```

**Select the device**

```python
from libreyolo import LibreYOLO

# "auto" and "cpu" map to CPU, "gpu" and "cuda" map to GPU,
# anything else is passed through uppercased, for example "npu" -> NPU.
model = LibreYOLO("weights/LibreYOLO9t_openvino", device="gpu")
```

**Bare OpenVINO**

```python
import numpy as np
import openvino as ov
import yaml

core = ov.Core()
print(core.available_devices)

compiled = core.compile_model("weights/LibreYOLO9t_openvino/model.xml", "CPU")
outputs = compiled(np.zeros((1, 3, 640, 640), dtype=np.float32))
print([tensor.shape for tensor in outputs.values()])

# Class names, task and input size live in metadata.yaml beside the IR.
meta = yaml.safe_load(open("weights/LibreYOLO9t_openvino/metadata.yaml"))
print(meta["model_family"], meta["task"], meta["names"])

# Preprocessing and postprocessing are yours on this path.
```

`LibreYOLO()` recognizes any directory containing `model.xml` and returns the same
`Results` object as the checkpoint, reading class names, task, input size and
pose schema from `metadata.yaml`.

The device string is mapped rather than passed straight through. `auto` and `cpu`
both compile for CPU, `gpu` and `cuda` both compile for GPU, and any other value
is uppercased and handed to OpenVINO, which is how an NPU target is reached.

The third snippet is for readers with no LibreYOLO installed. Preprocessing,
decoding, NMS and coordinate rescaling become yours there, and the class names
only exist in `metadata.yaml`.

## Constraints

An IR without its `metadata.yaml` still loads, but the backend then falls back to
80 classes and the detection task, which is wrong for anything else. Keep the
directory intact.

Blocked before tracing: YOLO9 segmentation, RTMDet-Ins segmentation, SSD,
Faster R-CNN and RetinaNet detection, and BiRefNet or FeyNobg matting, where
OpenVINO 2026.2 cannot lower the shared matte decoder's standard ONNX
`DeformConv-19` operation.

Where a combination is neither validated nor blocked, the converter path is
available and the project has not recorded OpenVINO runtime parity for it. Several
combinations are validated with an explicit context attached, for example
DeepLabV3 semantic segmentation at a fixed 520 by 520 input on OpenVINO 2026.2
with the CPU default inference precision, and L2CS gaze at a fixed 448 by 448
face crop. `libreyolo formats` prints that context per combination.

For the full family and task grid, see
[the export matrix](/docs/v1.6.0/reference/export-matrix). For one combination:

**Check one family and task before exporting**

```bash
libreyolo formats --family yolo9 --task detect
```
