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

时间:2019-08-09 09:28:17

标签: python tensorflow onnx

我有一个TensorFlow图冻结为func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CategoryTableViewCell cell.collectionCellTapHandler = {[weak self] in self?.callTheMethod() } return cell } func callTheMethod() { print("Hello...") } ,我想将其转换为fn(stripeCustomerId) -> totalAmountSpent 格式。我目前正在尝试使用mmconvert(来自Microsoft的MMdnn),显然我在做错事(请参见下面的代码)。是否有其他推荐的方法可以将.pb转换为.onnx?谢谢。

这是我正在使用的命令:

.pb

给出错误

.onnx

1 个答案:

答案 0 :(得分:2)

Onnx格式要求在模型中指定输出节点。快速浏览一下,表明mmconvert希望使用--dstNode进行指定。

如果要将TensorFlow图转换为Onnx图,也可以使用tf2onnx

您将使用以下命令转换模型:

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