ML MiniProject Report

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 39

“DIGIT RECOGINITION USING

MNIST DATASET”
Mini Project Report

Submitted in partial fulfillment of the requirements for the degree of


Bachelor of Engineering (Computer Engineering)

by:

Pritam Nikalaje TU3F1819007

Abhishek Raghav TU3F1819032

Aniket Thorat TU3F1819038

Under the Guidance


of Prof. Ujwala
Gaikwad

Department of Computer Engineering


TERNA ENGINEERING COLLEGE
Nerul (W), Navi Mumbai 400706
(University of Mumbai)
(2020-21)
01
Internal Approval Sheet

TERNA ENGINEERING COLLEGE, NERUL


Department of Computer Engineering
Academic Year 2020-21

CERTIFICATE

This is to certify that the mini project 1A entitled “DIGIT RECOGINITION


USING MNIST DATASET” is a bonafide
work of

Pritam Nikalaje TU3F1819007

Abhishek Raghav TU3F1819032

Aniket Thorat TU3F1819038

submitted to the University of Mumbai in partial fulfillment of the requirement


for the award of the Bachelor of Engineering (Computer Engineering).

Guide Head of Department Principal

02
Approval Sheet
Project Report Approval

This Mini Project 1A Report – entitled “DIGIT RECOGINITION


USING MNIST DATASET” by following
students is approved for the degree of B.E. in "Computer Engineering".

Submitted by:

Pritam Nikalaje TU3F1819007

Abhishek Raghav TU3F1819032

Aniket Thorat TU3F1819038

Examiners Name & Signature:

1.

2.

Date:

Place:

03
Declaration
We declare that this written submission represents our ideas in our own words
and where others' ideas or words have been included, we have adequately
cited and referenced the original sources. We also declare that we have
adhered to all principles of academic honesty and integrity and have not
misrepresented or fabricated or falsified any idea/data/fact/source in our
submission. We understand that any violation of the above will be cause for
disciplinary action by the Institute and can also evoke penal action from the
sources which have thus not been properly cited or from whom proper
permission has not been taken when needed.

Pritam Nikalaje TU3F1819007 ---------------------------

Abhishek Raghav TU3F1819032

Aniket Thorat TU3F1819038

Date:

Place:

04
Acknowledgement

We would like to express our sincere gratitude towards our guide Prof. Ujwala
Gaikwad, Mini Project Coordinators Prof. Randeep Kaur, Prof. Nilesh
Kulal, Prof. Dnyaneshwar Bavkar, Prof. Vishwajit Gaikwad for their help,
guidance and encouragement, they provided during the project development.
This work would have not been possible without their valuable time, patience
and motivation. We thank them for making our stint thoroughly pleasant and
enriching. It was great learning and an honor being their student.

We are deeply thankful to Dr. Archana Mire (H.O.D Computer Department)


and the entire team in the Computer Department. They supported us with
scientific guidance, advice and encouragement, they were always helpful and
enthusiastic and this inspired us in our work.

We take the privilege to express our sincere thanks to Dr. L. K. Ragha our
Principal for providing encouragement and much support throughout our work.

Pritam Nikalaje TU3F1819007

Abhishek Raghav TU3F1819032

Aniket Thorat TU3F1819038

Date:

Place:
05
Abstract

The task for handwritten digit recognition has been troublesome due to various
variations in writing styles. Therefore, we have tried to create a base for future
researches in the area so that the researchers can overcome the existing
problems. The existing methods and techniques for handwritten digit
recognition were reviewed and understood to analyze the most suitable and best
method for digit recognition. A number of 60,000 images were used as training
sets of images with pixel size of 8×8. The images/training sets were matched
with original image. It was found out after complete analysis and review that
classifier ensemble system has the least error rate of just 1.28%. In this paper,
review of different methods handwritten digit recognition were observed and
analyzed.

06
Table of Contents
Chapter 1 Introduction 09
1.1 Aim and Objectives of Project 10
1.2 Scope 10
1.3 Organization of Report 11
Chapter 2 Literature Survey 12
2.1 Existing System 14
Chapter 3 Software Analysis
3.1 Waterfall Model 15
3.1.1 Phases of Waterfall model 16
3.2 Proposed System 17
Chapter 4 Design and Implementation
4.1 Use Case Diagram 18
4.2 Flowchart Diagram 19
4.3 State Chart Diagram 20
4.4 Sequence Diagram 21
4.5 Hardware and Software Requirement 22
4.6 Software Requirement 23
Chapter 5 Methodology
5.1 Project Module 24
Chapter 6 Implementation Detail
6.1 Working of System 25
Chapter 7 Performance Evaluation
7.1 Evaluation metrics 26
7.2 Experimental setup 27
7.2.1 Description of Data 28
7.2.2 Methodology used to perform experiment 29
Chapter 8 Problem Timeline
8.1 Gantt Chart 30
Chapter 9 Results
9.1 Project Screenshots 32
Chapter 10 Conclusion 34
References 35

07
List of Figures

Sr. No Figure Name Pg.


No
03.01 Waterfall Model 15
04.01 Use Cases Diagram 18
04.02 Flowchart Diagram 19

04.03 State Chart Diagram 20


07.02 Sequence Diagram 21
07.03 Gantt Chart 30

08
Chapter 1

INTRODUCTION

Handwritten image recognition is probably one of the most interesting and


challenging applications in the field of pattern recognition. Handwritten
recognition is divided into two types of techniques: on-line and off-line. Off-
line techniques include reading the character using an image capture device,
such as a camera. while the technique which is being dealt here is Off-line
which means to convert a handwritten image into a machine-readable form.
The major factor behind choosing this particular application is its numerous
applications such as Automatic Number Plate Recognition, assisting blind
and visually impaired people, automatic check processing for banks, and to
process huge number of documents in industries like healthcare, legal,
education, and finance the focus if the work described in this paper is on
handwritten digits. The paper will further be covering data collection, image
preprocessing, feature extraction, and finally classification.

09
1.1 Aim and Objectives of Project

As a lot of problem arises when it comes to reading or recognizing digits


written by different peoples of different occupations. It is helpful to process
huge number of documents in hospitals or other data collecting industries
whether educational or other stuffs.
In order to ease all these peoples and industries works recognizing digits
we’re building this model, which will be very helpful.

1.2 Scope

 The current model works on 8x8 image which can substituted to a higher
resolution image.
 We can implement higher machine learning technique like neural network
in the build.
 We can also make use of deep learning technique in our model.

10
1.3 Organization Of The Report
The organization of this report will be presented below. This structure
represents the flow made
for the elaboration of the system, so that the reader can analyze in a
sequential way each one of the necessary steps for the elaboration of such a
system.

Chapter 1 gives an introduction to the project. In this chapter, the research


question has been presented, which will be analyzed throughout the elaboration
of the project.

Chapter 2 presents the literature review done before implementation of the


project and the observations and conclusions made on the basis of the
information gathered.

Chapter 3 discusses the flow of work described using a waterfall model and
further describes the proposed system in the project.

Chapter 4 consists of various UML diagrams which provides a standard way


to visualize the design of the system
.
Chapter 5 describes the methodology and how was the project physically
carried out along with description of the project modules.

Chapter 6 detail implementation in detail

Chapter 7 helps to evaluate the performance of the project by construction


and training of the model.

Chapter 8 shows the Gantt chart of the project.

Chapter 9 describes the results

Chapter 10 is the conclusion.

11
Chapter 2

Research paper 1 :
TITLE :
Handwritten Digit Recognition Using Structural, Statistical Features and K-nearest
Neighbor Classifier

Observation :
The proposed algorithm is tested on MNIST digit database. The Algorithms uses
60,000 training sample of numerals and 5000 testing samples. The algorithm is executed
for k=1, k=3, and k=5 and results are listed out. The results are compared to find out the
optimum value of k. it is clear that k=1 is optimal value. The recognition rate of individual
digits Test database of MNIST is listed out. The overall recognition rate is found to be
98.42%

Conclusion :
In this paper, we used thirteen (13) statistical and five (5) structural features for
recognition of handwritten numerals. In any recognition process, the important
problem is to address the feature extraction and correct classification approaches. The
Overall accuracy of 98.42% is achieved in the recognition process.

Accuracy Result :
A total 5000 numeral images are tested, and the overall accuracy is found to be 98.42%.

Author :
U Ravi Babu Research Scholar, Aacharya Nagarjuna University Assoc. Professor – GIET
Rajahmundry, A.P, India uppu.ravibabu@gmail.com Aneel Kumar Chintha M.Tech (CSE)
Studen, GIET, Rajahmundry, A.P, India aneelkumar.chintha@gmail.com Dr. Y
Venkateswarlu Professor & Head, Department of CSE GIET Engg College, Rajahmundry,
A.P, India yalla_venkat@yahoo.com

12
Research paper 2 :
TITLE :
Offline Handwritten Digits Recognition Using
Machine learning

Conclusion :
This paper has practiced different machine learning technique and different models for data
training
attempting to discover a representation of isolated handwritten digits that allow their
effective recognition and to
achieve the highest accuracy of predicting handwritten numeral. Thus, this study settled on
classifying a given
handwritten digit image as the required digit using five different algorithms and
consequently testing its accuracy.
This study built handwritten recognizers evaluated their performances on MNIST (Mixed
National Institute of
Standards and Technology) dataset and then improved the training speed and the
recognition performance.

Accuracy Result :
Using the dataset obtained by Image Attribute Reduction in MATLAB (discussed earlier in
the preprocessing section)
analysis is done to check the accuracy of the classifier K-NN and Neural Net.
With 196 attributes, we
got an accuracy of 95.73% and 95.93% in Neural Net and K-NN respectively.

Author :
Shengfeng Chen
1Department of Industrial Engineering Western Michigan University, Kalamazoo, MI.
Rabia Almamlook
2Department of Industrial Engineering Western Michigan University, Kalamazoo, MI.

13
2.1 Existing System

The current Digit/Pattern Recognition model is found very useful in all these
industrial fields or for persons in need.

Currently, there are model which are build based on higher machine learning
technique like neural network and deep learning which has high performance.

14
Chapter 3

SOFTWARE ANALYSIS

3.1 Waterfall Model

Figure.3.1 Waterfall Model


15
3.1.1 Phases Of Waterfall Model
➢ Feasibilty Study: During this phase, all the knowledge that is required
to create this project i.e machine learning concepts and how to handle
the data is learned.

➢ Requirement Gathering phase: During this phase, the required data


ie. The dataset which is required in this project is gathered and send to the
next phase.

➢ Analysis phase: This phase aims to build the requirements of the


system through a critical view of the knowledge previously acquired.
It is possible to go back to the second phase to gain additional
information and then include it in the analysis.

➢ Design Phase: During this phase, there may also be a need for new
insights or more detailed analysis.

➢ Testing Phase: The results obtained will then be evaluated in the Testing phase.

➢ Future perspectives phase: Finally, the entire system development


process will be discussed through this phase. It is important to
understand the reasons behind the choice of this working method this
methodology which allows improving the results returning to previous
phases if necessary.

16
3.2 Proposed System

The core part of our application is the algorithm guessing the drawn number. Machine
learning will be the tool used to achieve a good guess quality. This kind of basic method
allows a system to learn automatically with a given amount of data. In broader terms,
machine learning is a process of finding a coincidence or set of coincidences in the data to
rely on them to guess the result.

Our image recognition process contains three steps:

 Get images from MNIST dataset

 Train the system to guess the numbers via training data

 Test the system with new/unknown data

17
Chapter 4

DESIGN AND IMPLEMENTATION


This chapter will give a pictorial depiction of the design and implementation of
the proposed system mentioned in chapter 3.1. The chapter comprises various
different diagrams which help us to understand the structure and composition
of the model effortlessly.

4.1 Use Case Diagram

Figure 4.1

18
4.2 Flowchart Diagram

Figure 4.2

19
4.3 State Chart Diagram

Figure 4.3

20
4.4 Sequence Diagram

Figure 4.4

21
4.5 Hardware and Software Requirements
Software Requirements Specification
➢ Python 3 in-line IDE (Google Colab)
➢ Jupyter Notebook

Libraries
➢ Tkinter
➢ Scikit-learn
➢ Numpy
➢ Matplotlib

Operating System
➢ Windows/MAC

Hardware Requirements Specification


➢ Laptop with basic hardware
➢ Desktop with basic hardware

22
4.6 Software Components
➢ Python3:-
The project is constructed using Python programming language.

➢ Libraries:-
Sklearn:- Scikit-learn is probably the most useful library for
machine learning in Python. The sklearn library contains a lot of efficient tools
for machine learning and statistical modeling including classification,
regression, clustering and dimensionality reduction

Numpy:- NumPy is a Python library used for working with arrays. It also


has functions for working in domain of linear algebra, fourier transform, and
matrices. It is an open source project and you can use it freely. NumPy stands
for Numerical Python.

Matplotlib:- Matplotlib. pyplot is a collection of functions that


make matplotlib work like MATLAB. Each pyplot function makes some change
to a figure: e.g., creates a figure, creates a plotting area in a figure, plots some
lines in a plotting area, decorates the plot with labels, etc.

Tkinter: Tkinter is Python's de-facto standard GUI (Graphical User


Interface) package. It is a thin object-oriented layer on top of Tcl/Tk. Tkinter is
not the only GuiProgramming toolkit for Python. It is however the most
commonly used one. ... Graphical User Interfaces with Tk, a chapter from
the Python Documentation.

Seaborn:- Seaborn is a Python data visualization library based on


matplotlib. It provides a high-level interface for drawing attractive and
informative statistical graphics. Its plotting functions operate on dataframes and
arrays containing whole datasets and internally perform the necessary semantic
mapping and statistical aggregation to produce informative plots.

23
Chapter 5

METHODOLOGY
5.1 Project Modules
The project can be divided into these modules:

1. Dataset preparation:- Inorder to train our model better ,a large amount of data
is required to train it. So, to achieve that goal we are using already preprocessed
dataset “MNIST”. So we can assume we don’t need to clean the data as its
already preprocessed.

2. Model Training:- This process entails feeding the model with training data.
The model will process the data using specific classifier and predict the outputs
after giving proper input.

3. Visualization predicted output:- To check the output of the test set once the
model is trained.

4. Accuracy evaluation:- Accuracy ,confusion matrices can be achieved for a


machine by using certain analytics libraries. Thus, to check how our model is
working.

24
Chapter 6

IMPLEMENTATION DETAILS
6.1 Working of the system

The data flow will run through each of the modules mentioned in Chapter 5.1,
presenting a final result through the last of them. In addition, each of the modules makes
use of different libraries that provide them with predetermined functions.
At the very beginning we fetch our dataset from MNIST dataset. After
fetching/collecting data we split the data into training and testing. Then we make use of
training data to train the model.
Then we use KNN-classifier to build our model which is already trained and ready
to be tested by determining its accuracy.
We got accuracy about 98.42% using KNN-classifier on test dataset, which proves
that our model is quite good and trained well. So after computing accuracy we determine
Confusion Matrix to check its precision .

After fully building our model we create a GUI which consists of a canvas board to
draw a number in it which is needed to predict by the user. GUI also consists of “CLEAR”
and “PREDICT” option .

If a user wants to try another number to predict he simply clicks on CLEAR and draw
another number and click on PREDICT to check whether our model predicted correct or
not.

25
Chapter 7

PERFORMANCE EVALUATION
7.1 Evaluation Metrics
1. Confusion matrix

26
2. Accuracy:
Test Data:- 98.42%

7.2 Experiment Setup


The project was implemented on Google Collab, in-line code
execution IDE as it allows the programmer to inspect the dataset and
changes in the dataset after a certain block of code. We’ve used
Python 3 as the runtime type and GPU as the hardware accelerator.
Various libraries have been explored in the duration of the project
and the essential and compatible ones have been utilized.

27
7.2.1Description of Data

The MNIST database (Modified National Institute of Standards and


Technology database) is a large database of handwritten digits that is
commonly used for training various image processing systems. The database is
also widely used for training and testing in the field of machine learning. It was
created by "re-mixing" the samples from NIST's original datasets. The creators
felt that since NIST's training dataset was taken from American Census
Bureau employees, while the testing dataset was taken from American high
school students, it was not well-suited for machine learning
experiments. Furthermore, the black and white images from NIST
were normalized to fit into a 8x8 pixel bounding box and anti-aliased, which
introduced grayscale levels.
The MNIST database contains 60,000 training images and 10,000 testing
images. Half of the training set and half of the test set were taken from NIST's
training dataset, while the other half of the training set and the other half of the
test set were taken from NIST's testing dataset. The original creators of the
database keep a list of some of the methods tested on it.

28
7.2.1 Methodology Used To Perform Experiment
k-nearest neighbors algorithm’s an algorithm that gets some data samples and
arranges them on a plane ordered by a given set of characteristics. To
understand it better, let’s review the following image:

To detect the type of the Green Dot, we should check the types of k nearest
neighbors where k is the argument set. Considering the image above, if k is
equal to 1, 2, 3, or 4, the guess will be a Black Triangle as most of the green
dot’s closest k neighbors are black triangles. If we increase k to 5, then the
majority of the objects are blue squares, hence the guess will be a Blue Square.

 sklearn.neighbors.KNeighborsClassifier is the classifier provided by


sklearn, which we are going to implement in our project.

29
Chapter 8

PROBLEM TIMELINE

8.1 Gantt Chart

15/12/20 04/01/21 24/01/21 13/02/21 05/03/21 25/03/21 14/04/21 04/05/21 24/05/21

Feasibility Study

Requirement Gathering

Analysis

1st Review

Design

Testing

Revaluation and Report

2nd Review

30
TASKS START END DAYS

Feasibility Study 05/02/2021 14/02/2021 09

Requirement Gathering 15/02/2021 03/03/2021 16

Analysis 03/03/2021 18/03/2021 15

1st Review 20/03/2021 20/03/2021 01

Design 23/03/2021 01/04/2021 09

Testing 01/04/2021 21/04/2021 20

Revaluation and Report 22/04/2021 30/04/2021 08

2nd Review 01/05/2021 04/05/2021 04

31
Chapter 9

RESULTS
9.1 Project Screenshots

32
33
Chapter 10

CONCLUSION

Thus we have created a application with which we are able to


detect the number which is provided by user i.e drawn by the user on
the canvas. As the model works on 8x8 images, it is difficult for the
users to send the proper data as it is a very small size. The user draws
the digit on canvas which convert it into proper standards for model
to process but the data is loss as the compression is too high, so it
effects the performance of the application i.e it makes it difficult for
the model to predict the digit.
We hope we can solve this issue by training the model with
images of higher resolution.

34
REFERENCES

Link :

 https://www.researchgate.net/publication/272854375_Handwritten_Digit_
Recognition_Using_Structural_Statistical_Features_and_K-
nearest_Neighbor_Classifier
 http://ieomsociety.org/dc2018/papers/123.pdf

 https://scikitlearn.org/stable/modules/generated/sklearn.neighbors.KNeigh
borsClassifier.html

35

You might also like