Below is text / code from a recent SO post of mine that I hope you could comment on:Using Keras/Theano, I successfully trained a model using the Keras sample code for CIFAR10. It ran for about 2 hours on a MacPro with a GTX98-Ti GPU, with Theano (latest version) backend. All original parameters are unchanged and model reached ~81% accuracy. At the end of script the weights (weights.h5, 5MB on disk) and architecture (arch.json) were exported.In another script I restored the model and weights, and tried to classify single images using:from skimage.data import imreadimport osfrom keras.models import model_from_jsonfrom keras.optimizers import SGDmodel = model_from_json(open('./arch.json').read())model.load_weights('./weights.h5')sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])for root, dirs, files in os.walk('./input/singles/'):    for idx, file in enumerate(files):        if not file.startswith('.'):            file_path = root + os.sep + file            img = imread(file_path)            img = fn_resize(img, 32) # this is a resize function in another file                                     # I have plotted images at this point and they are                                     # correctly sized smaller version of the original                                     # normalized between 0-1 as in training            img = img.reshape((1, 3, 32, 32))            y_pred = int(model.predict_classes(img, 1))            pred_labels = ['airplane', 'automobile', ' bird', 'cat', 'deer',                           'dog', 'frog', 'horse', 'ship', 'truck']            print(pred_labels[y_pred], prediction \\\, file, truth)Essentially it restores the model and architecture, then loops through 10 images from the Net in a folder, resizing them to 32x32 pixels, reshaping the array, and forwarding the data to model.predict_classes(). I was surprised to see the below output, in which none of the images was classified correctly. Has anyone done such an experiment and knows if there are issues with the model build or if my procedure is incorrect?Using Theano backend.Using gpu device 0: GeForce GTX 980 Ti (CNMeM is disabled, cuDNN 5005)1/1 [==============================] - 0struck predicted \\\ airplane.jpeg truth1/1 [==============================] - 0sairplane predicted \\\ bird.jpeg truth1/1 [==============================] - 0sairplane predicted \\\ car.jpg truth1/1 [==============================] - 0sairplane predicted \\\ cat.jpeg truth1/1 [==============================] - 0sfrog predicted \\\ deer.jpeg truth1/1 [==============================] - 0sship predicted \\\ frog.jpeg truth1/1 [==============================] - 0sautomobile predicted \\\ horse.jpeg truth1/1 [==============================] - 0sautomobile predicted \\\ dog.tif truth1/1 [==============================] - 0sfrog predicted \\\ ship.jpeg truth1/1 [==============================] - 0sairplane predicted \\\ truck.jpeg truthProcess finished with exit code 0
Why is this trained model misclassifying new cases?
machine learning;python;neural network;deep learning;theano