Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tensorflow for poets: “The name 'import/Mul' refers to an Operation not in the graph.”

İ try to use tensorflow image retraining. https://www.tensorflow.org/tutorials/image_retraining

train like that and it is OK:

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

When predict new image like:

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

It gives error

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

label_image.py content:

  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"

What is the problem here?

like image 496
foreign222 Avatar asked Mar 20 '18 08:03

foreign222


Video Answer


1 Answers

Change this:

  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"

to this:

   input_height = 128
   input_width = 128
   input_mean = 0
   input_std = 128
   input_layer = "input"
   output_layer = "final_result"
like image 174
Abhishek Rai Avatar answered Sep 29 '22 09:09

Abhishek Rai