jzx-gooner / RK3588_YOLOV8_INFER

c++ infer and pybind11 for python usd

Repository from Github https://github.comjzx-gooner/RK3588_YOLOV8_INFERRepository from Github https://github.comjzx-gooner/RK3588_YOLOV8_INFER

RK3588_YOLOV8_INFER

优雅的RK3588模型推理方案,使用pybind11绑定c++

使用方式:
import sgai_yolo
import cv2
infer = sgai_yolo.Yolo("../yolov8s.float.rknn")

image = cv2.imread("../bus.jpg")
results = infer.commit(image)
for item in results:
    name,score,x,y,w,h = str(item.className),float(item.confidence),item.box.x,item.box.y,item.box.width,item.box.height
    print(name,score,x,y,w,h)
    cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)
    # 在框上方显示信息
    info = f'{name} ({score})'
    (text_width, text_height), _ = cv2.getTextSize(info, cv2.FONT_HERSHEY_SIMPLEX, 0.5, 1)
    cv2.putText(image, info, (x, y - 5), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 1)
cv2.imwrite('output_image.jpg', image)

About

c++ infer and pybind11 for python usd


Languages

Language:C++ 49.0%Language:C 47.9%Language:CMake 2.4%Language:Python 0.7%