Metadata-Version: 2.3
Name: yolonnx
Version: 0.3.1
Summary: This package lets you run your YOLOv8 detection and classification models using ONNXRuntime.
Keywords: ONNX,YOLOv8,onnxruntime,vision
Author: Kasper Fromm Pedersen
Author-email: Kasper Fromm Pedersen <kasperf@cs.aau.dk>
License: MIT
Requires-Dist: numpy==1.26.*
Requires-Dist: aau-label==0.*
Requires-Python: >=3.10, <3.14
Project-URL: homepage, https://www.cs.aau.dk/
Project-URL: repository, https://github.com/fromm1990/yolonnx
Description-Content-Type: text/markdown

# You Only Look ONNX
This repository is a light weight library to ease the use of ONNX models exported by the Ultralytics YOLOv8 framework.

## Example Detector Usage
```python
from pathlib import Path

from onnxruntime import InferenceSession
from PIL import Image

from yolonnx.services import Detector
from yolonnx.to_tensor_strategies import PillowToTensorContainStrategy

model = Path("path/to/file.onnx")
session = InferenceSession(
    model.as_posix(),
    providers=[
        "CUDAExecutionProvider",
        "CPUExecutionProvider",
    ],
)

# For backward compatibility reasons the Yolo8ModelOutputParser is used by default
predictor = Detector(session, PillowToTensorContainStrategy(), ModelOutputParser=Yolo26ModelOutputParser())
img = Image.open("path/to/image.jpg")
print(predictor.run(img))
```

## Example Classifier Usage
```python
from pathlib import Path

from onnxruntime import InferenceSession
from PIL import Image

from yolonnx.services import Classifier
from yolonnx.to_tensor_strategies import PillowToTensorContainStrategy

model = Path("path/to/file.onnx")
session = InferenceSession(
    model.as_posix(),
    providers=[
        "CUDAExecutionProvider",
        "CPUExecutionProvider",
    ],
)

predictor = Classifier(session, PillowToTensorContainStrategy())
img = Image.open("path/to/image.jpg")
print(predictor.run(img))

```