Can I test my model on other digits, for example I write the digit 7 on a paper with my pen and check whether my model would recognize it or not? How can I do it?
Yes, definitely. One of the main goals of machine learning is to be able to train a model and use it on your own data to make predictions. BUT you must ensure that the handwritten digits are produced and processed in the same way as the training data.
- Example 1: If the MNIST digits dataset uses black pen, you must also use black pen (preferably of the same type).
- Example 2: If the MNIST digits dataset has digits on a white background, you must also produce digits on a white background.
- Example 3: If the MNIST digits dataset has digits that are centered in a 28x28-pixel image, then you must do the same.
This will help keep your dataset "within distribution" as the training dataset. Departures from the pipeline that generated the training data will result in degradation in performance. By the way, there is usually some degradation in performance anyway when models are deployed in the real world.
After you have captured and processed your "custom" handwritten digits, you must package them in a way that can be processed by your model. For example, models in Keras/Tensorflow will take images as Tensorflow tensors and Numpy arrays. You should preferably package your data the way MNIST dataset is packaged in your download. Keras has the .predict()
method that allows you to make predictions / inferences on new data (see article).