onnx转openvino模型(2022版本和2024版本)

网上很多方法都是用openvino自带的mo_onnx.py来转的,但个人下载的2022和2024版都没见到这些文件。所以使用不了

(1)2022版openvino:python需要安装对应版本的openvino库(以2022.3.0为例)

python 复制代码
pip install openvino==2022.3.0
python 复制代码
from openvino.runtime import Core
from openvino.offline_transformations import serialize

ie = Core()
onnx_model_path = r"C:\Users\25909\Desktop\openvino_test_model\cls_model.onnx"
model_onnx = ie.read_model(model=onnx_model_path)
# compiled_model_onnx = ie.compile_model(model=model_onnx, device_name="CPU")
serialize(model=model_onnx, xml_path="model/exported_onnx_model.xml", bin_path="model/exported_onnx_model.bin", version="UNSPECIFIED")

(2)2024版openvino: python安装openvino2024的库,和2022的区别在于接口变了.

python 复制代码
from openvino.runtime import Core
from openvino.runtime import serialize

ie = Core()
onnx_model_path = r"C:\Users\25909\Desktop\openvino_test_model\cls_model.onnx"
model_onnx = ie.read_model(model=onnx_model_path)
# compiled_model_onnx = ie.compile_model(model=model_onnx, device_name="CPU")
serialize(model=model_onnx, xml_path="model/exported_onnx_model.xml", bin_path="model/exported_onnx_model.bin", version="UNSPECIFIED")
相关推荐
阿拉斯攀登3 分钟前
第 13 篇 输入设备驱动(触摸屏 / 按键)开发详解,Linux input 子系统全解析
android·linux·运维·驱动开发·rk3568·瑞芯微·rk安卓驱动
2401_873204654 分钟前
使用Scrapy框架构建分布式爬虫
jvm·数据库·python
代码探秘者4 分钟前
【大模型应用】1.了解RAG
java·人工智能·python·spring
m0_716667079 分钟前
工具、测试与部署
jvm·数据库·python
2501_9454248015 分钟前
构建一个基于命令行的待办事项应用
jvm·数据库·python
bukeyiwanshui32 分钟前
【无标题】
linux·运维·服务器
疯狂吧小飞牛33 分钟前
Linux 多网卡同网段配置冲突问题
linux·运维·服务器
cowice42 分钟前
Python基础知识
python
-ONLY-¥1 小时前
Nginx性能优化与监控全攻略
linux
阿_旭1 小时前
基于YOLO26深度学习的铁轨部件缺陷检测与语音提示系统【python源码+Pyqt5界面+数据集+训练代码】
人工智能·python·深度学习·铁轨部件缺陷检测