DigitRecognitionCNN / README.md
EnYa32's picture
Update README.md
021a336 verified

A newer version of the Streamlit SDK is available: 1.56.0

Upgrade
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

  1. Load train.csv and test.csv
  2. Normalize pixel values to [0, 1]
  3. Reshape to (28, 28, 1)
  4. Train a CNN with early stopping
  5. Evaluate using validation accuracy and confusion matrix
  6. Generate submission.csv for 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.