-
Notifications
You must be signed in to change notification settings - Fork 55
Handwriting Recognition using Deep Learning #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| # Handwriting Recognition on MNIST Dataset | ||
|
|
||
| ### AIM | ||
| To develop a system that recognizes handwritten digits using the MNIST dataset, leveraging deep learning techniques for high accuracy. | ||
|
|
||
| ### DATASET LINK | ||
| [https://www.kaggle.com/datasets/hojjatk/mnist-dataset](https://www.kaggle.com/datasets/hojjatk/mnist-dataset) | ||
|
|
||
| ### NOTEBOOK LINK | ||
|
|
||
| [https://colab.research.google.com/drive/1IPZ8Yy0UG_5NdcbwlgHhwMu4vr5fBaqu?usp=sharing](https://colab.research.google.com/drive/1IPZ8Yy0UG_5NdcbwlgHhwMu4vr5fBaqu?usp=sharing) | ||
|
|
||
| ### LIBRARIES NEEDED | ||
|
|
||
| ??? quote "LIBRARIES USED" | ||
|
|
||
| - tensorflow | ||
| - pandas | ||
| - numpy | ||
| - matplotlib | ||
| - idx2numpy | ||
| - seaborn | ||
| - sklearn | ||
|
|
||
| --- | ||
|
|
||
| ### DESCRIPTION | ||
|
|
||
| !!! info "What is the requirement of the project?" | ||
| - The project aims to create a system capable of recognizing handwritten digits. | ||
| - This involves in exploring deep learning models for image classification tasks. | ||
| - It provides accurate and efficient digit recognition. | ||
|
|
||
|
|
||
| ??? info "Why is it necessary?" | ||
| - It help in automating data entry and reduces human errors in digit recognition. | ||
| - It forms the foundation of several real-world applications like check reading, postal code recognition, and document scanning. | ||
| - It also demonstrates the potential of neural networks for image-based tasks. | ||
|
|
||
| ??? info "How is it beneficial and used?" | ||
| - **Banking sector :** it is used in the banking sector for processing checks. | ||
| - **Postal services :** it helps postal services for reading and sorting addresses. | ||
| - **Character recognition :** it enables advancements in Optical Character Recognition (OCR) technologies. | ||
|
|
||
| ??? info "How did you start approaching this project? (Initial thoughts and planning)" | ||
| - **Data Exploration :** Ive made attempts to understand and explore MNIST dataset for understanding the data structure. | ||
| - **CNN :** Ive did some research on Convolutional Neural Networks (CNNs) for image classification. | ||
| - **Optimizers :** Experimented with different architectures to optimize accuracy such as SGD[Stochastic Gradient Descent] and Adam[Adaptive Moment Estimation]. | ||
|
|
||
| ??? info "Mention any additional resources used (blogs, books, chapters, articles, research papers, etc.)" | ||
| - [https://www.mygreatlearning.com/blog/how-to-recognise-handwriting-with-machine-learning/](https://www.mygreatlearning.com/blog/how-to-recognise-handwriting-with-machine-learning/) | ||
| - [https://cs231n.stanford.edu/reports/2017/pdfs/810.pdf](https://cs231n.stanford.edu/reports/2017/pdfs/810.pdf) | ||
| - [https://youtu.be/iqQgED9vV7k?si=PRcpO-Fx4HeqFXuz](https://youtu.be/iqQgED9vV7k?si=PRcpO-Fx4HeqFXuz) | ||
|
|
||
| --- | ||
|
|
||
| ### EXPLANATION | ||
|
|
||
| #### DETAILS OF THE DIFFERENT FEATURES | ||
|
|
||
| - **Dataset**: MNIST dataset contains 60,000 training and 10,000 testing images of handwritten digits (0-9). | ||
| - **Preprocessing**: Normalized pixel values and reshaped images for compatibility with CNNs. | ||
| - **Model Architecture**: Built using TensorFlow/Keras, consisting of convolutional layers, max pooling, and fully connected layers. | ||
| - **Evaluation Metrics**: Accuracy and loss tracked during training and testing phases. | ||
|
|
||
| --- | ||
|
|
||
| #### WHAT I HAVE DONE | ||
|
|
||
| === "Step 1" | ||
|
|
||
| Initial data exploration and understanding: | ||
|
|
||
| - Loaded the MNIST dataset using TensorFlow/Keras. | ||
| - Explored the structure of the dataset, including image dimensions and class distribution. | ||
| - Visualized sample images to understand the nature of handwritten digits. | ||
|
|
||
| === "Step 2" | ||
|
|
||
| Data cleaning and preprocessing: | ||
|
|
||
| - Normalized pixel values to a range of [0, 1] for better convergence during training. | ||
| - Reshaped the images to match the input shape required by the CNN. | ||
| - Split the dataset into training, validation, and testing sets. | ||
|
|
||
| === "Step 3" | ||
|
|
||
| Feature engineering and selection: | ||
|
|
||
| - No manual feature engineering required as the CNN extracts features automatically. | ||
| - Applied data augmentation techniques (e.g., rotation, zoom, and flipping) to expand the dataset size and improve generalization. | ||
|
|
||
| === "Step 4" | ||
|
|
||
| Model training and evaluation: | ||
|
|
||
| - Built a Convolutional Neural Network (CNN) architecture with convolutional, max-pooling, dropout, and fully connected layers. | ||
| - Used the training set to train the CNN and the validation set to monitor performance and prevent overfitting. | ||
| - Evaluated the model using metrics such as accuracy and loss on both training and testing sets. | ||
|
|
||
| === "Step 5" | ||
|
|
||
| Model optimization and fine-tuning: | ||
|
|
||
| - Tuned hyperparameters such as learning rate, batch size, and number of epochs. | ||
| - Applied dropout to reduce overfitting and improve generalization. | ||
| - Experimented with different CNN architectures to achieve better accuracy. | ||
|
|
||
| === "Step 6" | ||
|
|
||
| Validation and testing: | ||
|
|
||
| - Validated the model on a separate validation set to ensure it generalizes well to unseen data. | ||
| - Tested the final trained model on the test dataset to assess real-world performance. | ||
|
|
||
| --- | ||
|
|
||
| #### PROJECT TRADE-OFFS AND SOLUTIONS | ||
|
|
||
| === "Trade-Off 1" | ||
|
|
||
| **Training time vs. model complexity :** | ||
|
|
||
| - Used a simpler architecture to balance accuracy and computational cost. | ||
|
|
||
| === "Trade-Off 2" | ||
|
|
||
| **Model accuracy vs. generalization :** | ||
|
|
||
| - Regularized the model using dropout layers to prevent overfitting. | ||
|
|
||
| --- | ||
|
|
||
| ### SCREENSHOTS | ||
|
|
||
| !!! success "Project structure or tree diagram" | ||
|
|
||
| ``` mermaid | ||
| graph LR | ||
| A[Load MNIST Dataset] --> B[Preprocess Data]; | ||
| B --> C[Build CNN Model]; | ||
| C --> D[Train Model]; | ||
| D --> E[Evaluate Model]; | ||
| E --> F[Save and Deploy Model]; | ||
| ``` | ||
|
|
||
| ??? tip "Visualizations and EDA of different features" | ||
|
|
||
| === "Converted Images" | ||
|  | ||
|
|
||
| === "Prediction" | ||
|  | ||
|
|
||
| ??? example "Model performance graphs" | ||
|
|
||
| === "Confusion Matrix" | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ### MODELS USED AND THEIR EVALUATION METRICS | ||
|
|
||
| | Model | Accuracy | MSE | R2 Score | | ||
| |-------|----------|-----|-------| | ||
| | CNN | 95.34% | - | - | | ||
|
|
||
| --- | ||
|
|
||
| ### CONCLUSION | ||
|
|
||
| #### KEY LEARNINGS | ||
|
|
||
| !!! tip "Insights gained from the data" | ||
| - **Data Variety :** The importance of preprocessing for enhancing model performance. | ||
| - **Feature Extraction :** How CNNs extract features and learn patterns in images. | ||
|
|
||
| ??? tip "Improvements in understanding machine learning concepts" | ||
| - **Model Selection :** Strengthened knowledge of convolutional layers and pooling mechanisms. | ||
| - **TensorFlow :** Enhanced Knowledge of Tensorflow/Keras modules. | ||
|
|
||
| ??? tip "Challenges faced and how they were overcome" | ||
| - **Overfitting :** Managed overfitting by applying dropout and data augmentation. | ||
|
|
||
| --- | ||
|
|
||
| #### USE CASES | ||
|
|
||
| === "Application 1" | ||
|
|
||
| **Banking Sector** | ||
|
|
||
| - Automatic digit recognition for processing checks. | ||
|
|
||
| === "Application 2" | ||
|
|
||
| **Postal Services** | ||
|
|
||
| - Automating the reading of zip codes for faster mail sorting. | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.