A deep learning project that classifies handwritten digits (0–9) using a Convolutional Neural Network (CNN) trained on the MNIST dataset. The model learns image features automatically and predicts the correct digit with high accuracy.
Handwritten digit recognition is one of the most fundamental computer vision tasks. This project uses a CNN built with PyTorch to classify grayscale images of handwritten digits from the MNIST dataset.
- Image preprocessing and normalization
- CNN-based image classification
- Training and validation on the MNIST dataset
- Performance evaluation using multiple metrics
- Prediction of handwritten digits
- Python
- PyTorch
- Torchvision
- NumPy
- Matplotlib
- Scikit-learn
- Jupyter Notebook
Handwritten-Digit-Classification/
│
├── Handwritten_digit_classification.ipynb
├── requirements.txt
├── README.md
└── .gitignore
Dataset: MNIST
- 70,000 grayscale handwritten digit images
- Image size: 28 × 28
- Training samples: 60,000
- Test samples: 10,000
- Classes: 0–9
The CNN consists of:
- Convolutional Layers
- ReLU Activation
- Max Pooling Layers
- Fully Connected Layers
- Softmax Output for 10 Classes
The model is evaluated using:
- Accuracy
- Precision
- Recall
- F1 Score
- Confusion Matrix
Clone the repository
git clone https://github.com/chesta02/Handwritten-Digit-Classification.gitMove into the project directory
cd Handwritten-Digit-ClassificationInstall dependencies
pip install -r requirements.txtLaunch Jupyter Notebook
jupyter notebookOpen:
Handwritten_digit_classification.ipynb
- Load the MNIST dataset
- Preprocess and normalize images
- Create DataLoaders
- Build the CNN model
- Train the network
- Evaluate performance
- Predict handwritten digits
- Hyperparameter tuning
- Data augmentation
- Deploy using Streamlit or FastAPI
- Train on custom handwritten digit datasets