Skip to content

🧠 Real-time Handwritten Digit Recognizer using PyTorch CNN & Tkinter. Features a custom "Smart Centering" algorithm for high accuracy on any drawing

Notifications You must be signed in to change notification settings

v0id-core/digit-recognizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Handwritten Digit Recognizer

An intelligent, real-time digit recognition app powered by PyTorch

Python PyTorch GUI License


Report Bug Request Feature


💡 About The Project

This is not just another MNIST classifier. Most tutorials teach you to train a model, but they fail when you try to use it in real life because users don't draw perfectly centered digits.

This project solves that problem.

I built a custom desktop application with a Smart Preprocessing Engine. It behaves like a human eye: looking at the drawing, cropping the useless whitespace, and centering the digit-just like the data the AI was trained on.

✨ Key Features

  • 🧠 Custom CNN Architecture: A lightweight but powerful Convolutional Neural Network.
  • 🎯 Smart Centering Algorithm: Draw in the corner, draw small, draw big—it doesn't matter. The algorithm fixes your input automatically.
  • 🖥️ Native GUI: No browser needed. Fast, responsive tkinter interface.
  • ⚙️ On-Device Training: Train the neural network locally on your CPU/GPU with one click.
  • 🐧 Cross-Platform: Runs smoothly on Windows, macOS, and Linux.

🖼️Screenshots

Train Recognize

🛠 Installation

Prerequisites

You need Python 3.10+ installed.

1. Clone the repository

git clone https://github.com/v0id-core/digit-recognizer.git
cd digit-recognizer

2. Set up a Virtual Environment (Recommended)

Windows:

python -m venv venv
venv\Scripts\activate

macOS / Linux:

python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Run the desktop application

python desktop_app.py

🚀 Usage

  • Train the model: If you launch the app for the first time, click "Train Model" in the app interface. The app will download the MNIST dataset and train the neural network (~1-2 minutes).
  • Draw: Use your mouse to draw a digit (0-9) on the canvas.
  • Recognize: Click "Recognize" to see the prediction and confidence score.

🤖 Tech Stack

  • Core: Python 3.10+
  • ML Framework: PyTorch, Torchvision
  • GUI: Tkinter
  • Image Processing: PIL (Pillow), NumPy

⚙️ Troubleshooting

  • App doesn't start? Ensure that you have Python 3.10+ and all dependencies installed correctly. Check version: python --version.
  • Training fails? Check your internet connection. The MNIST dataset requires downloading when you press "Train Model".

📝 License

  • This project is licensed under the MIT License. You can freely use, modify, and distribute the code.

👨‍💻 Author

About

🧠 Real-time Handwritten Digit Recognizer using PyTorch CNN & Tkinter. Features a custom "Smart Centering" algorithm for high accuracy on any drawing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages