onnx转mnn

本文介绍了一个使用Python脚本将ONNX模型转换为MNN格式的问题案例。主要探讨了转换过程中出现的警告信息及错误,并给出了具体的错误日志。错误包括Python指令的警告和protobuf解析错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

python mnn1.1.4

cmd_dtr 是转换指令

 

注释的代码是调用MNNConvert.exe进行转换,这个是1.0.0版本的mnn,可以用

 

import os


def onnx2mnn(onnx_name,mnnname):

    cmd_dtr="python -m MNN.tools.mnnconvert -f ONNX --modelFile "+onnx_name+"  --MNNModel "+mnnname+" --bizCode MNN"
    print(cmd_dtr)
    # cmd_dtr=r"E:\MNN\MNN\Windows\MNN_Windows_tools\MNNConvert -f ONNX --modelFile "+onnx_name+" --MNNModel "+mnnname+" --bizCode MNN"
    res_str= os.popen(cmd_dtr).read()

    print(res_str)
    if "Converted Done" in res_str:
        print("Converted ok")

 

python开头的是python指令,现在是报错:

RuntimeWarning: 'MNN.tools.mnnconvert' found in sys.modules after import of package 'MNN.tools', but prior to execution of 'MNN.tools.mnnconvert'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version
[libprotobuf ERROR C:\Users\mnnteam\Desktop\protobuf\src\google\protobuf\message_lite.cc:133] Can't parse message of type "MNN.Compression.Pipeline" because it is missing required fields: version

版本是1.1.4,错误原因还未知

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI算法网奇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值