Real-Time Digit Recognition(Using Keras)

Suryaveer Singh
Aug 31, 2018 · 3 min read

Overview

Recently Deep Convolutional Neural Networks (CNNs) becomes one of the most appealing approaches and has been a crucial factor in the variety of recent success and challenging machine learning applications such as object detection, and face recognition. Therefore, CNNs is considered our main model for our challenging tasks of image classification. Specifically, it is used for is one of high research and business transactions. Handwriting digit recognition application is used in different tasks of our real-life time purposes. Precisely, it is used in vehicle number plate detection, banks for reading checks, post offices for sorting letter, and many other related tasks.

Description

This is a RealTime-DigitRecognition application which can predict output corresponding to handwritten images. I used SVC(support vector classifier) and sequential model of Keras for creating this predictive model. I trained SVC for 8X8 MNIST dataset, but the accuracy of this model is not good when I run this model on my handwritten images(600X600). It is due to resizing images from 600X600 to 8X8.It is important to get good results so I created a sequential model in Keras and tried it on 28X28 MNIST dataset. Now it gives very good result on handwritten digits.

The interface is created by using Pygame. The image preprocessing is the most important in this project which I have done by using Scipy and OpenCV.

Dataset

MNIST is a widely used dataset for the hand-written digit classification task. It consists of 70,000 labeled 28x28 pixel gray-scale images of hand-written digits. The dataset is split into 60,000 training images and 10,000 test images. There are 10 classes (one for each of the 10 digits). The task at hand is to train a model using the 60,000 training images and subsequently test its classification accuracy on the 10,000 test images.

Sample Images

These are some sample images of the handwritten character from mnist dataset.

Dependencies

This is the list of dependencies for running this application.

Skleran
Keras
tensorflow/theano
Opencv
Pygame
Pandas
Numpy
Scipy
Matplotlib

Download Source from my GitHub

How to use

  • Download or clone this repository.
GUI
  • Draw the digits on left side of the window and output will appear on right side of the window.

Choosing model

Edit in app.py
SVC of sklearn: comment KERARS and uncomment SVC
Sequential model: comment SVC and uncomment KERARS

Make changes in app.py

Demo

Future Work

I am developing an efficient model for detection multiple digits on a single frame like number plate, phone number, cheque number etc.
Here are some results

Please commit for any changes or bugs ☺

Suryaveer Singh

Written by

I am a programmer and developer. I like making fully functional software. I specialize in Python, ML & AI, application development,Django etc.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade