convert-the-model-to-rknn/001导出onnx模型_0.py
2025-08-15 10:24:30 +08:00

19 lines
563 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from ultralytics import YOLO
'''
yolo官方导出的onnx模型转换为rknn模型后并不能使用.
'''
# 加载模型
model = YOLO("/home/admin-root/haotian/rk3588/pytorch模型转rknn/models/yolov8m.pt")
# 导出 ONNX关键参数
model.export(
format="onnx",
imgsz=(640, 640), # 固定输入尺寸
opset=12, # ONNX 算子版本 >=12
simplify=True, # 简化模型
dynamic=False, # 禁用动态轴
nms=False, # 移除输出端的 NMS 层RKNN 不支持)
)
# yolo导出的模型