Skip to content

【Sprinkle some star dust on this repo! ⭐️ It's good karma!】A comprehensive implementation and analysis of handwritten digit recognition using multiple neural network architectures on the MNIST dataset. Features basic MLP, optimized feature-selected model, and deep CNN approaches with detailed performance comparisons and visualizations.

License

Notifications You must be signed in to change notification settings

ChanMeng666/mnist-handwritten-digit-recognition-project

Repository files navigation

🧠 MNIST Neural Network Analysis

Advanced Handwritten Digit Recognition with Deep Learning

A comprehensive neural network implementation that leverages cutting-edge deep learning techniques to achieve state-of-the-art handwritten digit recognition.
Supports multiple model architectures, extensive performance analysis, and advanced visualization techniques.
One-click FREE deployment of your digit recognition models.

Live Demo · Documentation · Research Paper · Issues


🚀 Visit Live Site 🚀



Share This Project

🌟 Pioneering the future of computer vision and deep learning. Built for researchers and practitioners.

📸 Project Showcase

[!TIP] This project demonstrates three distinct neural network architectures with comprehensive performance analysis.

MNIST Dataset

MNIST Handwritten Digits Dataset - 28x28 Grayscale Images

Neural Network Architecture Performance Analysis

Neural Network Architectures and Performance Comparison

📊 More Visualizations
Training History

Training Progress and Validation Accuracy

Confusion Matrix

Detailed Error Analysis and Confusion Matrix

Tech Stack Highlights:

Important

This project demonstrates modern deep learning practices with TensorFlow/Keras. It combines comprehensive data analysis with multiple neural network architectures to provide state-of-the-art digit recognition. Features include 99.71% accuracy, advanced visualization, and detailed performance analysis.

📑 Table of Contents

TOC


🌟 Introduction

We are passionate researchers creating next-generation computer vision solutions. By adopting modern deep learning practices and cutting-edge neural network architectures, we aim to provide researchers and practitioners with powerful, scalable, and interpretable digit recognition models.

Whether you're a student, researcher, or industry professional, this project will be your machine learning playground. Please note that this project demonstrates research-quality implementations with extensive documentation and analysis.

Note

  • Python 3.7+ required
  • TensorFlow 2.0+ for deep learning capabilities
  • Jupyter Notebook for interactive analysis
  • GPU support optional but recommended for training
No installation required! Experience our models through the interactive demo.

Tip

⭐ Star us to receive all release notifications and stay updated with the latest research!

✨ Key Features

1 Multiple Model Architectures

Experience three distinct neural network approaches, each optimized for different use cases. Our comprehensive implementation provides unprecedented flexibility and performance analysis through advanced deep learning methodologies.

Model Architectures

Three distinct model architectures with performance trade-offs

Available Models:

  • 🧠 Basic MLP Model: Simple yet effective multi-layer perceptron
  • Optimized Model: Feature-selected, resource-efficient implementation
  • 🚀 Deep CNN Model: Advanced convolutional neural network with state-of-the-art accuracy

2 Comprehensive Analysis Suite

Revolutionary analysis toolkit that transforms how researchers understand model behavior. With our advanced visualization algorithms and intuitive metrics, users can gain deep insights while maintaining research-grade accuracy.

Data Analysis Performance Metrics

Comprehensive Analysis - Data Exploration (left) and Performance Metrics (right)

Analysis Features:

  • Data Exploration: Complete MNIST dataset analysis with class distribution
  • Feature Importance: Advanced pixel importance visualization and analysis
  • Performance Metrics: Detailed accuracy, precision, recall, and F1-score analysis

* Advanced Features

Beyond the core models, this project includes:

  • 🎯 99.71% Accuracy: State-of-the-art digit recognition performance
  • 📊 Comprehensive Visualization: Beautiful plots and interactive analysis
  • 🔍 Sensitivity Analysis: Advanced model behavior understanding
  • Performance Optimization: Multiple speed/accuracy trade-off options
  • 📈 Training Monitoring: Real-time training progress and validation tracking
  • 🧪 Error Analysis: Detailed misclassification investigation
  • 🔬 Feature Selection: Advanced dimensionality reduction techniques
  • 📝 Research Documentation: Comprehensive methodology and results documentation

✨ More features are continuously being added as deep learning research evolves.

🛠️ Tech Stack

Python
Python 3.7+
TensorFlow
TensorFlow 2.0+
Keras
Keras
NumPy
NumPy
Pandas
Pandas
Jupyter
Jupyter

Core Dependencies:

  • Deep Learning: TensorFlow 2.0+ with Keras API
  • Data Processing: NumPy, Pandas for efficient data manipulation
  • Visualization: Matplotlib, Seaborn, Plotly for comprehensive plotting
  • Analysis: scikit-learn for advanced metrics and feature selection
  • Environment: Jupyter Notebook for interactive development

Development Tools:

  • Version Control: Git with comprehensive commit history
  • Documentation: Markdown with detailed analysis
  • Code Quality: Clean, well-documented, research-grade implementation
  • Reproducibility: Fixed random seeds for consistent results

Tip

Each dependency was carefully selected for research compatibility, performance, and educational value.

🏗️ Architecture

Neural Network Architectures

graph TB
    subgraph "Input Layer"
        A[MNIST 28x28 Images]
    end
    
    subgraph "Basic MLP Model"
        B1[Flatten Layer]
        B2[Dense 128/256/512]
        B3[Dropout]
        B4[Output Layer 10]
    end
    
    subgraph "Optimized Model"
        C1[Feature Selection]
        C2[Reduced Dimensions]
        C3[Efficient Dense Layers]
        C4[Output Layer 10]
    end
    
    subgraph "Deep CNN Model"
        D1[Conv2D Layers]
        D2[MaxPooling]
        D3[Batch Normalization]
        D4[Dense Layers]
        D5[Output Layer 10]
    end
    
    A --> B1
    A --> C1
    A --> D1
    
    B1 --> B2 --> B3 --> B4
    C1 --> C2 --> C3 --> C4
    D1 --> D2 --> D3 --> D4 --> D5
Loading

Project Structure

mnist-handwritten-digit-recognition-project/
├── hand-written-digit-recognition_final.ipynb    # Main analysis notebook
├── hand-written-digit-recognition_final copy.ipynb    # Backup/experimental
├── README.md                                      # Project documentation
├── LICENSE                                        # MIT License
├── CODE_OF_CONDUCT.md                            # Community guidelines
├── .gitignore                                    # Git ignore rules
└── .github/                                      # GitHub configurations

⚡️ Performance

Model Performance Comparison

Model Accuracy Prediction Time Parameters Use Case
Basic MLP 99.05% 0.621s 407,050 Balanced performance
Optimized 97.86% 0.528s 84,618 Resource-constrained
Deep CNN 99.71% 4.869s 1,015,530 Maximum accuracy

Key Performance Metrics

Accuracy Achievements:

  • 🎯 99.71% test accuracy with Deep CNN model
  • 🚀 99.05% accuracy with efficient MLP architecture
  • 0.528s fastest prediction time with optimized model
  • 📊 Comprehensive error analysis and sensitivity testing

Model Efficiency:

  • 💨 84,618 parameters in optimized model (79% reduction)
  • 🔄 Real-time prediction capabilities
  • 📈 Scalable architecture for larger datasets
  • 🛡️ Robust performance across all digit classes

Note

Performance metrics measured on standard MNIST test set with consistent evaluation protocols.

🚀 Getting Started

Prerequisites

Important

Ensure you have the following installed:

  • Python 3.7+ (Download)
  • pip package manager
  • Git (Download)
  • [Optional] GPU drivers for accelerated training

Quick Installation

1. Clone Repository

git clone https://github.com/ChanMeng666/mnist-handwritten-digit-recognition-project.git
cd mnist-handwritten-digit-recognition-project

2. Install Dependencies

# Create virtual environment (recommended)
python -m venv mnist_env
source mnist_env/bin/activate  # On Windows: mnist_env\Scripts\activate

# Install required packages
pip install tensorflow>=2.0 numpy pandas matplotlib seaborn scikit-learn jupyter plotly

3. Launch Jupyter Notebook

jupyter notebook hand-written-digit-recognition_final.ipynb

🎉 Success! The interactive notebook will open in your browser with all models and analysis ready to run.

Environment Setup

Create a virtual environment for isolation:

# Using conda
conda create -n mnist python=3.8
conda activate mnist
conda install tensorflow numpy pandas matplotlib jupyter

# Using pip
pip install -r requirements.txt  # If requirements.txt exists

Tip

Use GPU acceleration for faster training by installing tensorflow-gpu if you have CUDA-compatible hardware.

📖 Usage Guide

Basic Usage

Getting Started:

  1. Open Notebook - Launch the Jupyter notebook
  2. Run All Cells - Execute the complete analysis pipeline
  3. Explore Models - Compare different architectures
  4. Analyze Results - Review comprehensive performance metrics

Model Training

# Example: Training the Deep CNN Model
from tensorflow.keras import layers, models

model = models.Sequential([
    layers.Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1)),
    layers.MaxPooling2D((2, 2)),
    layers.Conv2D(64, (3, 3), activation='relu'),
    layers.MaxPooling2D((2, 2)),
    layers.Flatten(),
    layers.Dense(64, activation='relu'),
    layers.Dense(10, activation='softmax')
])

model.compile(
    optimizer='adam',
    loss='sparse_categorical_crossentropy',
    metrics=['accuracy']
)

# Train the model
history = model.fit(x_train, y_train, 
                   epochs=10, 
                   validation_data=(x_val, y_val))

Advanced Configuration

Custom Model Parameters:

# Configure training parameters
config = {
    'batch_size': 32,
    'epochs': 20,
    'learning_rate': 0.001,
    'validation_split': 0.1,
    'early_stopping_patience': 5
}

# Feature selection for optimized model
n_features = 196  # Reduced from 784 original features

🔬 Model Details

Basic MLP Model

  • Architecture: Multi-layer perceptron with configurable hidden layers
  • Features: 128/256/512 neuron configurations tested
  • Performance: 99.05% accuracy, balanced speed/accuracy trade-off
  • Use Case: General-purpose digit recognition

Optimized Model

  • Architecture: Feature-selected efficient neural network
  • Features: Advanced dimensionality reduction (784 → 196 features)
  • Performance: 97.86% accuracy, fastest prediction time
  • Use Case: Resource-constrained environments, mobile deployment

Deep CNN Model

  • Architecture: Convolutional Neural Network with multiple layers
  • Features: Conv2D, MaxPooling, Batch Normalization, Dense layers
  • Performance: 99.71% accuracy, state-of-the-art results
  • Use Case: Maximum accuracy applications, research benchmarking

📊 Results & Analysis

Performance Summary

The comprehensive analysis reveals distinct trade-offs between model architectures:

Accuracy Rankings:

  1. Deep CNN: 99.71% - Highest accuracy with computational cost
  2. Basic MLP: 99.05% - Excellent balance of performance and efficiency
  3. Optimized: 97.86% - Fastest with good accuracy for constrained environments

Speed Analysis:

  • Optimized Model: 0.528s (fastest prediction)
  • Basic MLP: 0.621s (balanced performance)
  • Deep CNN: 4.869s (highest accuracy, slower inference)

Resource Utilization:

  • Optimized: 84,618 parameters (most efficient)
  • Basic MLP: 407,050 parameters (moderate)
  • Deep CNN: 1,015,530 parameters (most comprehensive)

Advanced Analysis Features

Sensitivity Analysis:

  • Gradient-based importance mapping
  • Perturbation robustness testing
  • Occlusion sensitivity analysis

Error Analysis:

  • Detailed confusion matrix analysis
  • Misclassification pattern identification
  • Class-specific performance metrics

🤝 Contributing

We welcome contributions from the deep learning community! Here's how you can help:

Development Process

1. Fork & Clone:

git clone https://github.com/ChanMeng666/mnist-handwritten-digit-recognition-project.git
cd mnist-handwritten-digit-recognition-project

2. Create Branch:

git checkout -b feature/improved-architecture

3. Make Changes:

  • Follow PEP 8 Python style guidelines
  • Add comprehensive documentation
  • Include performance benchmarks
  • Ensure reproducible results

4. Submit PR:

  • Provide clear description of improvements
  • Include performance comparisons
  • Reference related research papers
  • Ensure all analyses run successfully

Contribution Areas

Research Contributions:

  • 🧠 New neural network architectures
  • 📊 Advanced visualization techniques
  • 🔬 Novel analysis methodologies
  • ⚡ Performance optimization strategies

Documentation:

  • 📚 Enhanced explanations and tutorials
  • 🎓 Educational content for beginners
  • 📖 Research methodology documentation
  • 💡 Use case examples and applications

📄 License

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

Open Source Benefits:

  • ✅ Commercial use allowed
  • ✅ Modification and distribution permitted
  • ✅ Private use encouraged
  • ✅ Research and educational use supported

👥 Author

Chan Meng
Chan Meng

Deep Learning Researcher & Developer

Chan Meng

Contact Information:


🧠 Advancing the Future of Computer Vision 🌟
Empowering researchers and practitioners worldwide

Star us on GitHub • 📖 Read the Research • 🐛 Report Issues • 💡 Request Features • 🤝 Contribute



Made with ❤️ by the Deep Learning Community

GitHub stars GitHub forks GitHub watchers

</rewritten_file>

About

【Sprinkle some star dust on this repo! ⭐️ It's good karma!】A comprehensive implementation and analysis of handwritten digit recognition using multiple neural network architectures on the MNIST dataset. Features basic MLP, optimized feature-selected model, and deep CNN approaches with detailed performance comparisons and visualizations.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published