Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hk-kumawat/handwritten-digit-recognizer
✍🏻🔢 The Handwritten Digit Recognizer uses a CNN model to classify handwritten digits (0–9), providing a user-friendly interface where users can draw a digit and receive real-time predictions of the input digit.
https://github.com/hk-kumawat/handwritten-digit-recognizer
cnn cv2 handwritten-digit-recognition mnist streamlit tensorflow
Last synced: 17 days ago
JSON representation
✍🏻🔢 The Handwritten Digit Recognizer uses a CNN model to classify handwritten digits (0–9), providing a user-friendly interface where users can draw a digit and receive real-time predictions of the input digit.
- Host: GitHub
- URL: https://github.com/hk-kumawat/handwritten-digit-recognizer
- Owner: hk-kumawat
- License: mit
- Created: 2024-10-31T17:56:28.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-10T21:35:57.000Z (29 days ago)
- Last Synced: 2025-01-10T21:43:56.425Z (29 days ago)
- Topics: cnn, cv2, handwritten-digit-recognition, mnist, streamlit, tensorflow
- Language: Jupyter Notebook
- Homepage: https://handwrittendigitpredictor.streamlit.app/
- Size: 13.2 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Handwritten Digit Recognizer✍🏻🔢
![sddefault](https://github.com/user-attachments/assets/7319a7b4-0ccd-4af0-b577-942fbd389da9)## Overview
The Handwritten Digit Recognizer project uses a Convolutional Neural Network (CNN) model to classify handwritten digits (0–9) based on the popular MNIST dataset. With a user-friendly interface, users can draw digits and receive real-time predictions, making it suitable for applications like digitizing notes and automated number plate recognition.
## Live Demo
Try out the Handwritten Digit Recognizer! 👉🏻 [![Experience It! 🌟](https://img.shields.io/badge/Experience%20It!-blue)](https://handwrittendigitpredictor.streamlit.app/)
_Below is a preview of the Handwritten Digit Recognizer in action. Draw a digit to see its prediction!_ 👇🏻
![]()
## Table of Contents
1. [Features](#features)
2. [Dataset](#dataset)
3. [Data Preprocessing](#data-preprocessing)
4. [Model Training](#model-training)
5. [Evaluation](#evaluation)
6. [Installation](#installation)
7. [Usage](#usage)
8. [Technologies Used](#technologies-used)
9. [Results](#results)
10. [Conclusion](#conclusion)
11. [License](#license)
12. [Contact](#contact)
## Features🌟
- Real-time digit recognition on a Streamlit interface with a drawable canvas.
- Provides predictions for handwritten digits (0–9).
- Utilizes a CNN model trained on 70,000 MNIST dataset images, ensuring reliable performance in digit classification.
## Dataset📊
- **MNIST Dataset**: Contains 70,000 grayscale images of handwritten digits (0–9), each of size 28x28 pixels.
- **Data Splits**: The dataset is divided into 60,000 training images and 10,000 testing images.
## Data Preprocessing🛠
1. **Normalization**: Pixel values are scaled between 0 and 1 to optimize CNN performance.
2. **Data Augmentation**: Applied random transformations to enhance model generalization.
## Model Training🧠
- **Model Architecture**: The model is based on a Convolutional Neural Network (CNN), designed with multiple layers to effectively extract features from handwritten digit images.
- **Training Process**: The model is trained using the MNIST dataset, incorporating data augmentation techniques to enhance the diversity of training samples. Early stopping is also utilized to prevent overfitting, ensuring improved generalization to unseen data.
## Evaluation📈
The model is evaluated using the following metrics:
- **Accuracy**: Measures the overall performance of the model by calculating the ratio of correct predictions to the total number of predictions. The model achieved a training accuracy of approximately `97.06%` and a validation accuracy of approximately `99.30%`, indicating excellent performance on both the training and validation datasets.
- **Loss**: Tracks the model's error during training and testing, utilizing categorical cross-entropy for this multi-class classification task. The training loss decreased to around `0.0985`, while the validation loss reached about `0.0221`, suggesting that the model is effectively learning from the data and generalizing well to unseen examples.
### Training Summary:
- **Epochs**: `10`
- **Final Training Accuracy**: `97.06%`
- **Final Validation Accuracy**: `99.30%`
- **Final Training Loss**: `0.0985`
- **Final Validation Loss**: `0.0221`### Accuracy and Loss Plots
The plots below illustrate the training and validation accuracy and loss over the epochs, demonstrating the model's performance improvement throughout the training process.- **Model Accuracy and Loss**:
![Screenshot 2024-11-02 205054](https://github.com/user-attachments/assets/e38c8e13-10a5-48eb-8b52-52f7ad9849e1)
## Installation🛠
1. **Clone the repository**:
```bash
https://github.com/hk-kumawat/Handwritten-Digit-Recognizer.git
```2. **Install dependencies**:
```bash
pip install -r requirements.txt
```
## Usage🚀
1. **Train the Model**:
- Run the Jupyter Notebook to train the CNN model on the MNIST dataset.
- The initial model is saved as `mnist_model.h5`, which achieved a certain accuracy.2. **Enhanced Model**:
- After further enhancements, a refined model is saved as `mnist_model_enhanced.h5`, yielding improved accuracy.3. **Model Inference**:
- Run the `streamlit.py` file to start the Streamlit app.
- Draw a digit on the canvas and click "Predict" to see the model's prediction.
## Technologies Used💻
- **Programming Language**: Python
- **Libraries**:
- `pandas`
- `numpy`
- `tensorflow`
- `keras`
- `streamlit`
- `streamlit_drawable_canvas`
- `seaborn`
- `opencv-python`
- `matplotlib`
- **Deployment**: Streamlit for a web-based user interface
## Results🏆
The model demonstrated impressive accuracy on the **MNIST test dataset**, achieving approximately `99.30%` validation accuracy. By leveraging a robust **Convolutional Neural Network (CNN)** architecture, it effectively predicts handwritten digits with minimal error. The model's performance was validated through metrics such as **accuracy** and **loss**, showcasing its ability to generalize well to unseen data.
## Conclusion📚
The Handwritten Digit Recognizer demonstrates the effectiveness of CNNs in image recognition tasks. With a simple user interface, the project showcases how AI can transform handwritten input into digital data, supporting applications from education to automated systems.
## License📝
This project is licensed under the **MIT License** - see the [LICENSE](./LICENSE) file for details.
## Contact
### 📬 Get in Touch!
I’d love to hear from you! Feel free to reach out:- [![GitHub](https://img.shields.io/badge/GitHub-hk--kumawat-blue?logo=github)](https://github.com/hk-kumawat) 💻 — Explore my projects and contributions.
- [![LinkedIn](https://img.shields.io/badge/LinkedIn-Harshal%20Kumawat-blue?logo=linkedin)](https://www.linkedin.com/in/harshal-kumawat/) 🌐 — Let’s connect professionally.
- [![Email](https://img.shields.io/badge/[email protected]?logo=gmail)](mailto:[email protected]) 📧 — Send me an email for any in-depth discussions.
---
## Thanks for exploring this project! 🔢
> "Turning each stroke of creativity into a recognizable digit, one digit at a time." – Anonymous