最近在学习训练yolov5模型,但在导出onnx格式文件总是出错,参考了很多文章都是采用直接运行export.py文件,但我确只导出了torchscript格式文件
python export.py --weights runs/train/exp/weights/best.pt
我运行以上代码,导出的只有 torchscript格式文件,并没有其他人写的onnx格式文件,最后我上github的查看官方的文档,发现导出语句已经进行更改如下
python export.py --weights yolov5s-seg.pt --include onnx engine --img 640 --device 0
我自己进行尝试:
python export.py --weights runs/train/exp/weights/best.pt --include onnx engine
成功解决问题导出了best.onnx文件!再此记录一下!