title: How to run prediction (using image as input) for a saved model?
body: <p><strong>Problem:</strong></p>
  <p>I am very new to Tensorflow. My specific question is what particular arguments should I put inside <code>sess.run(fetches, feed_dict)</code> function. For instance, how could find out what the values of the arguments?</p>
  <p><strong>Steps:</strong></p>
  <p>Here is my understanding of the steps after looking at other posts.</p>
  <ol>
  <li>Save tranied tensorflow model, it should consists of 4 files, below are my outputs:</li>
  </ol>
  <ul>
  <li>checkpoint</li>
  <li>Inception_resnet_v2.ckpt.data-00000-of-00001</li>
  <li>Inception_resnet_v2.ckpt.index</li>
  <li>Inception_resnet_v2.ckpt.meta</li>
  </ul>
  <ol start="2">
  <li><p>Resize the input image to whatever format required by the neural network.</p>
  </li>
  <li><p>Start tensorflow session.</p>
  </li>
  <li><p>Retrive the Graph and associated parameters, tensors...</p>
  </li>
  <li><p>Predict the input image.</p>
  </li>
  </ol>
  <p><strong>Code：</strong></p>
  <p><em>Traning code:</em></p>
  <p><a href="https://github.com/taki0112/SENet-Tensorflow/blob/master/SE_Inception_resnet_v2.py" rel="nofollow noreferrer">https://github.com/taki0112/SENet-Tensorflow/blob/master/SE_Inception_resnet_v2.py</a></p>
  <p><em>[Solved] Test code:</em></p>
  <pre><code>import tensorflow as tf
  import numpy as np
  import cv2
  
  labels = [&quot;airplane&quot;,&quot;automobile&quot;,&quot;bird&quot;,&quot;cat&quot;,&quot;deer&quot;,&quot;dog&quot;,&quot;frog&quot;,&quot;horse&quot;,&quot;ship&quot;,&quot;truck&quot;]
  
  # Load graph and parameters, etc.
  sess=tf.Session()
  saver = tf.train.import_meta_graph('./model/Inception_resnet_v2.ckpt.meta')
  saver.restore(sess, tf.train.latest_checkpoint(&quot;./model/&quot;))
  graph = tf.get_default_graph()
  
  # Get tensor names
  x = graph.get_tensor_by_name(&quot;Placeholder:0&quot;)
  training_flag = graph.get_tensor_by_name(&quot;Placeholder_2:0&quot;)
  op_to_restore = graph.get_tensor_by_name(&quot;final_fully_connected/dense/BiasAdd:0&quot;)
  
  # Preprocess imgae imput
  src = cv2.imread(&quot;./input/car3.jpg&quot;)
  dst = cv2.resize(src, (32, 32), interpolation=cv2.INTER_CUBIC)
  b,g,r = cv2.split(dst)
  b = (b - np.mean(b)) / np.std(b) * .1
  g = (g - np.mean(g)) / np.std(g) * .1
  r = (r - np.mean(r)) / np.std(r) * .1
  src = cv2.merge((b,g,r))
  
  picture = dst.reshape(1, 32, 32, 3)
  feed_dict ={x: picture, training_flag:False}
  
  result_index = sess.run(op_to_restore,feed_dict)
  print(result_index)
  print (labels[np.argmax(result_index)])
  </code></pre>