YOLOV8训练好的torch模型转换成ONNX、OM格式

发布时间:2026/5/20 5:46:49

YOLOV8训练好的torch模型转换成ONNX、OM格式 一、pt 转 ONNX 格式from ultralytics import YOLO model YOLO(runs/detect/train/weights/best.pt) # load a custom trained model model.export(formatonnx, dynamicFalse, simplifyTrue, opset11)注意export中的参数 opset11指定导出的ONNX模型版本版本。版本太高可能会在下一步ONNX转 om 时报错报错如下二、ONNX 模型转 om 格式前提需要自己下好CANN安装包安装教程快速安装CANN-从这里开始-CANN社区版8.0.RC2.alpha003开发文档-昇腾社区 (hiascend.com)https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/80RC2alpha003/quickstart/quickstart/quickstart_18_0005.html按照以下设置为例子atc --modelbest.onnx --framework5 --outputbest --input_shapeimages:1,3,640,640 --soc_versionAscend310--model参数为onnx模型的路径--output参数为导出模型的路径--soc_version你的处理器型号--framework“5” 表示ONNX格式出现以下提示表示成功ATC run success, welcome to the next use.

相关新闻