This project implements a Convolutional Neural Network (CNN) using TensorFlow and Keras to classify handwritten digits from the MNIST dataset. The model learns to recognize digits (0–9) from grayscale images and achieves high accuracy on the test set.
- Python 3.x
- TensorFlow / Keras
- NumPy
- Matplotlib
- scikit-learn
- seaborn (for visualization)
- MNIST dataset: 70,000 grayscale images of handwritten digits (28x28 pixels).
- 60,000 images for training and 10,000 images for testing.
- Dataset is available directly through Keras datasets API.
- Load MNIST dataset from Keras.
- Normalize pixel values to [0, 1].
- Reshape data to fit CNN input shape
(28, 28, 1).
- Visualize sample digits.
- Analyze dataset distribution.
- Define Sequential CNN model.
- Add convolutional, pooling, dropout, and dense layers.
- Use
ReLUactivations andsoftmaxfor output.
- Compile model with
Adamoptimizer. - Use
sparse_categorical_crossentropyloss. - Track accuracy metric.
- Train model on training data with validation split.
- Visualize training and validation accuracy/loss.
- Evaluate model on test data.
- Generate classification report and confusion matrix.
- Visualize predictions vs true labels.
- Save the trained model to disk (
.kerasformat). - Load model for future inference or further training.