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

for*_*222 5 image-processing 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
Run Code Online (Sandbox Code Playgroud)

预测新图像时:

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
Run Code Online (Sandbox Code Playgroud)

它给出了错误

KeyError: "The name 'import/Mul' refers to an Operation not in the graph."
Run Code Online (Sandbox Code Playgroud)

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"
Run Code Online (Sandbox Code Playgroud)

这里有什么问题?

小智 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"
Run Code Online (Sandbox Code Playgroud)

对此:

   input_height = 128
   input_width = 128
   input_mean = 0
   input_std = 128
   input_layer = "input"
   output_layer = "final_result"
Run Code Online (Sandbox Code Playgroud)