Skip to content

Explore this repository for a CNN-based handwritten digit classification project. Utilizes TensorFlow to train and evaluate models, providing a practical example of deep learning in image recognition.

Notifications You must be signed in to change notification settings

satyamtripathi8/Handwritten_Digit_Classifier

Repository files navigation

Handwritten Digit Classifier

A modern web application for classifying handwritten digits using a Convolutional Neural Network (CNN). This project provides both a user-friendly web interface and a REST API for digit classification.

Features

  • Modern Web Interface

    • Responsive design with Bootstrap 5
    • Drag and drop image upload
    • Real-time image preview
    • Animated results display
    • Mobile-friendly interface
  • Advanced Model

    • CNN architecture with Batch Normalization
    • Data augmentation for better generalization
    • Early stopping and learning rate reduction
    • High accuracy on MNIST dataset
  • API Support

    • RESTful API endpoint for predictions
    • JSON response format
    • Error handling and status codes

Requirements

  • Python 3.8+
  • TensorFlow 2.x
  • Flask
  • NumPy
  • Pillow
  • scikit-learn
  • joblib

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/handwritten-digit-classifier.git
cd handwritten-digit-classifier
  1. Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install the required packages:
pip install -r requirements.txt

Usage

  1. Train the model:
python Model2.0.py
  1. Start the web application:
python app.py
  1. Open your browser and navigate to http://localhost:5000

API Usage

The application provides a REST API endpoint for predictions:

curl -X POST -F "image=@path/to/image.png" http://localhost:5000/api/predict

Example response:

{
    "prediction": 7,
    "confidence": 0.987654321
}

Project Structure

handwritten-digit-classifier/
├── app.py                 # Flask application
├── Model2.0.py           # Model training script
├── model.pkl             # Trained model
├── static/
│   ├── style.css         # Custom styles
│   ├── script.js         # Client-side JavaScript
│   └── uploads/          # Uploaded images
├── templates/
│   └── index.html        # Web interface template
└── README.md             # Project documentation

Model Architecture

The CNN model consists of:

  • Two convolutional layers with Batch Normalization
  • Max pooling layers
  • Dropout for regularization
  • Dense layers with ReLU activation
  • Softmax output layer

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • MNIST dataset
  • TensorFlow and Keras
  • Flask web framework
  • Bootstrap 5

About

Explore this repository for a CNN-based handwritten digit classification project. Utilizes TensorFlow to train and evaluate models, providing a practical example of deep learning in image recognition.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published