我正在尝试将 .pb 文件转换为 .mlmodel 文件。我收到一个错误 "Tensorflow graph does not contain a tensor with this name"

I am trying to convert .pb file to .mlmodel file. I am getting an error "Tensorflow graph does not contain a tensor with this name"

我尝试使用 tfcoreml,但错误是:

正在加载 TF 图...

2018-12-05 11:16:50.591360: I tensorflow/core/platform/cpu_feature_guard.cc:141] 你的 CPU 支持此 TensorFlow 二进制文件未编译使用的指令:AVX2 FMA

图表已加载。 从图中收集所有 'Const' 操作,运行 它.... 完毕。 追溯(最近一次通话): 文件 "converter.py",第 4 行,位于 output_feature_names = ['softmax:0']) 文件“/root/tensorflow-for-poets-2/tf_files/tf-coreml/tfcoreml/_tf_coreml_converter.py”,第 586 行,在转换中 custom_conversion_functions=custom_conversion_functions) 文件“/root/tensorflow-for-poets-2/tf_files/tf-coreml/tfcoreml/_tf_coreml_converter.py”,第 272 行,在 _convert_pb_to_mlmodel 中 提高 ValueError("output name: {}, was provided, but the Tensorflow graph does not contain a tensor with this name.".format(given_out_name)) ValueError:输出名称:softmax:0,已提供,但 Tensorflow 图不包含具有此名称的张量。

当您调用 tfcoreml.convert() 时,您需要在模型的输出中提供张量的名称。您提供了 "softmax:0",可能是因为您在某个教程中看到过它。但显然这不是您自己的 TensorFlow 图表的输出名称。

您可以使用名为 Netron 的工具来检查您的图形,以查看输出张量的名称。