This project uses a neural network implemented with TensorFlow to classify handwritten digits from the MNIST dataset. The MNIST dataset consists of 28x28 grayscale images of digits (0-9) and is a popular dataset for testing image classification models.
To run this project, you need to have Python 3.8+ and pip installed.
git clone <https://github.com/aliasofsyn/TensorFlowWorkshop>
cd <repository-folder>python3 -m venv .venv
source .venv/bin/activate pip install -r requirements.txtThe MNIST dataset contains 70,000 images of handwritten digits, split into:
- Training set: 60,000 images
- Test set: 10,000 images
- Each image is 28x28 pixels, with pixel values ranging from 0 to 255.
The preprocessing steps applied to the dataset include:
Normalization: The pixel values are scaled from [0, 255] to [0, 1] for faster convergence. Shuffling and Batching: The training data is shuffled and split into batches of size 128 to improve training efficiency.
The neural network model consists of:
- Input Layer: Flattens the 28x28 images into a 1D array of 784 features.
- Hidden Layer: A dense layer with 128 neurons and ReLU activation.
- Output Layer: A dense layer with 10 neurons (representing digits 0-9) and no activation function, as we use the from_logits=True setting in the loss function.
- Training Accuracy: Achieved ~98.9% accuracy after 8 epochs.
- Validation Accuracy: Achieved ~97.7% accuracy after 8 epochs. The learning curve is visualized using Matplotlib to show training and validation accuracy across 8 epochs.