Spaces:
Sleeping
Sleeping
A newer version of the Streamlit SDK is available: 1.56.0
metadata
title: DigitRecognitionCNN
emoji: ✍️
colorFrom: red
colorTo: red
sdk: streamlit
app_file: src/streamlit_app.py
pinned: false
short_description: Handwritten digit recognition (0–9) using a CNN and MNIST.
license: mit
✍️ MNIST Digit Recognizer (CNN)
This project is a simple Computer Vision application that recognizes handwritten digits (0–9) using a Convolutional Neural Network (CNN).
Dataset
- Kaggle Competition: Digit Recognizer (MNIST)
- Each image is 28×28 grayscale (784 pixels).
- Labels are digits 0–9.
Approach
- Load
train.csvandtest.csv - Normalize pixel values to [0, 1]
- Reshape to (28, 28, 1)
- Train a CNN with early stopping
- Evaluate using validation accuracy and confusion matrix
- Generate
submission.csvfor Kaggle
Results
- The model achieved around ~99% validation accuracy.
- Most digits are predicted correctly; errors mostly happen for visually similar digits.
Streamlit App
The app lets you upload an image of a handwritten digit and outputs:
- predicted digit
- confidence score
- probability distribution for all 10 digits
- preprocessed 28×28 image
Files
Recommended structure:
. ├─ app.py ├─ best_mnist_cnn.keras ├─ requirements.txt └─ README.md
perl Code kopieren
How to run locally
pip install -r requirements.txt
streamlit run app.py
Notes
For best predictions, upload an image with one digit, centered, with a clean background.