Yolov5 输出 onnx 模型配置
Yolov5 输出 onnx 模型配置
修改./models/yolo.py
找到forward函数定义,替换全部函数为
def forward(self, x): |
修改./export.py
shape = tuple((y[0] if isinstance(y, tuple) else y).shape) # model output shape |
改为
shape = tuple((y[0] if isinstance(y, tuple) else y)) # model output shape |
输出onnx模型指令
python export.py --weights yolov5s.pt --img 640 --batch 1 --include onnx |