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.1.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.1-py3-none-any.whl (38.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yoloonnxdet-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a888d584ebc5d862f9c9fb5ac187b0a05c52ba3a2cdd0f0b2e60fbac6549ae84
MD5 898e017679d2a2c743843957a3d812ad
BLAKE2b-256 244520ec9b6f6b3f37cd57a4a647e1342f98c53963d9bb69e40fce7a655bb524

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yoloonnxdet-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0e1662038aeb3229d73ff68a57a88859353aad44413e1cb4d3ac987168d7499
MD5 ac94d024bf9ab4e5e6bfd1d1acc00fc6
BLAKE2b-256 56f97b5ba872d296db956efa7a7bd6aeceeaffd2d8c3b1eedb51a5757d8f51b9

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