Skip to main content

A Python package for yolo onnx model detect.

Project description

YoloOnnxDet

项目简介

YoloOnnxDet 是一个基于 ONNX 和 C++ DLL 的目标检测 Python 封装,支持高效的图片检测,支持单线程和多线程推理。

依赖环境

  • Python 3.8+
  • numpy
  • opencv-python
  • ONNX 格式的模型文件

安装依赖:

pip install numpy opencv-python

快速开始

  1. 准备好 OnnxDet.dll 和 ONNX 模型文件。
  2. 单线程检测示例:
from YoloOnnxDet import ST_Detector
import cv2

det = ST_Detector("your_model.onnx", names=["class1", "class2"], conf_threshold=0.3, iou_threshold=0.5)
image = cv2.imread("your_image.png")
boxes, scores, class_ids = det.detect(image)
print(boxes, scores, class_ids)
  1. 多线程检测示例(需先启用多线程功能):
from YoloOnnxDet import MT_Detector, DevFeature
import cv2

DevFeature.EnableMultithreaded = True
names = ["class1", "class2"]
det = MT_Detector("your_model.onnx", names=names, conf_threshold=0.3, iou_threshold=0.5, workers=4)
image = cv2.imread("your_image.png")
task_id = det.submit_task(image)
det.wait_for_task_completion(task_id)
results = det.get_result(task_id)
print(results)

资源监控

可通过 get_pool_status() 获取多线程池状态,包括队列长度、活跃线程数等。

资源释放

建议在检测结束后调用 cleanup() 方法释放资源。

其他说明

  • 多线程检测为开发功能,稳定性有限。
  • 支持自定义类别名(names 参数)。
  • 需保证 DLL 文件与 Python 文件在同一目录或已配置环境变量。

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

yoloonnxdet-0.1.3.tar.gz (38.0 MB view details)

Uploaded Source

Built Distribution

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

yoloonnxdet-0.1.3-py3-none-any.whl (38.1 MB view details)

Uploaded Python 3

File details

Details for the file yoloonnxdet-0.1.3.tar.gz.

File metadata

  • Download URL: yoloonnxdet-0.1.3.tar.gz
  • Upload date:
  • Size: 38.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for yoloonnxdet-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ef2a5aef807ae54514f5cf962936b34b4841998d3b74e5d171ecd5673952e318
MD5 f78a3a4b02e14945c5d92d00a67b771c
BLAKE2b-256 2af377926b448886cab64c71247c044aa9dcac92584da9f77f407912ce0e33e5

See more details on using hashes here.

File details

Details for the file yoloonnxdet-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: yoloonnxdet-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 38.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for yoloonnxdet-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 45bc3f44fb93a1bc902bdb89913c3d9c49162b379b2094ce675eaf7ba27a9452
MD5 f1c66c8c44c9e93287432d63f70e3d11
BLAKE2b-256 5e8209d96233d083f8df95237b736721b4312111edc3e7b8c1a82b415b8e9543

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