【发布时间】:2018-12-27 17:05:27
【问题描述】:
KeyError: "名称 'loss:0' 指的 Tensor 不存在。操作 'loss' 在图中不存在。"
大家好,我在使用 tensorflow 模型时遇到了问题。代码在终端中编译时运行良好,但是当我尝试将其设为 python API 时,它显示上述错误
output_layer = 'loss:0'
input_node = 'Placeholder:0'
# Crop the center for the specified network_input_Size
augmented_image = crop_center(augmented_image, network_input_size, network_input_size)
with tf.Session() as sess:
prob_tensor = sess.graph.get_tensor_by_name(output_layer)
predictions = sess.run(prob_tensor, {input_node: [augmented_image] })
上面的代码是在说错误
prob_tensor = sess.graph.get_tensor_by_name(output_layer)
【问题讨论】:
-
请问您解决了这个问题吗?运行此示例时遇到相同的问题:docs.microsoft.com/en-us/azure/cognitive-services/…
-
Bgr_image 是一个未定义的参数。将其替换为 augmented_image,因为这是我们对输入图像所做的最后一次修改。它现在对我有用。
标签: python python-3.x tensorflow tensorboard tensor