Download APK
Apk can be found in apk folder, download and install the apk.
Inorder to recognize hand written digits, Deep learning model was trained. I used tensorflow's offical MNIST model and MNIST data set to train the Model.
Implemention
I converted the frozen model to mnist.tflite (optimized tensorflow lite model for mobile devices) Here is the mnist.tfile file.
On Android, recognizing hand written digits in image or camera feed is challenging. An Image with hand written digit feed directly (downscaled image of model input size) to well trained deep learning model to predict the written digits, But this won't work well!. Because the deep learning model was well trained on clean and prepocessed dataset, but Image with hand written digit taken from camera is not clean (contains noise) and not preprocessed!
Before feeding Image taken by the camera to Model, Image was preprocessed. I used OpenCV for Android for preprocessing on Image or Frames.
Preprocessing steps:
-
converting color image/frame to grayscale
-
crop the center region of image/frame
-
blur the frame (to remove noise)
-
Apply Adapative thresolding (convering to binary image)
-
Apply Image morphological operations (dilation and erosion)
-
Down scale the cropped image to Model Input size
After the prepocessing, Down scaled image(which is OpenCV Mat) is converted to tensorflow lite input format.
Note: Make sure that written digits are large and fits the middle square region shown in the app.
Below shows screenshots from the App.