Digit Recognition & Transfer Learning with CNNs
This project focused on designing, training, and analyzing convolutional neural networks (CNNs) for digit recognition and then applying transfer learning to recognize Greek characters using PyTorch.
CNN for Digit Recognition (MNIST)
We first built and trained a simple CNN model using the MNIST dataset:
- Two convolutional layers (5x5 filters)
- Max pooling (2x2) and dropout (0.5)
- Fully connected layer (50 nodes) + final FC with log-softmax (10 classes)
- Achieved ~98% test accuracy

Network Architecture

Training Performance
- Loss decreased steadily over batches/epochs.
- Test loss visualized periodically across training examples.

Filter Visualization
- First conv layer has 10 learned filters.
- Visualized using matplotlib to show edge/orientation detection.

Transfer Learning to Greek Letters
- Fine-tuned MNIST CNN to classify Greek characters: α, β, γ.
- Froze earlier layers, retrained final classifier head.
- Achieved 96–98% accuracy on unseen test samples.

Transfer Learning Training Error
- Convergence observed over 100+ epochs.

Live Webcam Digit Recognition
- Built a webcam-based interface using OpenCV
- Live input frames classified in real time using the trained CNN

Sometimes predictions were inaccurate due to motion blur or poor lighting, but most digits were correctly classified in real-time.
Key Takeaways
- 5x5 and 7x7 filters outperform 3x3 in MNIST CNNs
- Dropout around 0.1–0.3 provided best generalization
- Smaller batch sizes (32) resulted in better accuracy
- Greek letters transfer learning worked well with small data (~27 samples)
- Real-time system demonstrates CNNs are efficient and deployable
Tools
- Python, PyTorch, OpenCV
- Jupyter Notebooks
- Matplotlib for visualization
Resources
This project deepened our understanding of CNN design, filter learning, transfer learning, and real-time deployment — showing the full lifecycle from dataset to deployment.