hpc203 / yolov5-dnn-cpp-python

用opencv的dnn模块做yolov5目标检测,包含C++和Python两个版本的程序

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

run convert_onnx.py , I get the warning TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! route = F.interpolate(xRt3, size=(int(xRt3.shape[2] * 2), int(xRt3.shape[3] * 2)), mode='nearest')

xuwei1119 opened this issue · comments

Then when I infer the *.onnx by above, I get :
cannot reshape array of size 1632000 into shape (1,3,6,80,80)
cannot reshape array of size 408000 into shape (1,3,6,40,40)
cannot reshape array of size 102000 into shape (1,3,6,20,20)
Use YOLOV5 v3.1 yolov5s.pt file.

Then when I infer the *.onnx by above, I get :
cannot reshape array of size 1632000 into shape (1,3,6,80,80)
cannot reshape array of size 408000 into shape (1,3,6,40,40)
cannot reshape array of size 102000 into shape (1,3,6,20,20)
Use YOLOV5 v3.1 yolov5s.pt file.

你的网络的类别数量是6,在convert_onnx.py中默认是coco数据集的80类,因此你需要修改num_classes=6