I am trying to use a trained model on Tensorflow in the inference phase. During training, I used a batch size of 8 obtained through the shuffle_batch function:
image_batch, label_batch = \
tf.train.shuffle_batch([image, label], batch_size=8,
capacity=2000, num_threads=2,
min_after_dequeue=1000)
The following is the relevant part of inference phase:
with tf.Session() as sess:
saver = tf.train.import_meta_graph('model_enc_dec-0.meta')
saver.restore(sess, tf.train.latest_checkpoint('./'))
graph = tf.get_default_graph()
pred = tf.get_collection('logits_key')[0]
image_batch_tensor = tf.get_collection('image_batch_key')[0]
.......
.......
# image_loaded_from_disk is of size (1, 384, 384, 3)
feed_dict = {image_batch_tensor:image_loaded_from_disk}
pred_np = sess.run([pred], feed_dict=feed_dict)
The following is the error I obtain at the line of the sess.run() when I run inference on the restored model:
ValueError: Cannot feed value of shape (1, 384, 384, 3) for Tensor u'shuffle_batch:0', which has shape '(8, 384, 384, 3)'
How should the trained model be adapted to accept a single image to forward through the model?