This commit is contained in:
duoduo 2022-07-03 22:21:36 +08:00
parent 9022a9dc25
commit 599c80fa9f

View File

@ -1,4 +1,5 @@
import cv2
import time
import numpy as np
import onnxruntime
@ -119,14 +120,19 @@ if __name__ == '__main__':
# 加载模型
session = onnxruntime.InferenceSession('FastestDet.onnx')
# 目标检测
start = time.perf_counter()
bboxes = detection(session, img, input_width, input_height, 0.8)
end = time.perf_counter()
time = (end - start) * 1000.
print("forward time:%fms"%time)
# 加载label names
names = []
with open("coco.names", 'r') as f:
for line in f.readlines():
names.append(line.strip())
print("=================box info===================")
for b in bboxes:
print(b)
obj_score, cls_index = b[4], int(b[5])