【问题标题】:tensorflow for poets: “The name 'import/Mul' refers to an Operation not in the graph.”用于诗人的 tensorflow:“名称‘import/Mul’指的是不在图中的操作。”
【发布时间】:2018-08-28 23:59:46
【问题描述】:

© 尝试使用 tensorflow 图像再训练。 https://www.tensorflow.org/tutorials/image_retraining

这样训练,没关系:

D:\dev\Anaconda\python D:/dev/detect_objects/tensorflow-master/tensorflow/examples/image_retraining/retrain.py --image_dir D:/dev/detect_objects/flower_photos --bottleneck_dir D:/dev/detect_objects/tensorflow-master/retrain/bottleneck --architecture mobilenet_0.25_128 --output_graph D:/dev/detect_objects/tensorflow-master/retrain/output_graph/output.pb --output_labels D:/dev/detect_objects/tensorflow-master/retrain/output_labels/labels.txt --saved_model_dir D:/dev/detect_objects/tensorflow-master/retrain/saved_model_dir --how_many_training_steps 100

当预测新图像时:

D:\dev\Anaconda\python D:/dev/detect_objects/tensorflow-master/tensorflow/examples/label_image/label_image.py --graph=D:/dev/detect_objects/tensorflow-master/retrain/output_graph/output.pb  --labels=D:/dev/detect_objects/tensorflow-master/retrain/output_labels/labels.txt --image=D:/dev/detect_objects/flower_photos/daisy/21652746_cc379e0eea_m.jpg

报错

KeyError: "The name 'import/Mul' refers to an Operation not in the graph."

label_image.py 内容:

  input_height = 299
  input_width = 299
  input_mean = 0
  input_std = 255
  #input_layer = "input"
  #output_layer = "InceptionV3/Predictions/Reshape_1"

  input_layer = "Mul"
  output_layer = "final_result"

这里有什么问题?

【问题讨论】:

    标签: image-processing tensorflow


    【解决方案1】:

    如果图中没有名为“import/Mul”的节点并且我们不知道 图表是什么或它是如何产生的,几乎没有机会 任何人都能猜出正确的答案。

    您可以尝试使用graph.get_operations() 打印图表的操作列表并尝试找到合适的节点(尝试打印的第一个节点)

    【讨论】:

      【解决方案2】:

      改变这个:

        input_height = 299
        input_width = 299
        input_mean = 0
        input_std = 255
        #input_layer = "input"
        #output_layer = "InceptionV3/Predictions/Reshape_1"
      
        input_layer = "Mul"
        output_layer = "final_result"
      

      到这里:

         input_height = 128
         input_width = 128
         input_mean = 0
         input_std = 128
         input_layer = "input"
         output_layer = "final_result"
      

      【讨论】:

      • 哦,好吧,所以你可能刚刚知道 tensorflow-hub 提供的 mobilenet 架构的定义
      猜你喜欢
      • 2018-03-01
      • 1970-01-01
      • 2020-05-14
      • 2016-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-25
      相关资源
      最近更新 更多