onnx格式模型转换为openvino格式

1、安装openvino环境

Download the Intel Distribution of OpenVINO Toolkit

按照以上链接安装openvino转换环境

2、切换到mo_onnx.py 目录下执行

python mo_onnx.py   --input_model (onnx位置) --model_name(输出位置)
(openvino) C:\Users\yangrui.cheng\AppData\Local\Continuum\anaconda3\envs\pad\Lib\site-packages\openvino\tools\mo>python mo_onnx.py --input_model D:\shell\resnet50.onnx --model_name D:\source\openvino
Check for a new version of Intel(R) Distribution of OpenVINO(TM) toolkit here https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit/download.html?cid=other&source=prod&campid=ww_2023_bu_IOTG_OpenVINO-2022-3&content=upg_all&medium=organic or on https://github.com/openvinotoolkit/openvino
[ INFO ] The model was converted to IR v11, the latest model format that corresponds to the source DL framework input/output format. While IR v11 is backwards compatible with OpenVINO Inference Engine API v1.0, please use API v2.0 (as of 2022.1) to take advantage of the latest improvements in IR v11.
Find more information about API v2.0 and IR v11 at https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html
[ SUCCESS ] Generated IR version 11 model.
[ SUCCESS ] XML file: D:\source\openvino.xml
[ SUCCESS ] BIN file: D:\source\openvino.bin

执行结果如上

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OpenVINO可以将动态batchsize的ONNX模型转换为其支持的静态batchsize的模型。下面是一种实现方式: 首先,安装OpenVINO工具包,并将模型优化器(Model Optimizer)集成到环境中。该工具用于将ONNX模型转换OpenVINO可以加载和推理的IR模型。 在转换ONNX模型之前,我们需要了解该模型的动态输入形状。通常,动态batchsize的模型在网络的输入节点上会标记为-1或None。我们可以使用ONNX Runtime库来动态推理模型并获取输入形状。 下一步是使用Model Optimizer将ONNX模型转换为IR模型。为了支持静态batchsize,我们需要在转换过程中指定batch参数。命令行示例如下: ``` python mo.py --input_model model.onnx --output_dir output --input_shape [B,C,H,W] --mean_values [mean_values] --scale_values [scale_values] --batch B ``` 在命令行中,我们需要提供转换ONNX模型,输出目录,输入形状,均值和缩放值。重要的是,在输入形状中指定batch维度并将其设置为所需的静态batchsize。 完成转换后,我们可以使用OpenVINO进行推理,输入静态batchsize的数据进行推理。 需要注意的是,在转换和推理过程中,我们需要确保模型和数据的形状匹配,以避免错误发生。如果需要批量推理,可以使用循环迭代每个批量进行推理。 这就是使用OpenVINO将动态batchsize的ONNX模型转换为静态batchsize模型的简要步骤。通过这种方式,我们可以使用OpenVINO对不同大小的批量进行高效推理。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值