[英]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.