A neural network built with TensorFlow/Keras to classify images of clothing from the Fashion-MNIST dataset.
This project introduces the fundamentals of deep learning and computer vision by building a neural network to classify images of clothing. The model is trained on the Fashion-MNIST dataset, a collection of 70,000 grayscale images across 10 different fashion categories. The goal is to demonstrate the end-to-end process of building, training, and evaluating a neural network using modern tools like TensorFlow and Keras.
The project uses the Fashion-MNIST dataset, which is conveniently included with the Keras library. It is split into 60,000 images for training and 10,000 images for testing. Each image is a 28x28 grayscale representation of a piece of clothing.
The workflow for this project involved the following key steps:
-
Data Loading & Preprocessing: The data was loaded directly from Keras. The primary preprocessing step was normalizing the pixel values from a 0-255 range to a 0-1 range to optimize the training process.
-
Model Architecture: A sequential neural network was designed using the Keras API with the following structure:
- An Input Layer (
Flatten) to convert each 28x28 image into a 1D vector. - A Hidden
DenseLayer with 128 neurons and aReLUactivation function to learn the underlying patterns in the images. - An Output
DenseLayer with 10 neurons (one for each class) and asoftmaxactivation function to produce a probability distribution for the final classification.
- An Input Layer (
-
Training & Evaluation: The model was compiled using the
adamoptimizer andsparse_categorical_crossentropyloss function. It was then trained for 10 epochs, and its performance was evaluated on the unseen test set to measure its real-world accuracy.
The trained neural network achieved a test accuracy of approximately 88%. This result demonstrates a solid ability to build and train a functional computer vision model from scratch. The training history showed a consistent increase in accuracy and decrease in loss, indicating a successful learning process.
This project is a foundational piece for tackling more complex computer vision tasks.
- Python 3
- TensorFlow & Keras: For building and training the neural network.
- NumPy: For numerical operations.
- Matplotlib: For visualizing the data and training results.