from keras import optimizers
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
import cv2
import scipy.misc
from keras.wrappers.scikit_learn import KerasClassifier
# dimensions of our images
img_width, img_height = 313, 220
# load the model we saved
model = load_model('model.h5')
sgd = optimizers.SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy','mse'])
test_image= image.load_img('/Images/1.jpg',target_size = (img_width, img_height))
#x= scipy.misc.imread('/Images/1.jpg').shape
test_image = image.img_to_array(test_image)
print test_image
test_image = np.expand_dims(test_image, axis = 0)
test_image = test_image.reshape(img_width, img_height*3)
result = model.predict(test_image)
print result
When I ran the above code I get this error:
ValueError: Error when checking : expected dense_1_input to have shape (36,) but got array with shape (660,)
model.predict
accepts mini batches $\endgroup$