[go: up one dir, main page]

0% found this document useful (0 votes)
5 views15 pages

On Handwritten Digit Recognition

The document outlines a machine learning project focused on handwritten digit recognition using Convolutional Neural Networks (CNN). It details the problem statement, required libraries, the MNIST dataset, and the implementation process including data preprocessing, model creation, training, evaluation, and GUI development. The project culminates in a functional application that can classify drawn digits with high accuracy.

Uploaded by

Aarish Tickoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views15 pages

On Handwritten Digit Recognition

The document outlines a machine learning project focused on handwritten digit recognition using Convolutional Neural Networks (CNN). It details the problem statement, required libraries, the MNIST dataset, and the implementation process including data preprocessing, model creation, training, evaluation, and GUI development. The project culminates in a functional application that can classify drawn digits with high accuracy.

Uploaded by

Aarish Tickoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

ML Project

HANDWRITTEN
DIGIT RECOGNITION
USING NEURAL
NETWORKS
By - Aarish Tickoo (2021EE30706)
PROBLEM STATEMENT
 Handwritten digit recognition is a
fundamental machine learning
problem in computer vision and
pattern recognition. The
objective is to classify images of
handwritten digits (0–9) into their
respective numeric categories.
This has applications in areas
such as automated postal
sorting, bank check processing,
and digitizing handwritten
documents.
LIBRARIES REQUIRED

 Numpy -
 Pandas -
 Keras -
 Tensorflow -
 Sklearn -
CONVOLUTION NEURAL
NETWORK
A Convolution Neural Network or CNN
is a Deep Learning Algorithm which
is very effective in handling image
classification tasks. It is able to
capture the Temporal and Spatial
dependencies in an image with the
help of filters or kernels.
 The kernel is just like a small window

sliding over the large window in order


to extract the spatial features and in
the end, we get feature maps.
CNN (CONT..)
 CNN contains 3 layers namely, an
input layer, an output layer, and
multiple hidden layers which include
Convolutional layers, Pooling layers
(Max and Average pooling), Fully
connected layers (FC), and
normalization layers. CNN uses a filter
(kernel) which is an array of weights to
extract features from the input image.
CNN employs different activation
functions at each layer to add some
non-linearity.
THE MNIST DATASET

 Thisis probably one of the most


popular datasets among machine
learning and deep learning
enthusiasts. The MNIST
dataset contains 60,000 training
images of handwritten digits from zero
to nine and 10,000 images for testing.
So, the MNIST dataset has 10
different classes. The handwritten
digits images are represented as a
28×28 matrix where each cell contains
grayscale pixel value.
IMPLEMENTATION
 Algorithm for handwritten digit recognition generally
comprise of three stages.
 Step1Pre-processing.This progression should
eliminate immaterial information and information
that could have negative impact on
acknowledgement. Common steps in this fluster are
binarisation, standardisation,smoothing,denoising
 Step 2 Feature extraction. Feature extraction
involves reducing the number of resources required
to describe a large set of data.
 Step 3 Classification. Classification is a process
related to categorization, the process in which ideas
and objects are recognized, differentiated and
understood.
IMPORT THE LIBRARIES
AND LOAD THE DATASET
 First,
we are going to import all the
modules that we are going to need for
training our model. The Keras library
already contains some datasets and
MNIST is one of them. So we can
easily import the dataset and start
working with it.
The mnist.load_data() method
returns us the training data, its labels
and also the testing data and its labels.
PREPROCESS THE DATA
 The image data cannot be fed
directly into the model so we
need to perform some
operations and process the
data to make it ready for our
neural network. The dimension of
the training data is
(60000,28,28). The CNN model
will require one more dimension
so we reshape the matrix to
CREATE THE MODEL
 Now we will create our CNN
model in Python data science project.
A CNN model generally consists of
convolutional and pooling layers. It
works better for data that are
represented as grid structures, this is
the reason why CNN works well for
image classification problems. The
dropout layer is used to deactivate
some of the neurons and while
training, it reduces offer fitting of the
model. We will then compile the model
with the Adadelta optimizer.
TRAIN THE MODEL
 The model.fit() function of
Keras will start the training of the
model. It takes the training
data, validation data, epochs,
and batch size.
 It takes some time to train the

model. After training, we save the


weights and model definition in
the ‘mnist.h5’ file.
EVALUATE THE
MODEL
 We have 10,000 images in our
dataset which will be used
to evaluate how good our
model works. The testing data
was not involved in the training of
the data therefore, it is new data
for our model. The MNIST dataset
is well balanced so we can get
around 99% accuracy.
CREATE GUI TO PREDICT
DIGITS
 Now for the GUI, we have created a new file in
which we build an interactive window to
draw digits on canvas and with a button, we
can recognize the digit. The Tkinter library comes
in the Python standard library. We have created a
function predict_digit() that takes the image as
input and then uses the trained model to predict
the digit.
 Then we create the App class which is

responsible for building the GUI for our app. We


create a canvas where we can draw by capturing
the mouse event and with a button, we trigger
the predict_digit() function and display the
results.
RESULT AND ACCURACY
CONCLUSION
 In
this article, we have successfully
built a Python deep learning project on
handwritten digit recognition app. We
have built and trained the
Convolutional neural network which is
very effective for image classification
purposes. Later on, we build the GUI
where we draw a digit on the canvas
then we classify the digit and show the
results.

You might also like