Skip to main content

This package lets you run your YOLOv8 detection and classification models using ONNXRuntime.

Project description

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

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",
    ],
)

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

Example Classifier Usage

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))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yolonnx-0.2.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yolonnx-0.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file yolonnx-0.2.0.tar.gz.

File metadata

  • Download URL: yolonnx-0.2.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.12.3 Windows/11

File hashes

Hashes for yolonnx-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1a5a5e503f4971000415cced87eefe458d688c3cef613af60838756e65144fbe
MD5 3295060129a18645fce64e06516a0c2f
BLAKE2b-256 0ee7394d7c3bdd7e86be0c1ea473d1879114d068eed34017c50beb2d4b53b600

See more details on using hashes here.

File details

Details for the file yolonnx-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: yolonnx-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.12.3 Windows/11

File hashes

Hashes for yolonnx-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb4fff3e7631a0a8956850ea27d44b6fb198565a47cfe22317a6c616fd09a42b
MD5 f0d5794cdfe1b880ab6586bb3584cf71
BLAKE2b-256 44aa531c222764914e2b8de9ff1158cb157f49c5ac178d3f66e26582e4a2db85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page