|
--- |
|
license: mit |
|
datasets: |
|
- ylecun/mnist |
|
language: |
|
- en |
|
metrics: |
|
- f1 |
|
- precision |
|
- recall |
|
- accuracy |
|
tags: |
|
- pattern-recognition |
|
- mnist |
|
- image-classification |
|
--- |
|
# MNIST Pattern Recognition with Convolutional Neural Network (CNN) |
|
|
|
This project implements a Convolutional Neural Network (CNN) for recognizing handwritten digits from the MNIST dataset. The model is built using TensorFlow and Keras, and it supports both single-GPU and multi-GPU training. The project includes training, testing, and a user-friendly GUI for inference. |
|
|
|
## Features |
|
- **Customizable CNN Architecture**: Includes convolutional, pooling, normalization, and dense layers. |
|
- **Multi-GPU Support**: Leverages TensorFlow's `MirroredStrategy` for distributed training. |
|
- **Training Visualization**: Generates plots for training/validation accuracy and loss. |
|
- **Evaluation Metrics**: Outputs confusion matrix, classification report, and precision/recall/F1 scores. |
|
- **Interactive GUI**: Built with Streamlit for real-time image recognition. |
|
- **Docker Support**: Easily deployable using Docker. |
|
|
|
## Model Architecture |
|
 <br> |
|
The CNN model consists of: |
|
1. Two convolutional layers with ReLU activation and max-pooling. |
|
2. Layer normalization for improved convergence. |
|
3. Fully connected dense layers with dropout for regularization. |
|
4. Softmax output layer for classification into 10 digit classes. |
|
|
|
## Training |
|
The model is trained on the MNIST dataset, which contains 60,000 training images and 10,000 test images of handwritten digits (28x28 grayscale). The training process includes: |
|
- Data normalization to scale pixel values to the range [0, 1]. |
|
- Categorical cross-entropy loss and accuracy as the evaluation metric. |
|
- Model checkpointing to save the best-performing model based on validation accuracy. |
|
|
|
## Final result |
|
**Training history** |
|
 <br> |
|
|
|
**Confusion matrix** |
|
 <br> |
|
|
|
**Classification report** |
|
 <br> |
|
|
|
**Test result** |
|
 <br> |
|
|
|
Full code at [Github](https://github.com/longdnk/Pattern-Recognition/tree/main/MNIST) |