• Stars
    star
    223
  • Rank 178,458 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Handwritten Digit Recognition using Machine Learning and Deep Learning

Handwritten Digit Recognition using Machine Learning and Deep Learning

Published Paper

IJARCET-VOL-6-ISSUE-7-990-997

Requirements

  • Python 3.5 +
  • Scikit-Learn (latest version)
  • Numpy (+ mkl for Windows)
  • Matplotlib

Usage

1. Download the four MNIST dataset files from this link:

curl -O http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz
curl -O http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz
curl -O http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz
curl -O http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz

Alternatively, you can download the dataset from here, unzip the files and place them in the respected folders.

2. Unzip and place the files in the dataset folder inside the MNIST_Dataset_Loader folder under each ML Algorithm folder i.e :

KNN
|_ MNIST_Dataset_Loader
   |_ dataset
      |_ train-images-idx3-ubyte
      |_ train-labels-idx1-ubyte
      |_ t10k-images-idx3-ubyte
      |_ t10k-labels-idx1-ubyte

Do this for SVM and RFC folders and you should be good to go.

3. To run the code, navigate to one of the directories for which you want to run the code using command prompt:

cd 1. K Nearest Neighbors/

and then run the file "knn.py" as follows:

python knn.py

or

python3 knn.py

This will run the code and all the print statements will be logged into the "summary.log" file.

NOTE: If you want to see the output to print on the Command prompt, just comment out line 16, 17, 18, 106 and 107 and hence you will get all the prints on the screen.

Alternatively, you can also use PyCharm to run the code and run the ".py" file in there.

Repeat the steps for SVM and RFC code.

4. To run the CNN code, you don't need to provide in the MNIST dataset as it'll be downloaded automatically.

Just run the file as :

python CNN_MNIST.py

or

python3 CNN_MNIST.py

and it should run fine.

5. If you want to save the CNN model weights after training, run the code with the following arguments:

python CNN_MNIST.py --save_model 1 --save_weights cnn_weights.hdf5

or

python3 CNN_MNIST.py --save_model 1 --save_weights cnn_weights.hdf5

and it should save the model weights in the same directory.

6. To load the saved model weights and avoid the training time again, use the following command:

python CNN_MNIST.py --load_model 1 --save_weights cnn_weights.hdf5

or

python3 CNN_MNIST.py --load_model 1 --save_weights cnn_weights.hdf5

and it should load the model and show the Outputs.

Accuracy using Machine Learning Algorithms:

i) K Nearest Neighbors: 96.67%

ii) SVM: 97.91%

iii) Random Forest Classifier: 96.82%

Accuracy using Deep Neural Networks:

i) Three Layer Convolutional Neural Network using Tensorflow: 99.70%

ii) Three Layer Convolutional Neural Network using Keras and Theano: 98.75%

All code written in Python 3.5. Code executed on Intel Xeon Processor / AWS EC2 Server.

Video Link:

https://www.youtube.com/watch?v=7kpYpmw5FfE

Test Images Classification Output:

Output a1

More Repositories

1

Feature-Selection-for-Machine-Learning

Methods with examples for Feature Selection during Pre-processing in Machine Learning.
Jupyter Notebook
365
star
2

Disease-Prediction-from-Symptoms

Disease Prediction based on Symptoms.
Jupyter Notebook
282
star
3

AI-Chatbot

AI Chatbot using Dynamic Memory Network in Keras.
Python
66
star
4

Python-Data-Structures-and-Algorithms

Data Structures & Algorithms Implementation in Python
Python
46
star
5

Artistic-Style-Transfer-using-Keras-Tensorflow

Art to Image Style Transfer using Keras and Tensorflow.
Python
29
star
6

iOS-ARKit

Basic Concepts and Projects using ARKit on iOS.
Swift
23
star
7

Audio-Scene-Classification

Scene Classification using Audio in the nearby Environment.
Jupyter Notebook
19
star
8

Data-Analyst-Nanodegree

Code and Projects for Data Analyst Nanodegree.
Jupyter Notebook
18
star
9

DeepLearning

Deep Learning Concepts and Research Paper Implementations.
Jupyter Notebook
17
star
10

RecurrentNeuralNetwork

Recurrent Neural Network from scratch using Python and Numpy
Python
14
star
11

ARCore-CloudAnchors

Android App to Save and Retrieve AR Anchors using ARCore from Local Storage / Firebase.
Java
11
star
12

Encrypted-Machine-Learning

Exploration and Projects using Encrypted Machine Learning.
Jupyter Notebook
7
star
13

BigData-and-Machine-Learning

Basics of Big Data and Machine Learning using Apache Spark and Scala
Scala
7
star
14

Hackerrank

Solution to Questions at Hackerrank.com
Python
6
star
15

iOS-Audio-Classification

Audio Classification on iOS using SoundAnalysis API.
Jupyter Notebook
6
star
16

Generative-Adversarial-Networks

Implementation of Ian Goodfellow's paper on "Generative Adversarial Networks (GAN)".
Python
6
star
17

ESPCN

Paper Implementation - "Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network".
Python
6
star
18

Machine-Learning

Machine Learning Tutorials.
Jupyter Notebook
5
star
19

3D-Binaural-Audio

3D Binaural Audio using ARCore for Android.
Java
4
star
20

PyTorch-DeepLearning

Deep Learning Tutorials using PyTorch.
Jupyter Notebook
4
star
21

Javascript-Machine-Learning

Machine Learning using Javascript.
JavaScript
3
star
22

Computer-Vision-Nanodegree

Jupyter Notebook
3
star
23

LwPosr-PyTorch

Paper Implementation - "LwPosr: Lightweight Efficient Fine Grained Head Pose Estimation"
Python
2
star
24

CNN-Deep-Layer-Filters-Visualization

CNN Deep Layer Filters Visualization using Tensorflow.
Python
2
star
25

LeetCode

Solutions to Problems at LeetCode.com
Python
2
star
26

Machine-Learning-Inference-on-Mobile-Devices

Code and Presentation for the talk "Machine Learning Inference on Mobile Devices"
Jupyter Notebook
2
star
27

OpenCV_with_Python

Image Processing and Computer Vision using Python and OpenCV.
Jupyter Notebook
1
star
28

Google-API-Tutorial

Google API Exploration for NLP and Computer Vision.
Python
1
star
29

anujdutt9.github.io

My Blog on ML, DL, NLP, Image Processing and a lot more.
HTML
1
star
30

Fashion-MNIST

Fashion Products Recognition using Machine Learning.
Python
1
star
31

Deep-Learning-TF-2.0

ML and DL Projects and Papers Implementations using TF-2.0.
Jupyter Notebook
1
star
32

DeepRender-Hardware-Test

DeepRender Hardware Test for deploying Lossless Image Compression model on iOS using CoreML.
Jupyter Notebook
1
star
33

Face-Gender-Classification

Jupyter Notebook
1
star
34

Language-Model-using-RNN

Text Generation using basic RNN from scratch using Python and Numpy.
Python
1
star
35

NewYorkCity-Taxi-Trip-Duration-Prediction

New York City Taxi Trip Duration Prediction dataset exploration.
Jupyter Notebook
1
star
36

Arduino-based-RADAR-System

Arduino based RADAR system
Processing
1
star
37

TFUG_Projects

Jupyter Notebook
1
star
38

Machine-Learning-Nanodegree

Projects for Udacity Machine Learning Nanodegree.
Jupyter Notebook
1
star
39

projects

My Blog on ML, DL, NLP, Image Processing and a lot more.
HTML
1
star
40

Android-Machine-Learning

Android Machine Learning using TF-Mobile and TF-Lite.
Python
1
star
41

Natural-Language-Processing

Basics of Natural Language Processing
Jupyter Notebook
1
star
42

Tensorflow-DeepLearning

Deep Learning Tutorials using Tensorflow.
Jupyter Notebook
1
star
43

TensorFlow-In-Practice-Specialization

Jupyter Notebook
1
star
44

iOS-MachineLearning

Machine Learning iOS applications.
Jupyter Notebook
1
star
45

OpenAI-API-Examples

Sample Applications built using OpenAI API's.
Jupyter Notebook
1
star
46

Self-Driving-Car-Nano-Degree

Self Driving Cars Nano-Degree Projects with some additional Basic Implementations.
Jupyter Notebook
1
star