CoolFace
Modelpublic

longdnk20/CNN_MNIST

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes7downloads
README.md56 linesDownload Raw Back to root
1---2license: mit3datasets:4- ylecun/mnist5language:6- en7metrics:8- f19- precision10- recall11- accuracy12tags:13- pattern-recognition14- mnist15- image-classification16---17# MNIST Pattern Recognition with Convolutional Neural Network (CNN)18 19This 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.20 21## Features22- **Customizable CNN Architecture**: Includes convolutional, pooling, normalization, and dense layers.23- **Multi-GPU Support**: Leverages TensorFlow's `MirroredStrategy` for distributed training.24- **Training Visualization**: Generates plots for training/validation accuracy and loss.25- **Evaluation Metrics**: Outputs confusion matrix, classification report, and precision/recall/F1 scores.26- **Interactive GUI**: Built with Streamlit for real-time image recognition.27- **Docker Support**: Easily deployable using Docker.28 29## Model Architecture30![image](model.png) <br>31The CNN model consists of:321. Two convolutional layers with ReLU activation and max-pooling.332. Layer normalization for improved convergence.343. Fully connected dense layers with dropout for regularization.354. Softmax output layer for classification into 10 digit classes.36 37## Training38The 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:39- Data normalization to scale pixel values to the range [0, 1].40- Categorical cross-entropy loss and accuracy as the evaluation metric.41- Model checkpointing to save the best-performing model based on validation accuracy.42 43## Final result44**Training history**45![image](training_history.png) <br>46 47**Confusion matrix**48![image](confusion_matrix.png) <br>49 50**Classification report**51![image](classification_report_image.png) <br>52 53**Test result**54![image](test_result.png) <br>55 56Full code at [Github](https://github.com/longdnk/Pattern-Recognition/tree/main/MNIST)