Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Fashion-MNIST Classification with TensorFlow

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.

Dataset and workflow

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.

  1. Load and normalize the dataset.
  2. Train the network for 10 epochs using Adam and sparse categorical cross-entropy.
  3. Plot training and validation accuracy/loss.
  4. Generate predictions, a confusion matrix, and classification reports.
  5. Save and reload the model for inference.

Implemented architecture

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)

Evaluation and limitations

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.

Running the notebook

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.h5 file 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.

Repository contents

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.

About

Fashion-MNIST classification with a dense neural network in TensorFlow/Keras. Academic notebook covering training, inference, and evaluation.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages