A desktop-based handwritten character recognition system using a CNN trained on self-collected data. The project includes a zipped self-drawn dataset for immediate training and testing.
- Draw characters using mouse
- Real-time prediction with confidence score
- Save new samples for training
- Retrain model directly from UI
- Undo strokes (Backspace / Ctrl+Z)
- Keyboard-based prediction (Enter key)
- Single unified desktop interface
- Python 3.10+
- PyTorch
- OpenCV
- NumPy
- Tkinter
handwriting_recognition/
│
├── app/
│ └── unified_whiteboard.py
│
├── model/
│ ├── cnn.py
│ └── train.py
│
├── data/
│ ├── self_data.zip
│ └── self_data/
│ ├── A/
│ ├── B/
│ └── ...
│
├── inference/
│ ├── preprocess.py
│ └── predict.py
│
├── utils/
│ ├── config.py
│ └── label_map.py
│
└── README.md
python -m venv venvvenv\Scripts\activatepip install torch torchvision numpy opencv-python pillowThe repository includes a zipped self-collected dataset.
Expand-Archive data\self_data.zip data\After extraction, the structure should be:
data/self_data/A
data/self_data/B
...
Train the model using the provided self-data:
python -m model.trainThe trained model is saved to:
model/model.pth
Start the unified desktop UI:
python -m app.unified_whiteboard- Draw a character on the board
- Press Enter or click Predict
- Press Backspace or Ctrl+Z to undo
- Enter a label and click Save Sample to add new training data
- Click Retrain Model to update the model
- Input: 1 × 28 × 28 grayscale image
- Convolutional layers with ReLU and max pooling
- Fully connected layers
- Output: 26 classes (A–Z)
- The included dataset matches the whiteboard input format
- Adding more samples and retraining improves accuracy
- Public datasets were intentionally avoided due to input mismatch