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

Uploaded Python 3

File details

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

File metadata

  • Download URL: yoloonnxdet-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 94c53412b236aca0461cf9b1fe54cc80ddbc68fef43f4d724026f1b12b3cbec9
MD5 3d92509e41f81a988930c935c88e705e
BLAKE2b-256 6b39a4b97ecb048e49f2b94b9cbfbc3aa603ae726adadae37477d4bdd0668019

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yoloonnxdet-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c0b9f7fd8ae291e3a6bcff2d8b2900c588b212a9bbf979d33c521c3e95e53e70
MD5 c01b0610686d9753cbf60d9c4e4c923b
BLAKE2b-256 2552f0ed6ef0c6056e76c84a3f726dd90fab2a19052a55a68d36d306f6253f2f

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