A simple project that uses a neural network to recognize handwritten digits (0–9) from the MNIST dataset.
It demonstrates the basic workflow of computer vision: dataset preparation, preprocessing, model building, training, evaluation, and visualization.
- Dataset: MNIST handwritten digit images (28x28 pixels).
- Preprocessing: Images converted into tensors.
- Model: A simple feedforward neural network with one hidden layer.
- Training: Model learns patterns from digits over a few epochs.
- Evaluation: Achieves about 95% accuracy.
- Visualization: Training loss and accuracy are plotted in
results.png
.
mnist-digit-classifier/ │── main.py # Main code (model, training, evaluation) │── requirements.txt # Dependencies │── README.md # Project documentation │── results.png # Training loss and accuracy graph
bash Copy code
git clone https://github.com/your-username/mnist-digit-classifier.git
cd mnist-digit-classifier
2. Create a virtual environment (optional but recommended)
bash
Copy code
python -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windows
3. Install dependencies
bash
Copy code
pip install -r requirements.txt
4. Run the project
bash
Copy code
python main.py
Results
Training accuracy reaches about 95% in just 3 epochs.
Example training curves are saved in results.png.
Learning Outcomes
How datasets and preprocessing work in AI
Basics of neural networks (input → hidden → output layers)
Training and evaluation with PyTorch
Visualizing performance using graphs
Future Improvements
Use a Convolutional Neural Network (CNN) for higher accuracy (~99%)
Deploy as a simple web app using Flask or Streamlit
Add a feature to draw custom digits and test them