yolov5 onnx推理报错

运行yolov5推理onnx文件时报错:

onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: images for the following indices
 index: 0 Got: 1 Expected: 16
 Please fix either the inputs or the model.

onnxruntime运行出错:

        预期获取16,实际获取1

yolov5 .pt文件转.onnx文件

解决方案:

        yolov5中export.py导出.onnx文件

  parser.add_argument('--include',

将输出模型改为ONNX即可运行export.py自动导出文件

detedt.py文件运行onnx推理报错

onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: images for the following indices
 index: 0 Got: 1 Expected: 16
 Please fix either the inputs or the model.

原因:.pt转.onnx文件时batch_size=16,尺寸太大,修改batch_size=1,重新导出onnx文件,重新运行detect.py成功解决报错:

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值