keras reshape input image to work with CNN

Viewed 12947

There are other post with similar questions but none of the answers are helping me. I´m new to this CNN world.

I followed this tutorial for training a CNN with Keras using theano as BackEnd with the MNIST dataset. Now I want to pass to the CNN my own jpg image but I dont know how to reshape it. Can you help me please? Im super new at this.

So far, I tried this to reshape

image = np.expand_dims(image, axis=0) image = preprocess_input(image)

but get the following error when predicting:

ValueError: Error when checking : expected conv2d_1_input to have shape (None, 1, 28, 28) but got array with shape (1, 3, 28, 28)

As you can see, my CNN uses width = 28, height = 28 and depth =1.

2 Answers
Related