SlideShare a Scribd company logo
2
Most read
4
Most read
Handwritten Digits Recognition
Jan 14, 2020
Abstract
In this paper I present an Keras Sequential Neural Network to tackle the recognition
of human handwritten digits. The Neural Network proposed here is experimented on
the well-known MNIST data set. Without any pre-processing of the data set, our
Neural Network achieves quite low classification error. Combined with clustering
techniques, we can build artificial intelligence system which can automatically
segment individual digit from images and find its corresponding label.
Introduction
In this project, a handwritten digits recognition system was implemented with the famous
MNIST data set. This is not a new topic and the after several decades, the MNIST data set is
still very popular and important for evaluation and validation of new algorithms.
Handwritten digits recognition problem has been studied by researchers since 1998 with
almost all the algorithms designed by then and even until now. The test error rate decreased
from 12% in 1988 by linear classifier to 0.23% in 2012 by convolutional nets, and these days
more and more data scientists and machine learning experts are trying to develop and
validate unsupervised learning methods such as auto-encoder and deep learning model.
Methods
The program I implement will mainly focus on identifying 0-9 from segmented
pictures of handwritten digits.For simplicity, input images are pre-treated to
be of certain fixed size, and each input image should contain only one unknown digit
in the middle. These requirements are not too harsh because they can be achieved
using simple image processing or computer vision techniques. In addition, such pre-
treated image data set are easy to obtain. In my implementation,the popular MNIST
data set ([1]) is a good choice. Each image in MNIST is already normalized to 28x28
in the above sense and the data set itself is publicly available. The MNIST data set
is really a huge one: it contains 60000 training samples and 10000 test samples.
And it has become a standard data set for testing various algorithms.The output of
my program will be the corresponding 0-9 digit contained in input image. The
method I use is Keras Sequential Neural Network using Tensorflow. Unlike lazy
learning method such as Nearest Neighbor Classifier that stores the whole training
set and classify new input case by case, This will implicitly learn the corresponding
rule between image of handwritten digits and the actual 0-9 identities. Preferably, I
want the output units provide the conditional probability (thus the output of each unit
is between 0 and 1, and the outputs of all 10 units will sum to 1) of each class to
which each input belongs, and the unit that has the maximum output will determine
the class label. As a result, softmax activation is the desirable choice for output
units.The unit corresponding to the right class label of each input has
value 0.91, while other units have the same value 0.01. I do not set them to be 1s
and 0s because extreme value are hard to be achieved by activation functions.
Results and Discussions
Among all the methods I tried on MNIST dataset, I preferred the model which I built using
Keras Sequential Neural Network using Tensorflow, has the best performance, which is
97.2899% accuracy, which is quiet accurate 2.73% error rate, but not always repeatable.
Tweaking the kernel sizes and numbers of convolutional layers indicates that more
convolutional layers are helpful to improve the accuracy while change kernel size has little
effect and the accuracy even decreased sometime.
Source Code
import tensorflow as tf
mnist=tf.keras.datasets.mnist
(x_train,y_train),(x_test,y_test)=mnist.load_data()
x_train=tf.keras.utils.normalize(x_train,axis=1)
x_test=tf.keras.utils.normalize(x_test,axis=1)
model=tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(128,activation=tf.nn.relu))
model.add(tf.keras.layers.Dense(128,activation=tf.nn.relu))
model.add(tf.keras.layers.Dense(10,activation=tf.nn.softmax))
model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy'])
model.fit(x_train,y_train,epochs=3)
val_loss,val_acc=model.evaluate(x_test,y_test)
print(val_loss*100,val_acc*100)
import matplotlib.pyplot as plt
plt.imshow(x_train[0])
plt.show()
print(x_train[0])
model.save("epic_num_reader.model")
new_model=tf.keras.models.load_model("epic_num_reader.model")
predictions=new_model.predict([x_test])
print(predictions)
import numpy as np
print(np.argmax(predictions,axis=1))
for i in range(0,11):
first_image=x_test[i]
first_image=np.array(first_image,dtype='float')
pixels=first_image.reshape((28,28))
plt.imshow(pixels)
plt.show()
Conclusion
In conclusion, I implement a large Sequential neural network for human
handwritten digits. I train the NN with cross entropy using error back
propagation to obtain optimal weights values. I also find useful applications
for the NN I generate. By doing this project, I have practiced using what
I have learned in the Machine Learning course. My program
probably does not beat the state of the art in handwritten digit recognition.
However, I have for the first time observed the practical problems of using
the powerful Neural Networks. This experience will definitely be helpful for
my future research.
Acknowledgments
I want to thank the whole Eckovation team and specially the mentors for this
course Machine Learning. I really learn a lot of new things from their
lectures. I am also grateful to them for constant support for their useful
discussions in Forum group with details of the project.
____________
Name: Swayamdipta Saha
E-mail: swayamsaha@gmail.com

More Related Content

PPTX
Handwritten Digit Recognition(Convolutional Neural Network) PPT
PPTX
HANDWRITTEN DIGIT RECOGNITIONppt1.pptx
PPTX
Introduction to Deep learning
PDF
Deep learning seminar report
PPTX
Steganography Project
PPTX
Digit recognition
PPTX
Convolutional Neural Network
PDF
Computer vision
Handwritten Digit Recognition(Convolutional Neural Network) PPT
HANDWRITTEN DIGIT RECOGNITIONppt1.pptx
Introduction to Deep learning
Deep learning seminar report
Steganography Project
Digit recognition
Convolutional Neural Network
Computer vision

What's hot (20)

PPTX
Handwritten digit recognition using image processing
PPTX
Image Classification using deep learning
PPTX
Handwritten Digit Recognition and performance of various modelsation[autosaved]
PPTX
Convolutional neural network
PDF
Neural networks and deep learning
PPTX
GUI based handwritten digit recognition using CNN
PDF
Skin Lesion Detection from Dermoscopic Images using Convolutional Neural Netw...
PPT
Cloud service management
PDF
Convolutional Neural Network Models - Deep Learning
PPTX
Resnet for image processing (3)
PDF
Convolutional Neural Networks (CNN)
PPTX
Image classification using CNN
PPTX
AGE AND GENDER DETECTION.pptx
PPTX
Handwriting Recognition Using Deep Learning and Computer Version
PPTX
Handwritten bangla-digit-recognition-using-deep-learning
PPT
Image Steganography
PPT
Fields of digital image processing slides
PDF
An introduction to Deep Learning
PDF
Advanced Encryption Standard (AES)
PPT
Steganography presentation
Handwritten digit recognition using image processing
Image Classification using deep learning
Handwritten Digit Recognition and performance of various modelsation[autosaved]
Convolutional neural network
Neural networks and deep learning
GUI based handwritten digit recognition using CNN
Skin Lesion Detection from Dermoscopic Images using Convolutional Neural Netw...
Cloud service management
Convolutional Neural Network Models - Deep Learning
Resnet for image processing (3)
Convolutional Neural Networks (CNN)
Image classification using CNN
AGE AND GENDER DETECTION.pptx
Handwriting Recognition Using Deep Learning and Computer Version
Handwritten bangla-digit-recognition-using-deep-learning
Image Steganography
Fields of digital image processing slides
An introduction to Deep Learning
Advanced Encryption Standard (AES)
Steganography presentation
Ad

Similar to Handwritten digits recognition report (20)

DOCX
Digit recognition using mnist database
PDF
Convolutional Neural Network for Text Classification
PDF
dfdshofdifhdifhdfhgfoighfgofgfgfgfgdfdfdfdf
PDF
Hand Written Digit Classification
PPT
Evolving Comprehensible Neural Network Trees
PDF
Integrating Artificial Intelligence with IoT
PDF
IRJET - Study on the Effects of Increase in the Depth of the Feature Extracto...
PPTX
Handwritten digit and symbol recognition using CNN.pptx
PPTX
AI Class Topic 6: Easy Way to Learn Deep Learning AI Technologies
PDF
X-TREPAN: A MULTI CLASS REGRESSION AND ADAPTED EXTRACTION OF COMPREHENSIBLE D...
PDF
X-TREPAN : A Multi Class Regression and Adapted Extraction of Comprehensible ...
PDF
An ann approach for network
DOCX
artificial-neural-network-seminar-report.docx
PPTX
Build a simple image recognition system with tensor flow
PDF
AN ANN APPROACH FOR NETWORK INTRUSION DETECTION USING ENTROPY BASED FEATURE S...
PPTX
TensorFlow.pptx
PPTX
Sachpazis: Demystifying Neural Networks: A Comprehensive Guide
DOCX
introduction to machine learning unit III
PPTX
House price prediction
PDF
Feed forward neural network for sine
Digit recognition using mnist database
Convolutional Neural Network for Text Classification
dfdshofdifhdifhdfhgfoighfgofgfgfgfgdfdfdfdf
Hand Written Digit Classification
Evolving Comprehensible Neural Network Trees
Integrating Artificial Intelligence with IoT
IRJET - Study on the Effects of Increase in the Depth of the Feature Extracto...
Handwritten digit and symbol recognition using CNN.pptx
AI Class Topic 6: Easy Way to Learn Deep Learning AI Technologies
X-TREPAN: A MULTI CLASS REGRESSION AND ADAPTED EXTRACTION OF COMPREHENSIBLE D...
X-TREPAN : A Multi Class Regression and Adapted Extraction of Comprehensible ...
An ann approach for network
artificial-neural-network-seminar-report.docx
Build a simple image recognition system with tensor flow
AN ANN APPROACH FOR NETWORK INTRUSION DETECTION USING ENTROPY BASED FEATURE S...
TensorFlow.pptx
Sachpazis: Demystifying Neural Networks: A Comprehensive Guide
introduction to machine learning unit III
House price prediction
Feed forward neural network for sine
Ad

Recently uploaded (20)

PDF
August Patch Tuesday
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
The various Industrial Revolutions .pptx
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
project resource management chapter-09.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Modernising the Digital Integration Hub
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
August Patch Tuesday
Final SEM Unit 1 for mit wpu at pune .pptx
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Module 1.ppt Iot fundamentals and Architecture
A comparative study of natural language inference in Swahili using monolingua...
The various Industrial Revolutions .pptx
Web App vs Mobile App What Should You Build First.pdf
Developing a website for English-speaking practice to English as a foreign la...
Enhancing emotion recognition model for a student engagement use case through...
A novel scalable deep ensemble learning framework for big data classification...
project resource management chapter-09.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Programs and apps: productivity, graphics, security and other tools
Univ-Connecticut-ChatGPT-Presentaion.pdf
Modernising the Digital Integration Hub
DP Operators-handbook-extract for the Mautical Institute
NewMind AI Weekly Chronicles – August ’25 Week III

Handwritten digits recognition report

  • 1. Handwritten Digits Recognition Jan 14, 2020 Abstract In this paper I present an Keras Sequential Neural Network to tackle the recognition of human handwritten digits. The Neural Network proposed here is experimented on the well-known MNIST data set. Without any pre-processing of the data set, our Neural Network achieves quite low classification error. Combined with clustering techniques, we can build artificial intelligence system which can automatically segment individual digit from images and find its corresponding label. Introduction In this project, a handwritten digits recognition system was implemented with the famous MNIST data set. This is not a new topic and the after several decades, the MNIST data set is still very popular and important for evaluation and validation of new algorithms. Handwritten digits recognition problem has been studied by researchers since 1998 with almost all the algorithms designed by then and even until now. The test error rate decreased from 12% in 1988 by linear classifier to 0.23% in 2012 by convolutional nets, and these days more and more data scientists and machine learning experts are trying to develop and validate unsupervised learning methods such as auto-encoder and deep learning model. Methods The program I implement will mainly focus on identifying 0-9 from segmented pictures of handwritten digits.For simplicity, input images are pre-treated to be of certain fixed size, and each input image should contain only one unknown digit in the middle. These requirements are not too harsh because they can be achieved using simple image processing or computer vision techniques. In addition, such pre- treated image data set are easy to obtain. In my implementation,the popular MNIST data set ([1]) is a good choice. Each image in MNIST is already normalized to 28x28 in the above sense and the data set itself is publicly available. The MNIST data set is really a huge one: it contains 60000 training samples and 10000 test samples. And it has become a standard data set for testing various algorithms.The output of my program will be the corresponding 0-9 digit contained in input image. The method I use is Keras Sequential Neural Network using Tensorflow. Unlike lazy learning method such as Nearest Neighbor Classifier that stores the whole training set and classify new input case by case, This will implicitly learn the corresponding rule between image of handwritten digits and the actual 0-9 identities. Preferably, I
  • 2. want the output units provide the conditional probability (thus the output of each unit is between 0 and 1, and the outputs of all 10 units will sum to 1) of each class to which each input belongs, and the unit that has the maximum output will determine the class label. As a result, softmax activation is the desirable choice for output units.The unit corresponding to the right class label of each input has value 0.91, while other units have the same value 0.01. I do not set them to be 1s and 0s because extreme value are hard to be achieved by activation functions. Results and Discussions Among all the methods I tried on MNIST dataset, I preferred the model which I built using Keras Sequential Neural Network using Tensorflow, has the best performance, which is 97.2899% accuracy, which is quiet accurate 2.73% error rate, but not always repeatable. Tweaking the kernel sizes and numbers of convolutional layers indicates that more convolutional layers are helpful to improve the accuracy while change kernel size has little effect and the accuracy even decreased sometime.
  • 3. Source Code import tensorflow as tf mnist=tf.keras.datasets.mnist (x_train,y_train),(x_test,y_test)=mnist.load_data() x_train=tf.keras.utils.normalize(x_train,axis=1) x_test=tf.keras.utils.normalize(x_test,axis=1) model=tf.keras.models.Sequential() model.add(tf.keras.layers.Flatten()) model.add(tf.keras.layers.Dense(128,activation=tf.nn.relu)) model.add(tf.keras.layers.Dense(128,activation=tf.nn.relu)) model.add(tf.keras.layers.Dense(10,activation=tf.nn.softmax)) model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy']) model.fit(x_train,y_train,epochs=3) val_loss,val_acc=model.evaluate(x_test,y_test) print(val_loss*100,val_acc*100) import matplotlib.pyplot as plt plt.imshow(x_train[0]) plt.show() print(x_train[0]) model.save("epic_num_reader.model") new_model=tf.keras.models.load_model("epic_num_reader.model") predictions=new_model.predict([x_test]) print(predictions) import numpy as np print(np.argmax(predictions,axis=1))
  • 4. for i in range(0,11): first_image=x_test[i] first_image=np.array(first_image,dtype='float') pixels=first_image.reshape((28,28)) plt.imshow(pixels) plt.show() Conclusion In conclusion, I implement a large Sequential neural network for human handwritten digits. I train the NN with cross entropy using error back propagation to obtain optimal weights values. I also find useful applications for the NN I generate. By doing this project, I have practiced using what I have learned in the Machine Learning course. My program probably does not beat the state of the art in handwritten digit recognition. However, I have for the first time observed the practical problems of using the powerful Neural Networks. This experience will definitely be helpful for my future research. Acknowledgments I want to thank the whole Eckovation team and specially the mentors for this course Machine Learning. I really learn a lot of new things from their lectures. I am also grateful to them for constant support for their useful discussions in Forum group with details of the project. ____________ Name: Swayamdipta Saha E-mail: swayamsaha@gmail.com