MindSpore1.2.0-rc1版本体验——手写体识别新旧版本对比

转载地址:https://bbs.huaweicloud.com/forum/thread-118013-1-1.html

作者:franco52576

版本号截图

image.png

硬件平台与操作系统:

Windows8.1 -X64

Intel i5-5200 CPU

RAM:16G

体验内容学习笔记

看了Mindspore 1.2.0的最新版本,发现有了一键模型迁移,简直太有用了。

赶快看一下教程如何迁移训练好的pytorch模型。

首先需要使用第三方框架脚本MindConverter。

MindConverter是一款用于将PyTorch(ONNX)、TensorFlow(PB)模型转换到MindSpore模型定义脚本以及权重文件的工具。结合转换报告的信息,用户只需对转换后的脚本进行微小的改动,即可实现快速迁移。此工具为MindInsight的子模块,安装MindInsight后,即可使用MindConverter。

所以如果想转换PyTorch模型,最好先转成ONNX模型再进行迁移。

MindConverter提供命令行(Command-line interface, CLI)的使用方式,命令如下。

usage: mindconverter [-h] [--version] [--in_file IN_FILE]

                     [--model_file MODEL_FILE] [--shape SHAPE [SHAPE ...]]

                     [--input_nodes INPUT_NODES [INPUT_NODES ...]]

                     [--output_nodes OUTPUT_NODES [OUTPUT_NODES ...]]

                     [--output OUTPUT] [--report REPORT]

optional arguments:

  -h, --help            show this help message and exit

  --version             show program version number and exit

  --in_file IN_FILE     Specify path for script file to use AST schema to do

                        script conversation.

  --model_file MODEL_FILE

                        Tensorflow(.pb) or ONNX(.onnx) model file path is

                        expected to do script generation based on graph

                        schema. When `--in_file` and `--model_file` are both

                        provided, use AST schema as default.

  --shape SHAPE [SHAPE ...]

                        Optional, expected input tensor shape of

                        `--model_file`. It is required when use graph based

                        schema. Both order and number should be consistent

                        with `--input_nodes`. Usage: --shape 1,512 1,512

  --input_nodes INPUT_NODES [INPUT_NODES ...]

                        Optional, input node(s) name of `--model_file`. It is

                        required when use graph based schema. Both order and

                        number should be consistent with `--shape`. Usage:

                        --input_nodes input_1:0 input_2:0

  --output_nodes OUTPUT_NODES [OUTPUT_NODES ...]

                        Optional, output node(s) name of `--model_file`. It is

                        required when use graph based schema. Usage:

                        --output_nodes output_1:0 output_2:0

  --output OUTPUT       Optional, specify path for converted script file

                        directory. Default output directory is `output` folder

                        in the current working directory.

  --report REPORT       Optional, specify report directory. Default is

                        converted script directory.

对于TensorFlow模型脚本迁移 同样使用指定--model_file--shape--input_nodes--output_nodes进行脚本迁移。看起来十分方便

顺便提示一下

新特性介绍 MindSpore开源周年狂欢,量子机器学习与深度分子模拟等巨量新特性来袭,发布新开源TinyMS工具包!

三、易用性  教程超链接有点问题哦

image.png

##################4.13增#######################

本来是打算试验一下MindConverte 来转换Pytorch 模型的,后来安装的时候发现不支持CPU,于是只好放弃

微信截图_20210413164751.png

于是只能通过经典的手写体识别来体验一下新版本了。

看看速度上和精度上是不是有明显差别。

微信截图_20210413173118.png

先输出一下数据集,顺便看看最新版本是不是升级成功了,嗯挺好!

接下来看一下loss曲线和精度的结果。

先来对比一下loss的结果:上图为1.1 下图为1.2

微信截图_20210413173327.png

微信截图_20210413173239.png

可以看到除了部分波动外,其余 还是差不多的。

那再来看看精度的对比结果。同样上图为1.1,下图为1.2

微信截图_20210413173337.png

微信截图_20210413173250.png

可以看到精度提升的速度有了明显的变换,

不知道这是机器之间的差异,还是1.2里对底层的处理方式有了一些改动呢?欢迎大家讨论。

同时也期待在后面的使用和测试中找到这个问题的答案!

个人邮箱号:997385374@qq.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值