首页 文章

将tensorflow模型(.pb)转换为coreml(.mlmodel)

提问于
浏览
-1

ValueError:在TF图中找不到产生给定输出名称的操作

对于ML / Tensorflow以及Python来说,这是全新的 .

我试图将模型从.pb格式转换为.mlmodel格式,以便在ios项目中使用 . 我正在使用tf-coreml .

>>> tf_converter.convert(tf_model_path = '/Users/anup/Downloads/inception_v1_2016_08_28_frozen.pb/inception_v1_2016_08_28_frozen.pb',mlmodel_path = '/Users/anup/Downloads/inception_v1_2016_08_28_frozen.pb/inception_v1_2016_08_28_frozen.mlmodel',output_feature_names = ['Softmax:0'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tfcoreml/_tf_coreml_converter.py", line 493, in convert
    predicted_probabilities_output=predicted_probabilities_output)
  File "tfcoreml/_tf_coreml_converter.py", line 157, in _convert_pb_to_mlmodel
    OPS, skip_ops = _topological_sort_ops(OPS, output_feature_names) # do (1),(2),(3) listed above
  File "tfcoreml/_tf_graph_transform.py", line 134, in _topological_sort_ops
    skip_ops = _find_skippable_ops(G, ops, output_names)
  File "tfcoreml/_tf_graph_transform.py", line 72, in _find_skippable_ops
    raise ValueError('No op found in the TF graph that produces the given output name(s)')
ValueError: No op found in the TF graph that produces the given output name(s)
>>>

我在mac终端上运行它 . 其实我不知道什么Softmax:0是什么意思,我是否需要用别的东西替换它 . 以下是:https://github.com/tf-coreml/tf-coreml这可能是一件非常简单的事情而且很愚蠢 . 请帮我解决这个问题 .

1 回答

  • 0

    Softmax:0 是张量的名称 . 您的图表似乎没有具有该名称的张量 .

    查找图中最后一个张量名称的一种方法是download Netron并使用它来查看 .pb 文件 .

相关问题