simple yolov5 wrapper for detect(onnx, dnn, openvino)
Project description
YOLOv5 detect
🚀simple yolov5 wrapper for detect(onnx, dnn, openvino)
Installation
pip install yolov5-detect
Example
import cv2
from pathlib import Path
from yolov5detect import detect, annotation
output = Path("output dir")
if not output.exists():
output.mkdir()
yolo = detect.YoloDetect("test.onnx", "test.yaml", 1000)
names = yolo.get_names()
root = Path("images dir")
for item in root.rglob("*.jpg"): # detect all images and save label results
img = cv2.imread(str(item))
det = yolo.detect(img.copy(), 0.4)
if len(det) > 0:
annotator = annotation.Annotator(img.copy())
for *xyxy, conf, cls in det:
annotator.box_label(xyxy, f"{names[int(cls)]} {conf:.2f}")
cv2.imwrite(annotator.result(), str(output / item.name))
Reference
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yolov5-detect-0.1.17.tar.gz
(78.8 kB
view hashes)
Built Distribution
yolov5_detect-0.1.17-py3-none-any.whl
(112.8 kB
view hashes)
Close
Hashes for yolov5_detect-0.1.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aa88a43bd60cc21c72a33dd8c66b162ca6335d4b8a280e9e802ad39a0dea982 |
|
MD5 | 9af64ed8e96dc0168b29ce0b1199f728 |
|
BLAKE2b-256 | a3b589b212a1094d1f0de3590819d9e67d1ed65090a723a71a328db965ab292d |