This project implements a convolutional neural network (CNN) to detect and classify different types of clothing items from images in the Fashion MNIST dataset. The model is built using TensorFlow and Keras, and it classifies images into one of 10 clothing categories such as shirts, trousers, shoes, etc.
The primary goal of this project is to create an image classification model that accurately identifies various types of clothing from grayscale 28x28 pixel images. The dataset includes 60,000 training images and 10,000 test images, each labeled with one of 10 categories.
The Fashion MNIST dataset consists of the following clothing categories:
- T-shirt/top
- Trouser
- Pullover
- Dress
- Coat
- Sandal
- Shirt
- Sneaker
- Bag
- Ankle boot
Each image is a 28x28 pixel grayscale image associated with a label from one of these categories.
The model uses a Convolutional Neural Network (CNN) architecture, which includes:
- Input layer: 28x28 grayscale images reshaped into (28, 28, 1)
- Convolutional layers: Extracting spatial features from the input images
- MaxPooling layers: Reducing the spatial dimensions to focus on key features
- Fully connected (Dense) layers: Learning high-level representations for classification
- Softmax output layer: Outputting the probability distribution across the 10 classes
Layer (type) Output Shape Param #
=================================================================
conv2d (Conv2D) (None, 26, 26, 32) 320
max_pooling2d (MaxPooling2D) (None, 13, 13, 32) 0
conv2d_1 (Conv2D) (None, 11, 11, 64) 18496
max_pooling2d_1 (MaxPooling2D) (None, 5, 5, 64) 0
conv2d_2 (Conv2D) (None, 3, 3, 64) 36928
flatten (Flatten) (None, 576) 0
dense (Dense) (None, 64) 36928
dense_1 (Dense) (None, 10) 650
=================================================================
Total params: 93,322
Trainable params: 93,322
Non-trainable params: 0
To run this project, you'll need to install the required dependencies:
pip install tensorflow matplotlib-
Clone this repository:
git clone https://github.com/tejaspavanb/cloth-detection.git cd cloth-detection -
Train the model by running:
python train_model.py
-
The training process will output the accuracy and loss of the model. You can also visualize sample predictions:
python predict_sample.py
The CNN model achieved an accuracy of 87% on the test set.
- Explore more advanced architectures like ResNet and VGG for improved accuracy.
- Implement techniques like data augmentation and regularization to avoid overfitting.
- Deploy the model using a web interface for real-time clothing detection.
Feel free to submit issues or pull requests if you'd like to contribute to the project!
This project is licensed under the MIT License - see the LICENSE file for details.