Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
docs
提交
92408c16
D
docs
项目概览
MindSpore
/
docs
通知
5
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
You need to sign in or sign up before continuing.
提交
92408c16
编写于
8月 28, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
!771 Update Convertor tools docs in windows enviroment
Merge pull request !771 from liuwenhao/master
上级
7806a763
e30fa5af
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
94 addition
and
9 deletion
+94
-9
lite/tutorials/source_zh_cn/deploy.md
lite/tutorials/source_zh_cn/deploy.md
+3
-1
lite/tutorials/source_zh_cn/use/converter_tool.md
lite/tutorials/source_zh_cn/use/converter_tool.md
+91
-8
未找到文件。
lite/tutorials/source_zh_cn/deploy.md
浏览文件 @
92408c16
...
...
@@ -143,7 +143,9 @@ tar -xvf mindspore-lite-0.7.0-runtime-x86-cpu.tar.gz
-
编译依赖(基本项)
-
[
CMake
](
https://cmake.org/download/
)
>= 3.14.1
-
[
GCC
](
https://gcc.gnu.org/releases.html
)
>= 7.3.0
-
[
MinGW GCC
](
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-posix/seh/x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z/download
)
>= 7.3.0
-
[
Python
](
https://www.python.org/
)
>= 3.7.5
-
[
Git
](
https://git-scm.com/downloads
)
>= 2.28.0
### 编译选项
...
...
lite/tutorials/source_zh_cn/use/converter_tool.md
浏览文件 @
92408c16
...
...
@@ -4,10 +4,16 @@
-
[
模型转换工具
](
#模型转换工具
)
-
[
概述
](
#概述
)
-
[
环境准备
](
#环境准备
)
-
[
参数说明
](
#参数说明
)
-
[
模型可视化
](
#模型可视化
)
-
[
使用示例
](
#使用示例
)
-
[
Linux环境使用说明
](
#linux环境使用说明
)
-
[
环境准备
](
#环境准备
)
-
[
参数说明
](
#参数说明
)
-
[
模型可视化
](
#模型可视化
)
-
[
使用示例
](
#使用示例
)
-
[
Windows环境使用说明
](
#windows环境使用说明
)
-
[
环境准备
](
#环境准备-1
)
-
[
参数说明
](
#参数说明-1
)
-
[
模型可视化
](
#模型可视化-1
)
-
[
使用示例
](
#使用示例-1
)
<!-- /TOC -->
...
...
@@ -19,7 +25,9 @@ MindSpore Lite提供离线转换模型功能的工具,支持多种类型的模
目前支持的输入格式有:MindSpore、TensorFlow Lite、Caffe和ONNX。
## 环境准备
## Linux环境使用说明
### 环境准备
使用MindSpore Lite模型转换工具,需要进行如下环境准备工作。
...
...
@@ -27,7 +35,7 @@ MindSpore Lite提供离线转换模型功能的工具,支持多种类型的模
-
运行:参考部署文档中的
[
输出件说明
](
https://www.mindspore.cn/lite/tutorial/zh-CN/master/deploy.html#id4
)
,获得
`converter`
工具,并配置环境变量。
## 参数说明
##
#
参数说明
使用
`./converter_lite <args>`
即可完成转换,同时提供了多种参数设置,用户可根据需要来选择使用。
此外,用户可输入
`./converter_lite --help`
获取实时帮助。
...
...
@@ -46,13 +54,13 @@ MindSpore Lite提供离线转换模型功能的工具,支持多种类型的模
> - 参数名和参数值之间用等号连接,中间不能有空格。
> - Caffe模型一般分为两个文件:`*.prototxt`模型结构,对应`--modelFile`参数;`*.caffemodel`模型权值,对应`--weightFile`参数。
## 模型可视化
##
#
模型可视化
模型可视化工具提供了一种查验模型转换结果的方法。用户可使用Json命令生成
`*.json`
文件,与原模型相对比,确定转化效果。
TODO: 此功能还在开发中。
## 使用示例
##
#
使用示例
首先,在源码根目录下,输入命令进行编译,可参考
`deploy.md`
。
```
bash
...
...
@@ -104,3 +112,78 @@ bash build.sh -I x86_64
```
你可以选择使用模型打印工具,可视化查验上述转化后生成的MindSpore Lite模型。本部分功能开发中。
## Windows环境使用说明
### 环境准备
使用MindSpore Lite模型转换工具,需要进行如下环境准备工作。
-
编译:模型转换工具代码在MindSpore源码的
`mindspore/lite/tools/converter`
目录中,参考部署文档中的
[
环境要求
](
https://www.mindspore.cn/lite/docs/zh-CN/master/deploy.html#id7
)
和
[
编译示例
](
https://www.mindspore.cn/lite/docs/zh-CN/master/deploy.html#id10
)
,安装编译依赖基本项与模型转换工具所需附加项,并编译Windows版本。
-
运行:参考部署文档中的
[
输出件说明
](
https://www.mindspore.cn/lite/docs/zh-CN/master/deploy.html#id9
)
,获得
`converter`
工具,并将MinGW/bin目录下的几个依赖文件(libgcc_s_seh-1.dll、libwinpthread-1.dll、libssp-0.dll、libstdc++-6.dll)拷贝至
`converter`
工具的主目录。
### 参数说明
参考Linux环境模型转换工具的
[
参数说明
](
https://www.mindspore.cn/lite/docs/zh-CN/master/converter_tool.html#id4
)
### 模型可视化
参考Linux环境模型转换工具的
[
模型可视化
](
https://www.mindspore.cn/lite/docs/zh-CN/master/converter_tool.html#id5
)
### 使用示例
首先,使用cmd工具在源码根目录下,输入命令进行编译,可参考
`deploy.md`
。
```
bash
call build.bat lite
```
然后,设置日志打印级别为INFO。
```
bash
set
MSLOG
=
INFO
```
下面选取了几个常用示例,说明转换命令的使用方法。
-
以Caffe模型LeNet为例,执行转换命令。
```
bash
call converter_lite
--fmk
=
CAFFE
--modelFile
=
lenet.prototxt
--weightFile
=
lenet.caffemodel
--outputFile
=
lenet
```
本例中,因为采用了Caffe模型,所以需要模型结构、模型权值两个输入文件。再加上其他必需的fmk类型和输出路径两个参数,即可成功执行。
结果显示为:
```
INFO [converter/converter.cc:190] Runconverter] CONVERTER RESULT: SUCCESS!
```
这表示已经成功将Caffe模型转化为MindSpore Lite模型,获得新文件
`lenet.ms`
。
-
以MindSpore、TensorFlow Lite、ONNX模型格式和感知量化模型为例,执行转换命令。
-
MindSpore模型
`model.mindir`
```
bash
call converter_lite
--fmk
=
MS
--modelFile
=
model.mindir
--outputFile
=
model
```
-
TensorFlow Lite模型
`model.tflite`
```
bash
call converter_lite
--fmk
=
TFLITE
--modelFile
=
model.tflite
--outputFile
=
model
```
-
ONNX模型
`model.onnx`
```
bash
call converter_lite
--fmk
=
ONNX
--modelFile
=
model.onnx
--outputFile
=
model
```
-
TensorFlow Lite感知量化模型
`model_quant.tflite`
```
bash
call converter_lite
--fmk
=
TFLITE
--modelFile
=
model_quant.tflite
--outputFile
=
model
--quantType
=
AwareTraining
```
以上几种情况下,均显示如下转换成功提示,且同时获得
`model.ms`
目标文件。
```
INFO [converter/converter.cc:190] Runconverter] CONVERTER RESULT: SUCCESS!
```
你可以选择使用模型打印工具,可视化查验上述转化后生成的MindSpore Lite模型。本部分功能开发中。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录