openvino2tensorflow 项目使用教程

openvino2tensorflow 项目使用教程

openvino2tensorflowThis script converts the ONNX/OpenVINO IR model to Tensorflow's saved_model, tflite, h5, tfjs, tftrt(TensorRT), CoreML, EdgeTPU, ONNX and pb. PyTorch (NCHW) -> ONNX (NCHW) -> OpenVINO (NCHW) -> openvino2tensorflow -> Tensorflow/Keras (NHWC/NCHW) -> TFLite (NHWC/NCHW). And the conversion from .pb to saved_model and from saved_model to .pb and from .pb to .tflite and saved_model to .tflite and saved_model to onnx. Support for building environments with Docker. It is possible to directly access the host PC GUI and the camera to verify the operation. NVIDIA GPU (dGPU) support. Intel iHD GPU (iGPU) support.项目地址:https://gitcode.com/gh_mirrors/op/openvino2tensorflow

1. 项目的目录结构及介绍

openvino2tensorflow/
├── README.md
├── requirements.txt
├── setup.py
├── openvino2tensorflow/
│   ├── __init__.py
│   ├── converter.py
│   ├── utils.py
│   └── config.py
└── tests/
    ├── test_converter.py
    └── test_utils.py

目录结构介绍

  • README.md: 项目的基本介绍和使用说明。
  • requirements.txt: 项目依赖的Python包列表。
  • setup.py: 用于安装项目的脚本。
  • openvino2tensorflow/: 项目的主要代码目录。
    • init.py: 初始化文件,使该目录成为一个Python包。
    • converter.py: 核心转换脚本,负责将OpenVINO IR模型转换为TensorFlow模型。
    • utils.py: 工具函数脚本,包含一些辅助函数。
    • config.py: 配置文件脚本,包含项目的配置参数。
  • tests/: 测试代码目录,包含项目的单元测试。
    • test_converter.py: 针对converter.py的单元测试。
    • test_utils.py: 针对utils.py的单元测试。

2. 项目的启动文件介绍

项目的启动文件是openvino2tensorflow/converter.py。该文件包含了主要的转换逻辑,负责将OpenVINO IR模型转换为TensorFlow的saved_modeltfliteh5pb格式。

主要功能

  • 模型转换: 将OpenVINO IR模型转换为TensorFlow模型。
  • 格式支持: 支持多种输出格式,包括saved_modeltfliteh5pb
  • 配置加载: 从config.py中加载配置参数,用于控制转换过程。

使用方法

from openvino2tensorflow import converter

# 加载OpenVINO IR模型
ir_model_path = "path/to/your/model.xml"

# 转换模型
converter.convert(ir_model_path)

3. 项目的配置文件介绍

项目的配置文件是openvino2tensorflow/config.py。该文件包含了项目的配置参数,用于控制转换过程中的各种选项。

配置参数

  • output_format: 指定输出模型的格式,可选值包括saved_modeltfliteh5pb
  • output_dir: 指定输出模型的保存路径。
  • input_shape: 指定输入模型的形状,格式为(N, C, H, W)
  • batch_size: 指定批处理大小。

示例配置

# config.py

output_format = "saved_model"
output_dir = "output_models"
input_shape = (1, 3, 224, 224)
batch_size = 1

使用方法

在启动文件converter.py中,可以通过以下方式加载配置:

from openvino2tensorflow import config

# 加载配置
output_format = config.output_format
output_dir = config.output_dir
input_shape = config.input_shape
batch_size = config.batch_size

通过以上配置,可以灵活地控制模型的转换过程。

openvino2tensorflowThis script converts the ONNX/OpenVINO IR model to Tensorflow's saved_model, tflite, h5, tfjs, tftrt(TensorRT), CoreML, EdgeTPU, ONNX and pb. PyTorch (NCHW) -> ONNX (NCHW) -> OpenVINO (NCHW) -> openvino2tensorflow -> Tensorflow/Keras (NHWC/NCHW) -> TFLite (NHWC/NCHW). And the conversion from .pb to saved_model and from saved_model to .pb and from .pb to .tflite and saved_model to .tflite and saved_model to onnx. Support for building environments with Docker. It is possible to directly access the host PC GUI and the camera to verify the operation. NVIDIA GPU (dGPU) support. Intel iHD GPU (iGPU) support.项目地址:https://gitcode.com/gh_mirrors/op/openvino2tensorflow

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贾泉希

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值