Skip to content

henzzimessi/mnist-digit-recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

MNIST Digit Recognition

This project implements a Convolutional Neural Network (CNN) for recognizing handwritten digits using the MNIST dataset. The model can classify digits from 0 to 9 with high accuracy.

Features

  • MNIST dataset loading and preprocessing
  • CNN model implementation using TensorFlow
  • Model training and evaluation
  • Visualization of results and predictions
  • Interactive digit recognition demo

Setup

  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the model:
python digit_recognition.py

Project Structure

  • digit_recognition.py: Main script containing the CNN model implementation
  • requirements.txt: Project dependencies
  • README.md: Project documentation

Model Architecture

  • Input layer: 28x28 pixels (grayscale images)
  • Convolutional layers with ReLU activation
  • MaxPooling layers
  • Dense layers
  • Output layer: 10 neurons (digits 0-9)

Performance

The model typically achieves:

  • Training accuracy: >99%
  • Test accuracy: >98%

Output Files

The script generates three visualization files:

  1. confusion_matrix.png: Shows the model's prediction accuracy for each digit
  2. training_history.png: Displays the training and validation accuracy/loss over time
  3. sample_predictions.png: Shows random test images with their true and predicted labels

Dependencies

  • numpy==1.24.3
  • tensorflow==2.15.0
  • matplotlib==3.7.2
  • seaborn==0.12.2
  • scikit-learn==1.3.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages