TensorFlow ValueError: Cannot feed value of shape (64, 64, 3) for Tensor u’Placeholder:0′, which has shape ‘(?, 64, 64, 3)’

image has a shape of (64,64,3).

Your input placeholder _x have a shape of (?,64,64,3).

The problem is that you’re feeding the placeholder with a value of a different shape.

You have to feed it with a value of (1,64,64,3) = a batch of 1 image.

Just reshape your image value to a batch with size one.

image = array(img).reshape(1,64,64,3)

P.S: The fact that the input placeholder accepts a batch of images, means that you can run predicions for a batch of images in parallel.
You can try to read more than 1 image (N images) and then build a batch of N images, using a tensor with shape (N,64,64,3)

Leave a Comment