I am trying to make a single image using the tenorflow example c:
https://www.tensorflow.org/versions/r0.8/tutorials/deep_cnn/index.html#convolutional-neural-networks
def restore_vars(saver, sess):
""" Restore saved net, global score and step, and epsilons OR
create checkpoint directory for later storage. """
ckpt = tf.train.get_checkpoint_state(FLAGS.checkpoint_dir)
if ckpt and ckpt.model_checkpoint_path:
saver.restore(sess, ckpt.model_checkpoint_path)
return True
else:
print('No checkpoint file found')
return False
def eval_single_img():
input_img = tf.image.decode_jpeg(tf.read_file("test.jpg"), channels=3)
input_img =
input_img = tf.reshape(input_img, [3, 32, 32])
input_img = tf.transpose(input_img, [1, 2, 0])
reshaped_image = tf.cast(input_img, tf.float32)
resized_image = tf.image.resize_image_with_crop_or_pad(reshaped_image, 24, 24)
float_image = tf.image.per_image_whitening(resized_image)
image = tf.expand_dims(float_image, 0)
logits = cifar10.inference(image)
_, top_k_pred = tf.nn.top_k(logits, k=5)
variable_averages = tf.train.ExponentialMovingAverage(
cifar10.MOVING_AVERAGE_DECAY)
variables_to_restore = variable_averages.variables_to_restore()
saver = tf.train.Saver(variables_to_restore)
with tf.Session() as sess:
restored = restore_vars(saver, sess)
top_indices = sess.run([top_k_pred])
print ("Predicted ", top_indices[0], " for your input image.")
** ERROR MESSAGE: tensorflow.python.framework.errors.InvalidArgumentError: Assign requires two tensors to match. lhs shape = [18,384] rhs shape = [2304,384] [[Node: save / Assign_5 = Assign [T = DT_FLOAT, _class = ["loc: @ local3 / weight]", use_locking = true, validate_shape = true, _device = "/ job: localhost / replica: 0 / task: 0 / cpu: 0"] (local3 / weight, save / restore_slice_5)]] Op u'save / Assign_5 'is called, defined at:
What might be causing this?**