MindSpore Lite在Windows环境下模型转换工具使用(将onnx、caffe等其它AI框架的模型文件转成ms)
转载地址:https://bbs.huaweicloud.com/forum/thread-106965-1-1.html作者:李响邮箱:lixiang97@huawei.com注:当前MindSpore1.1.1版本与其模型转换工具最新版本1.1.0不是很匹配,如发生冲突,需要MindSpore降级到1.1.0,具体可参考本人的干货分享:https://bbs.huaweicloud.com/f
转载地址:https://bbs.huaweicloud.com/forum/thread-106965-1-1.html
作者:李响
邮箱:lixiang97@huawei.com
注:当前MindSpore1.1.1版本与其模型转换工具最新版本1.1.0不是很匹配,如发生冲突,需要MindSpore降级到1.1.0,具体可参考本人的干货分享:https://bbs.huaweicloud.com/forum/forum.php?mod=viewthread&tid=106101
正文:
1 获取MindSpore Lite的模型转换工具,获取链接:https://www.mindspore.cn/tutorial/lite/zh-CN/master/use/downloads.html
2 MindSpore Lite模型转换工具提供了多种参数设置,用户可根据需要来选择使用。此外,用户可输入./converter_lite --help获取实时帮助,此外--fmk=<FMK>是输入模型的原始格式,--modelFile=<MODELFILE>是输入模型的路径,--outputFile=<OUTPUTFILE>是输出模型的路径,不需加后缀,可自动生成.ms
后缀,以上三个参数是必选参数,--weightFile=<WEIGHTFILE>是转换Caffe模型时必选参数,含义是输入模型weight文件的路径。
3 打印日志的使用方法:set GLOG_v=1,0代表DEBUG,1代表INFO,2代表WARNING,3代表ERROR;
4 将其它AI框架转成MindSpore模型的实例:
(1) 将MINDIR转ms
call converter_lite --fmk=MINDIR --modelFile=model.mindir --outputFile=model
(2)将TensorFlow Lite模型转ms
call converter_lite --fmk=TFLITE --modelFile=model.tflite --outputFile=model
(3)将TensorFlow模型转ms
call converter_lite --fmk=TF --modelFile=model.pb --outputFile=model
(4)将ONNX模型转ms
call converter_lite --fmk=ONNX --modelFile=model.onnx --outputFile=model
上述四个命令如果出现下面的回显,说明转ms成功,否则失败,失败的回显会有对应的错误码,可参考https://www.mindspore.cn/tutorial/lite/zh-CN/master/use/converter_tool.html#id3
CONVERTER RESULT SUCCESS:0
更多推荐
所有评论(0)