Skip to content

This project implements a Convolutional Neural Network (CNN) to classify handwritten digits from the MNIST dataset. The trained model is deployed as a web application using Streamlit, allowing users to interactively upload images of handwritten digits and receive real-time predictions.

Notifications You must be signed in to change notification settings

sayedgamal99/Digit-Recognizer-APP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

832dec2 Β· Nov 3, 2024

History

27 Commits
Oct 17, 2024
Nov 3, 2024
Oct 26, 2024
Nov 3, 2024
Nov 3, 2024
Nov 3, 2024
Nov 3, 2024
Oct 17, 2024
Oct 17, 2024
Oct 26, 2024

Repository files navigation

MNIST Digit Classification using CNN with Streamlit

Project Cover Image

This project implements a Convolutional Neural Network (CNN) to classify handwritten digits from the MNIST dataset. The trained model is deployed as a web application using Streamlit, allowing users to interactively upload images of handwritten digits and receive real-time predictions.

Project Overview

The MNIST dataset is a widely used benchmark in the field of machine learning, containing 60,000 training images and 10,000 test images of handwritten digits (0-9). This project demonstrates the following key components:

  • Data Preprocessing: Efficient loading and normalization of the MNIST dataset, along with data augmentation techniques to improve the model's generalization ability.
  • Model Architecture: Construction of a CNN model incorporating convolutional layers, pooling layers, dropout for regularization, and batch normalization to enhance performance.
  • Training and Evaluation: Training the CNN on the MNIST dataset, evaluating its performance on unseen data, and achieving high accuracy.

🌟 Key Features

  • Real-time digit classification
  • Multiple input methods:
    • Sample image selection
    • Image upload
    • Webcam capture
  • Confidence score visualization
  • Interactive user interface
  • Pre-processed sample images with both black and white backgrounds

πŸ› οΈ Technologies Used

  • Python 3.8+
  • TensorFlow 2.x
  • Streamlit
  • Pillow (PIL)
  • NumPy
  • MNIST Dataset

πŸ“ Project Structure

mnist-classifier/
β”œβ”€β”€ app.py                 # Main Streamlit application
β”œβ”€β”€ generate_samples.py    # Script to generate sample images
β”œβ”€β”€ requirements.txt       # Project dependencies
β”œβ”€β”€ model/
β”‚   └── best_model_v2.keras  # Trained MNIST model
β”œβ”€β”€ samples/              # Sample digit images
β”‚   β”œβ”€β”€ digit_0_sample_1.png
β”‚   β”œβ”€β”€ digit_0_sample_2.png
β”‚   └── ...
└── README.md            # Project documentation

πŸš€ Getting Started

  1. Clone the repository:
git clone https://github.com/your-username/mnist-classifier.git
cd mnist-classifier
  1. Install dependencies:
pip install -r requirements.txt
  1. Generate sample images:
python generate_samples.py
  1. Run the application:
streamlit run app.py

🎯 Future Improvements

  1. fine-tune to mobile camera dataset
  2. Add support for multiple digit recognition
  3. Implement batch processing capability
  4. Add export functionality for predictions
  5. Enhance UI with additional visualizations
  6. Add model performance metrics display

πŸ“Š Model Performance

  • Test Accuracy: 99.3%

πŸ’‘ Key Learnings

  • Deploying machine learning models in a web application
  • Building interactive UIs with Streamlit
  • Image processing and preprocessing techniques
  • Session state management in web applications
  • Error handling and user experience design

πŸ”— Links

πŸ“„ License

MIT License - feel free to use this project for learning and development.

About

This project implements a Convolutional Neural Network (CNN) to classify handwritten digits from the MNIST dataset. The trained model is deployed as a web application using Streamlit, allowing users to interactively upload images of handwritten digits and receive real-time predictions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published