I tried the keras tutorial that I found here...
https://github.com/eijaz1/Building-a-CNN-in-Keras-Tutorial/blob/master/cnn_tutorial.ipynb
Everything worked fine till line 10. But I am not able to predict correctly. I get the results like this...
model.predict(X_test[:4])
array([[0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32)
The expected results as per the tutorial are:
array([[1.6117248e-09, 8.6684462e-16, 6.8095707e-10, 1.5486043e-08,
6.2878847e-14, 1.2934288e-15, 1.1453808e-16, 9.9999928e-01,
1.0626109e-08, 6.9729606e-07],
[1.3555871e-07, 2.6465393e-06, 9.9999511e-01, 2.0351818e-08,
1.9796262e-11, 1.6996018e-12, 2.1163373e-06, 1.2008194e-17,
4.8792381e-10, 2.6086671e-13],
[6.7238901e-08, 9.9785548e-01, 1.9031411e-04, 3.9194603e-08,
1.2894072e-04, 1.5791730e-06, 1.2754040e-06, 4.1349044e-09,
1.8221687e-03, 5.5910935e-08],
[9.9999356e-01, 1.6909821e-12, 8.2496926e-10, 1.7359107e-11,
1.7359230e-12, 1.8865266e-13, 6.4659162e-06, 2.3738855e-11,
1.1319052e-08, 2.6948474e-08]], dtype=float32)
I am using keras version 2.2.2 if that matters.
Update:
While training the model, I am getting pretty low accuracy compared to that tutorial.
model.fit(X_train, y_train, validation_data=(X_test, y_test), epochs=3)
Train on 60000 samples, validate on 10000 samples
Epoch 1/3
60000/60000 [==============================] - 75s 1ms/step - loss: 14.3141 - acc: 0.1118 - val_loss: 14.2677 - val_acc: 0.1148
Epoch 2/3
60000/60000 [==============================] - 74s 1ms/step - loss: 14.3741 - acc: 0.1082 - val_loss: 14.4692 - val_acc: 0.1023
Epoch 3/3
60000/60000 [==============================] - 134s 2ms/step - loss: 14.3691 - acc: 0.1085 - val_loss: 14.3483 - val_acc: 0.1098
How do I improve the accuracy? I am using exactly same code as shown in the tutorial.
Here is the output that I get even if I use the exactly same code: