Handwritten Urdu alphabet recognition using DNN and CNN on student-collected images.
This repository contains code, dataset samples, and reports for a course project that builds models to recognize handwritten Urdu alphabets captured with a mobile phone camera.
- DNN baseline (2 dense hidden layers)
- CNN baseline (2 convolutional layers)
- Preprocessing and augmentation (rotation, translation, zoom, contrast, gaussian noise)
- Experiments with multiple input sizes (28×28, 64×64, 128×128)
- Evaluation: accuracy, precision/recall/F1, confusion matrices
- Python 3.11
- TensorFlow / Keras
- Pillow (PIL), scikit-learn, matplotlib, seaborn
- FPDF for report generation
- Create a Python virtual environment and install dependencies (example):
python -m venv .venv
.\.venv\Scripts\Activate
pip install -r requirements.txt-
Prepare dataset (if not present): place unaugmented submission images in
2023cs607(A)/alphabets_128x128or usedataset/structure shown in the repo. -
Train models (example, 128×128):
python run_all.py --dataset dataset --img-size 128 --batch-size 32 --epochs 30- Generated outputs (models, reports) are saved under
outputs*directories.
- The repository includes a small student-collected dataset and a submission folder
2023cs607(A)with single-sample images (pre-augmentation). - Image sizes included: 128×128 (also stored: 64×64, 28×28 outputs).
- Note: Teacher requested 34–35 submission images; this project contains 40 images in
2023cs607(A)/alphabets_128x128. Confirm with your instructor if needed.
- See
report.pdfandreport.mdfor evaluation details and comparative analysis (best reported model: CNN at 128×128 in this project).
run_all.py— training and evaluation scriptsource_code_bundle.txt— all source code in single text file (submission requirement)report.pdf— 3–4 page project report (course requirement)2023cs607(A)/alphabets_128x128— submission images (pre-augmentation)
This project is released under the MIT License — see LICENSE.
Submitted by: Muhammad Rateeb (2023-CS-607) Email: (add your contact email here)
- Trains two models (DNN + CNN) on 40-class Urdu alphabet dataset
- Applies preprocessing and 5 data augmentations
- Saves metrics, confusion matrices, and trained models
- Generates a short report
.venv311\\Scripts\\python.exe run_all.py --img-size 128 --epochs 30
Outputs are written to the outputs/ folder.
.venv311\\Scripts\\python.exe generate_report.py
This creates report.md and report.pdf.