This project implements a neural network model to recognize handwritten digits using the MNIST dataset. The model is built with TensorFlow and achieves high accuracy in classifying digits from 0-9.
- 🧠 Neural network with multiple dense layers
- 📊 Training and evaluation on the MNIST dataset
- 💾 Model saving and loading capabilities
- 🖼️ Custom image prediction functionality
- 📉 Visualization of results using matplotlib
- Python
- TensorFlow
- NumPy
- OpenCV
- Matplotlib
The neural network consists of:
- Input layer (flattened 28×28 pixels)
- Two hidden layers with 128 neurons each and ReLU activation
- Output layer with 10 neurons and softmax activation
- Install the required dependencies:
pip install tensorflow opencv-python numpy matplotlib
-
Set
train_new_model = True
to train the model orFalse
to use a pre-trained model. -
Place your own handwritten digit images in the
digits/
folder with naming formatdigit1.png
,digit2.png
, etc. -
Run the script:
python handwritten_digits_recognition.py
The model achieves approximately 97-98% accuracy on the MNIST test set after just 3 epochs of training.
This project was developed as part of the IT3140 Soft Computing course during my undergraduate studies at Manipal University Jaipur.
- Implement data augmentation for better generalization
- Try different model architectures (CNN, etc.)
- Create a web interface for real-time digit recognition
- Extend to recognize characters beyond digits