如何使用重新训练的“诗人用张量流"iOS上的图表? [英] How to use a retrained "tensorflow for poets" graph on iOS?
问题描述
通过诗人的张量流",我重新训练了 inceptionv3 图.现在我想使用 tfcoreml 转换器将图形转换为 iOS coreML 模型.
With "tensorflow for poets", I retrained the inceptionv3 graph. Now I want to use tfcoreml converter to convert the graph to an iOS coreML model.
但是 tf_coreml_converter.py 因NotImplementedError: Unsupported Ops of type: PlaceholderWithDefault"而停止.
But tf_coreml_converter.py stops with "NotImplementedError: Unsupported Ops of type: PlaceholderWithDefault".
我已经尝试过optimize_for_inference"和strip_unused",但我无法摆脱这个不受支持的操作PlaceholderWithDefault".
I already tried "optimize_for_inference" and "strip_unused", but I can't get rid of this unsupported op "PlaceholderWithDefault".
知道在 tensorflow-for-poets 训练后需要哪些步骤,将tensorflow-for-poets"图 (inceptionv3) 转换为 iOS coreML 模型吗?
Any idea what steps are needed after training in tensorflow-for-poets, to convert a "tensorflow-for-poets" graph (inceptionv3) to an iOS coreML model?
推荐答案
我通过以下步骤成功地从重新训练的 tensorflow 中删除了 PlaceholderWithDefault 操作,用于诗人图:
I succedded in removing the PlaceholderWithDefault op from the retrained tensorflow for poets graph with this steps:
针对干扰优化图表:
Optimize graph for interference:
python -m tensorflow.python.tools.optimize_for_inference \--input retrained_graph.pb \--output graph_optimized.pb \--input_names=Mul\--output_names=final_result
使用 transform_graph 工具删除 PlaceholderWithDefault 操作:
Remove PlaceholderWithDefault op with transform_graph tool:
bazel 构建 tensorflow/tools/graph_transforms:transform_graphbazel-bin/tensorflow/tools/graph_transforms/transform_graph \--in_graph=graph_optimized.pb \--out_graph=graph_optimized_stripped.pb \--inputs='Mul' \--outputs='final_result' \--transforms='remove_nodes(op=PlaceholderWithDefault)'
之后我可以将其转换为 coreML.但是正如 Matthijs 已经指出的那样,来自 git hub 的最新版本的 tfcoreml 会自动完成.
Afterwards I could convert it to coreML. But as Matthijs already pointed out, the latest version of tfcoreml from git hub does it automatically.
这篇关于如何使用重新训练的“诗人用张量流"iOS上的图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!