An engineering-focused deep learning project for recognizing English handwritten digits from 28x28 grayscale images.
This project is designed with three main goals in mind:
- Build a reliable and effective handwritten digit recognition system
- Compare the performance of a lightweight model against a more complex model
- Maintain clean, readable, and standardized code based on PEP 8 and Clean Code principles
Handwritten digit recognition is one of the classic problems in computer vision and pattern recognition. Despite its simplicity on the surface, it provides an excellent benchmark for evaluating model architecture, preprocessing strategy, and training behavior.
This project explores that problem through a modular Python implementation, where each stage of the pipeline is separated into its own file for clarity, reusability, and maintainability.
This project is built to achieve the following objectives:
- Recognize English handwritten digits with strong classification performance
- Compare simple/lightweight and complex/powerful modeling approaches
- Analyze training and testing behavior through visual evaluation
- Keep the codebase modular, clean, and aligned with software engineering best practices
- Modular project structure
- Batch-size controlled execution
- Optional data augmentation support
- Input data description and analysis
- Model performance visualization
- Confusion matrix generation
- Clean and maintainable Python code
The project is organized into multiple Python modules, each responsible for a specific task in the workflow:
.
├── main.py
├── Import_Data.py
├── Data_Description.py
├── Data_Augmentation.py
├── Model_Evaluation.py
├── utilities.py
├── dataset/
│ └── 0
│ └── 1
│ └── 2
│ └── 3
│ └── 4
│ └── 5
│ └── 6
│ └── 7
│ └── 8
│ └── 9
└── requirements.txt
-
main.py
The main entry point of the project. It coordinates the execution flow and accepts the batch size setting.
-
Import_Data.py
Handles data importing, input evaluation, categorization, classification preparation, and label assignment.
-
Data_Description.py
Describes and analyzes the input and generated data to improve understanding of dataset structure and behavior.
-
Data_Augmentation.py
Generates additional training samples when augmentation is needed.
-
Model_Evaluation.py
Evaluates model performance by plotting:
- accuracy curves
- loss curves
- confusion matrix
The model works with:
- 28x28 grayscale images
- Images of English handwritten digits
- Labeled data for supervised learning
The project produces visual evaluation results for both training and testing phases, including:
- Training accuracy & loss plots:
One of the central goals of this project is to compare two modeling strategies:
-
Simple Model: A lightweight architecture with lower complexity, faster execution, and fewer parameters.
-
Complex Model: A stronger and more expressive architecture designed for improved learning capacity and potentially better recognition performance.
This comparison helps highlight the trade-off between:
- computational simplicity
- training cost
- predictive performance
- model robustness
- Python>=3.10
- tensorflow>=2.13,<2.14
- numpy>=1.24,<1.25
- pandas>=2.0,<2.1
- matplotlib>=3.7,<3.8
- scikit-learn>=1.3,<1.4
- seaborn>=0.12,<0.13
- prettytable>=3.9,<4.0
⭐ Required libraries listed in requirement.txt.
Install dependencies with:
pip install -r requirement.txtRun the project from the main file:
python main.pyIf your implementation supports passing batch size as an argument, use:
python main.py --batch_size 512notice that:
Default batch size: 512This value can be adjusted depending on your experiment setup Augmentation.
If augmentation is enabled or required by your workflow, the system generates additional input samples to enrich training data.
This project is not only about model performance. It is also a small exercise in writing better scientific and engineering code.
The implementation aims to follow:
- PEP 8 for Python style consistency
- Clean Code principles for readability and maintainability
- Modular design for easier debugging and future development
This project belongs to the field of:
- Computer Vision
- Pattern Recognition
- Deep Learning
- Image Classification
It can be used as:
- a learning project for handwritten digit classification
- a benchmark for comparing neural network designs
- a clean starting point for extending image recognition pipelines
This project presents a structured and educational implementation of handwritten digit recognition with an emphasis on:
- performance
- comparison of model complexity
- visual evaluation
- clean software design
- It is intended to be both a practical deep learning project and a maintainable engineering codebase.
👨💻 Author: Farshad Tofighi (farshad257)


