Mnist hand-written classifier score is too low Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Mnist hand-written classifier score is too low without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I followed this tutorial https://medium.com/the-andela-way/deep-learning-hello-world-e1fc53ea888 to experiment with Keras, the source code is here https://github.com/sirghiny/mnist However I received a very low score and the training was very short, as if the model is trained on very few samples. Here is the output in terminal:

Epoch 1/5
300/300 [==============================] - 12s 39ms/step - loss: 2.3791 - categorical_accuracy: 0.0899 - val_loss: 2.3104 - val_categorical_accuracy: 0.0528
Epoch 2/5
300/300 [==============================] - 11s 38ms/step - loss: 2.3326 - categorical_accuracy: 0.1060 - val_loss: 2.2920 - val_categorical_accuracy: 0.0864
Epoch 3/5
300/300 [==============================] - 10s 32ms/step - loss: 2.2891 - categorical_accuracy: 0.1315 - val_loss: 2.2742 - val_categorical_accuracy: 0.1571
Epoch 4/5
300/300 [==============================] - 9s 31ms/step - loss: 2.2510 - categorical_accuracy: 0.1576 - val_loss: 2.2569 - val_categorical_accuracy: 0.2367
Epoch 5/5
300/300 [==============================] - 9s 30ms/step - loss: 2.2174 - categorical_accuracy: 0.1889 - val_loss: 2.2397 - val_categorical_accuracy: 0.3133

Evaluating the model...

1250/1250 [==============================] - 2s 2ms/step - loss: 2.2382 - categorical_accuracy: 0.3171
938/938 [==============================] - 2s 2ms/step - loss: 2.2369 - categorical_accuracy: 0.3232

Please tell me what did i do wrong?

Answer

You updated your model weight only 1500 times (epochs*number_of_batch).

You might want to increase the epochs or/and reduce the batch_size to perform more weights’ update as we see in your logs that the network is still learning.

Additionally, you should find an up-to-date tutorial like this one as TensorFlow changed a lot recently.

We are here to answer your question about Mnist hand-written classifier score is too low - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji