赞
踩
参考:https://github.com/hpc203/yolov5-lite-onnxruntime
https://github.com/hpc203/yolov5-dnn-cpp-python
import cv2 import numpy as np import argparse import onnxruntime as ort import math class yolov5_lite(): def __init__(self, model_pb_path, label_path, confThreshold=0.5, nmsThreshold=0.5, objThreshold=0.5): so = ort.SessionOptions() so.log_severity_level = 3 self.net = ort.InferenceSession(model_pb_path, so) self.classes = list(map(lambda x: x.strip(), open(label_path, 'r').readlines())) self.num_classes = len(self.classes) anchors = [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]] self.nl = len(anchors) self.na = len(anchors[0]) // 2 self.no = self.num_classes + 5 self.grid = [np.zeros(1)] * s
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。