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.5.0.tar.gz (4.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.5.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yolonnx-0.5.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yolonnx-0.5.0.tar.gz
Algorithm Hash digest
SHA256 662eeabe644adcfba7a988b8babdd73e4ac6a173a51d11ae0cf3122f63bf8235
MD5 985469affc2233e400e49d3c4a7bbca4
BLAKE2b-256 4d174eef703a170e65d317f8d06a8f7ecf35edc069b6d766fac448bc5305af08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yolonnx-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yolonnx-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecd9af1bc6015500bfcb6112bdbcaaf3929371ca20458e6cc1da4435ee922d35
MD5 6d94a86eb7f09076c4ddda84f450f579
BLAKE2b-256 a98afe8fb77269f079275cb43a2b33432f2c6341f0eeb405750bd68169772393

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