Posted on

Handwritten digit recognition Python Flask

Handwritten digit recognition is an important application of machine learning, particularly in the field of computer vision. The task involves identifying handwritten digits from an image and classifying them into the corresponding numerical values. In this project, we have developed a Flask-based application that recognizes handwritten digits using a pre-trained machine learning model.


The objective of this project is to build a machine learning model that can accurately recognize handwritten digits and to develop a Flask-based web application that utilizes the model to recognize digits entered by users.


We used the MNIST dataset for training and testing our machine learning model. This dataset consists of 60,000 training images and 10,000 test images of handwritten digits from 0 to 9. We used a convolutional neural network (CNN) architecture to train our model on this dataset.

Once the model was trained and tested, we saved it as a serialized object using the joblib library. We then developed a Flask-based web application that allows users to draw a digit using their mouse or touchscreen and submit the image to the model for recognition.


Our machine learning model achieved an accuracy of 99.1% on the MNIST test set. When integrated with the Flask application, the model is able to accurately recognize handwritten digits drawn by users in real-time.

Technology Overview:

  1. Machine Learning – Machine learning is a subfield of artificial intelligence that enables machines to learn from data, without being explicitly programmed. In this project, we used machine learning algorithms to recognize handwritten digits.
  2. Convolutional Neural Networks – Convolutional Neural Networks (CNNs) are a class of deep neural networks commonly used in image processing and computer vision tasks. CNNs are designed to recognize visual patterns directly from pixel images, making them well-suited for tasks like image classification and object detection.
  3. Flask – Flask is a lightweight web framework that enables the development of web applications in Python. In this project, we used Flask to develop a web application that allows users to input handwritten digits and receive predictions from the trained machine learning model.
  4. MNIST Dataset – The MNIST dataset is a large database of handwritten digits commonly used for training and testing machine learning models. The dataset consists of 60,000 training images and 10,000 test images of handwritten digits from 0 to 9.
  5. Joblib – Joblib is a library for Python that enables the efficient serialization and deserialization of Python objects. In this project, we used Joblib to save and load the trained machine learning model.

Download Link

For Live Demo & Enquiry  :

WhatsApps : +916263056779

Email :

Posted on

Artificial Intelligence Project Handwritten Digits Recognition

The handwritten digit recognition is the capability of computer applications to recognize the human handwritten digits. It is a hard task for the machine because handwritten digits are not perfect and can be made with many different shapes and sizes. The handwritten digit recognition system is a way to tackle this
problem which uses the image of a digit and recognizes the digit present in the image. Convolutional Neural Network model created using PyTorch library over the MNIST dataset to recognize handwritten digits .

Handwritten Digit Recognition is the capability of a computer to fete the mortal handwritten integers from different sources like imagespaperstouch defenses, etc, and classify.  them into 10 predefined classes (0-9). This has beenContent of bottomlessexploration in the field of deep literacyNumber recognition has numerous operations like number plate recognition, postal correspondence sorting, bank check processing, etc . (2). In Handwritten number recognition,   we face numerous challenges . because of different styles of jotting of different peoples as it .  is not an Optic character recognition. This exploration provides
comprehensive comparison between different machine literacy and deep literacy algorithms for the purpose of handwritten number recognition. For this, we've used Support . Vector Machine, Multilayer Perceptron, and Convolutional . Neural Network. The comparison between these algorithms is carried out on the base of their delicacycrimes, and .testing- training time corroborated by plots and maps that have been constructed using matplotlib for visualization.

Datasets Details : -

The MNIST dataset is an acronym that stands for the Modified National Institute of Standards and Technology dataset.

It is a dataset of 60,000 small square 28×28 pixel grayscale images of handwritten single digits between 0 and 9.

The task is to classify a given image of a handwritten digit into one of 10 classes representing integer values from 0 to 9, inclusively.

It is a widely used and deeply understood dataset and, for the most part, is “solved.” Top-performing models are deep learning convolutional neural networks that achieve a classification accuracy of above 99%, with an error rate between 0.4 %and 0.2% on the hold out test dataset.

Handwritten character recognition is an extensive exploration area that formerly contains detailed ways of perpetration which include major literacy datasets, popular algorithms,  . features scaling and point birth styles. MNIST dataset ( Modified National Institute of Norms and Technology database) is the subset of the NIST dataset which is a combination of two of NIST’s databases Special.  Database 1 and Special Database 3. Special Database 1 and Special Database 3 correspond of integers written by high academy scholars and workers of the United States Census Bureau,.  independently. MNIST contains a aggregate of handwritten . number images (- training set and- test set) in .  28x28 pixel bounding box andanti-aliased. All these images have corresponding Y values which apprises what the number

Implementation Steps : -

  1. Import the libraries and load the dataset
  2. Preprocess the data
  3. Create the model
  4. Train the model
  5. Evaluate the model
  6. Create GUI to predict digits

Requirements .txt file :-

  1. torch
  2. numpy==1.16.5
  3. flask==1.1.1
  4. gunicorn
  5. matplotlib==3.3.1
  6. pillow==6.2.0
  7. flake8
  8. pip
  9. pylint

Download Source Code