Skip to content

The HandwrittA machine learning application that identifies and classifies handwritten digits (0-9) using a trained deep learning model.

Notifications You must be signed in to change notification settings

hasanulmukit/handwritten-digit-recognition

Repository files navigation

Handwritten Digit Recognitio

Overview

The Handwritten Digit Recognition System is a machine learning application that identifies and classifies handwritten digits (0-9) using a trained deep learning model. This project leverages TensorFlow/Keras and a Convolutional Neural Network (CNN) to achieve high accuracy in recognizing handwritten digits from images.

Features

  • Digit Classification: Identifies digits from 0 to 9.
  • High Accuracy: Utilizes a CNN model for precise predictions.
  • Streamlined Model Loading: Efficiently loads the pre-trained model for real-time predictions.
  • Ease of Use: Simple and intuitive Python implementation.

Requirements

  • Python 3.8+
  • TensorFlow 2.8+
  • NumPy
  • Matplotlib (optional, for visualizations)
  • Streamlit (optional, for building a web interface)

Installation

  1. Clone the repository:
    git clone <repository_url>
    cd handwritten_digit_recognition
  2. Install dependencies:
    pip install -r requirements.txt
  3. (Optional) Install Streamlit for a web interface:
    pip install streamlit

Usage

  1. Run Predictions with Python Script:

    python app.py

    Replace digit_recognition_model.keras with your model file if needed.

  2. Input Image for Prediction:

    • Provide an image containing a handwritten digit (28x28 grayscale).
    • The model will output the predicted digit with its confidence score.
  3. Run Streamlit App (if implemented):

    streamlit run app.py

Model Details

  • Architecture: Convolutional Neural Network (CNN) with multiple layers, including convolutional, pooling, and dense layers.
  • Dataset: Trained on the MNIST dataset, which contains 60,000 training and 10,000 testing images of handwritten digits.
  • Input Shape: 28x28 grayscale images.
  • Output: A single digit (0-9).

Example

Here is an example of how the system predicts a digit:

import tensorflow as tf
import numpy as np

# Load the model
model = tf.keras.models.load_model('digit_recognition_model.keras')

# Load and preprocess an image
image = np.zeros((28, 28))  # Example input image
image = image.reshape(1, 28, 28, 1) / 255.0  # Reshape and normalize

# Make a prediction
prediction = model.predict(image)
predicted_digit = np.argmax(prediction)
print(f"Predicted Digit: {predicted_digit}")

Future Enhancements

  • Add support for multi-digit recognition.
  • Enhance GUI/UX for a web-based interface.
  • Extend support for datasets beyond MNIST.

Feel free to explore, contribute, or modify this project!

About

The HandwrittA machine learning application that identifies and classifies handwritten digits (0-9) using a trained deep learning model.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages