诗人的张量流:“名称'import / Mul'指的是不在图中的操作。”

时间:2018-03-20 08:46:15

标签: image-processing tensorflow

try尝试使用张量流图像再训练。 https://www.tensorflow.org/tutorials/image_retraining

像那样训练,没关系:

func main() {
    resp1 := make(chan int)
    resp2 := make(chan int)

    readsWanted := 0

    readsWanted += 1
    go square(20, resp1)
    readsWanted += 1
    go square(10, resp2)

    for i := 0; i < readsWanted; i++ {
        select {
        case msg1 := <-resp1:
            fmt.Println(msg1)
        case msg2 := <-resp2:
            fmt.Println(msg2)
        }
    }
}

预测新图像时:

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

label_image.py内容:

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

这里有什么问题?

2 个答案:

答案 0 :(得分:5)

改变这个:

  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"

答案 1 :(得分:0)

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

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