Apparel Classifier is a neural network model that classifies grayscale images of size (28X28)pixels and provides which category of clothing like shirts, T-shirts, Handbags e.tc. This model uses fasion dataset collected from various sources containing images of clothing('Footwear', 'Handbags', 'Shirts', 'T-shirts'). Te dataset has a total o 10,714 images in total
Train images - 7400
Test images - 3314
First the images were converted to grayscale which has pixel values ranging form 0-256 then the grayscale images are pixelized to 28x28 pixels.
After pixelizing the images are compressed to .npz which stores the pixel values in 2-D array(test and train images)
These .npz files are later made to .csv and labelled accordingly to which category they belong('Footwear', 'Handbags', 'Shirts', 'T-shirts'). This categorical data is labelencoded using labelencoder from sklearn and those lables are extracted from the .csv file
So this model dataszet consists of 4 datset files
-
Train images.npz
-
Train labels.npz
-
Test images.npz
-
Test labels.npz
With the help of TensorFlow framework and keras library sequential model is created to create layers, adding optimizers, activation functions, training, testing, etc.,
model = keras.Sequential(
[
Flatten(input_shape=(28, 28)),
# Flatten 28, 28 into single layer having 784 neurons
Dense(15, activation='relu', name='layer1'),
#Dense(4, activation='relu', name='layer2'),
Dense(4) # output layer having exact number neurons as target outputs
]
)
train_images and train_labels are feeded to the model for training and test_images and test_labels are used to test and make predictions
history = model.fit(train_images, train_labels, epochs=10)
The train accuracy of the model is around 89%
The loss for the model is 0.2698
test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2)
print('\nTest accuracy:', test_acc)
The test accuracy of the model is around 85%
Among all the categories of clothis this model is able to predict Footwear, Handbags, T-shirts accurately