简体   繁体   English

将冻结的图从.pb转换为.onnx

[英]Convert frozen graph from .pb to .onnx

I have a TensorFlow graph frozen as a .pb , and I would like to convert it into the .onnx format. 我有一个TensorFlow图冻结为.pb ,我想将其转换为.onnx格式。 I am currently trying using mmconvert (from Microsoft's MMdnn ) and apparently I am doing something wrong (see code below). 我目前正在尝试使用mmconvert(来自Microsoft的MMdnn ),显然我在做错事(请参见下面的代码)。 Is there any other recommended approach for converting a .pb into an .onnx ? 是否有其他建议将.pb转换为.onnx Thanks. 谢谢。

Here's the command I am using: 这是我正在使用的命令:

mmconvert -sf tensorflow -iw /frozen_models/model.pb --inNodeName input --inputShape 512 -df onnx -om tf_mobilenet --inNodeName input

Which gives the error 这给出了错误

ValueError: Need to provide the output node of Tensorflow model.

The Onnx format requires an output node to be specified in the model. Onnx格式要求在模型中指定输出节点。 A quick glance suggests mmconvert expects that to be specified with --dstNode. 快速浏览一下,mmconvert期望使用--dstNode指定它。

If you're converting a TensorFlow graph to an Onnx Graph, you could also use tf2onnx . 如果要将TensorFlow图转换为Onnx图,也可以使用tf2onnx

You would convert the model with the command: 您可以使用以下命令转换模型:

python -m tf2onnx.convert --input /frozen_models/model.pb --inputs input --outputs outputNodeName --outputoutput tf_mobilenet.onnx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将使用 Docker 创建的冻结 Inception graph.pb 转换为 .tflite - Can't convert frozen Inception graph .pb created with Docker to .tflite 可视化冻结的graph_def.pb - Visualizing a frozen graph_def.pb 有没有办法下载PoseNet的冻结图(.pb文件)? - is there a way to download the frozen graph ( .pb file ) of PoseNet? 将元数据添加到 tensorflow 冻结图 pb - Add metadata to tensorflow frozen graph pb 如何将预训练的 tensorflow pb 冻结图转换为可修改的 h5 keras 模型? - How to convert a pretrained tensorflow pb frozen graph into a modifiable h5 keras model? 如何将Tensorflow Simple Audio Recognition冷冻图(.pb)转换为Core ML模型? - How to convert Tensorflow Simple Audio Recognition frozen graph(.pb) to Core ML model? 如何从 Tensorflow Objectdetection 2 中的检查点导出 frozen_inference_graph.pb - How to export frozen_inference_graph.pb from a checkpoint in Tensorflow Objectdetection 2 如何将 PyTorch 图转换为 ONNX,然后从 OpenCV 推断? - How to convert PyTorch graph to ONNX and then inference from OpenCV? 将TensorFlow Graph从PB转换为float16操作 - Convert TensorFlow Graph from PB to float16 operations 无法将.pb 图转换为 tflite - Failing to convert .pb graph to tflite
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM