Python · TensorFlow/Keras · Jupyter · machine learning
An academic experiment in image classification using a dense neural network. The notebook covers dataset preparation, training, prediction, model saving/loading, and evaluation across ten clothing categories.
The notebook loads Fashion-MNIST through TensorFlow/Keras. Each input is a 28×28 grayscale image; pixel values are divided by 255 before training and prediction.
- Load and normalize the dataset.
- Train the network for 10 epochs using Adam and sparse categorical cross-entropy.
- Plot training and validation accuracy/loss.
- Generate predictions, a confusion matrix, and classification reports.
- Save and reload the model for inference.
The published notebook defines this fully connected network:
Flatten (28×28 input → 784 values)
↓
Dense (128 units, ReLU)
↓
Dropout (0.2)
↓
Dense (10 units, softmax)
The stored notebook output reports 87.42% accuracy and a weighted F1 score of approximately 0.8738 on 10,000 images. These are historical outputs included in the notebook, not results from a newly reproduced run.
The current training code passes the official test split as validation data during training and later evaluates on that same split. These results therefore should not be presented as an independent held-out benchmark. A further experiment should reserve validation data from the training split and keep the test split for final evaluation.
The original dependency versions and random seed are not fully recorded, so a new run may produce different results.
Use a Python environment compatible with TensorFlow. The saved notebook output references Python 3.10; the repository does not currently pin a complete environment.
python -m pip install tensorflow numpy matplotlib scikit-learn jupyterlab
python -m jupyterlab predict_model.ipynb
Run these commands from the repository directory, preferably in a virtual environment. The first dataset load requires internet access.
- Training: run the first cell. It trains the network and overwrites the local
fashion_mnist_model.h5file with the new model. - Inference with the included model: run the final self-contained cell, which imports the libraries, loads the model and dataset, and generates predictions and evaluation plots. This avoids retraining.
| File | Purpose |
|---|---|
| predict_model.ipynb | Training, evaluation, model loading, and prediction examples |
| fashion_mnist_model.h5 | Included saved Keras model artifact |
This project documents an academic learning exercise and its current experimental limitations.