Giter Club home page Giter Club logo

hand_written_letter_recongnition's Introduction

Hand Written Letter Recongnition

Introduction

This project houses a collection of machine learning models including ANN, CNN, and a meta-model which is a combination of CNN and ANN. https://sketch2letter-82e3eb8c54bf.herokuapp.com/ is the web app that allows use to write letters by hand, and the pre-trained model will return the result. To train the model, ensure to set up your environment properly by following the steps outlined below.

Installation

To set up the necessary environment to train the models. We recommand using conda/miniconda. You will need to install several packages and python 3.10.12 You can install all the required packages using the following command:

pip install optuna numpy tensorflow tensorflow-datasets==4.0.1 scikit-learn tqdm matplotlib pydot graphviz

Script Overview

  1. Load pre-trained ANN and CNN model.
  2. Generate predictions from both ANN and CNN model.
  3. stacks the predictions from the ANN and CNN models.
  4. Creates, compiles, and trains a meta-model using the stacked predictions.
  5. Saves the trained meta-model to the specified path.
  6. Generates a confusion matrix and a classification report to evaluate the performance of the meta-model and saves the confusion matrix plot to a PNG file.

Trainning the Models

The working directory is FlaskApp

cd FlaskApp

ANN model

To train the ANN model, use the following command in your terminal:

python ./ANN_src/bayesianTuning.py

CNN model

To train the ANN model, use the following command in your terminal:

python ./CNN_src/cnn_model.py

Meta model

To train the ANN model, use the following command in your terminal:

python ./META_model_src/meta_model.py

Performance

Accuracy Table

Model Type Test Set Accuracy
CNN 93.4%
ANN 92.9%
Meta Model 95.0%
SOTA Method 95.96%

Condusion Matrix

CNN Matrix

CNN Confusion Matrix CNN is prone to making mistakes in the identification of (q,g), (i,l). The errors are mostly concentrated in partial recognition.

ANN Matrix

ANN Confusion Matrix ANN is prone to making mistakes in the identification of (q,g), (i,l), but this model will return low confidense when the letter is ambiguous.

Meta Model Matrix

Meta Confusion Matrix Meta is prone to making mistakes in the identification of (q,g), (i,l).

Training and Validation Loss and Accuracy

CNN Loss and Accuracy

CNN Loss

ANN Loss and Accuracy

ANN Loss ANN Accuracy

Meta Loss and Accuracy

Meta Loss Meta Accuracy

Model Architecture

CNN Model Architecture

CNN Model Architecture

ANN Model Architecture

ANN Model Architecture

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.