This is a simple clothing recognition system that classifies a clothing item into one of 10 classes by applying deep learning models. The 10 classes are belt, covered shoes, dress, high heels, pants, shirt, skirt, slippers, socks and spectacles. Two deep learning models are experimented, multilayer perceptron (MLP) and convolutional neural network (CNN).
There is a total of 6059 images. The number of images of each class is presented in the table below.
Class Name | Number of Images | Image Sample |
---|---|---|
Belt | 600 | ![]() |
Dress | 600 | ![]() |
High_Heels | 600 | ![]() |
Pants | 612 | ![]() |
Shirt | 643 | ![]() |
Shoes | 600 | ![]() |
Skirt | 600 | ![]() |
Slipper | 600 | ![]() |
Socks | 604 | ![]() |
Spectacles | 600 | ![]() |
The train_test_split funciton is used to split the data into training set and testing set. After that, part of the training set i used as the validation set. For the Multilayer Perceptron model,
- Training samples = 4907
- Validation samples = 546
- Testing samples = 606
For the CNN model,
- Training samples = 5000
- Validation samples = 453
- Testing samples = 606
Before splitting the datasets, all images are resized to 84*84 pixels
. Numbers (1 to 10) are used to represent each class. For example, 0 for belt and 1 for shirt.
- Multilayer Perceptrons (MLP)
- 4 hidden layers (300 nuerons, 300 neurons, 100 neurons, and 10 neurons respectively)
- Activation function for first 3 hidden layers are 'relu', meanwhile the activation funciton for the last hidden layer is 'softmax'
- Optimiser used is SGD
- Convolutional Neural Network
Convolutional Layer 1
The input image is 84 * 84 pixels
. The filter kernel is 7 * 7 pixels
. The 64 filter kernels will convolve with the input images with stride=1, and produce 64 78 * 78 pixels
feature maps.
The output size of 1 feature map can be calculated as below,
Output size = [84 – 7]/1 + 1 = 78
Pooling Layer 1
After the first convolutional layer, the feature maps are pooled with 2 * 2
max pool layer with stride=2, and produce 64 39 * 39 pixels
feature maps.
Output size = [78 – 2]/2 + 1 = 39
Convolutional Layer 2
After the first pooling layer, the feature map is 39 * 39 pixels
. The filter kernel is 7 * 7 pixels
. The 128 filter kernels will convolve with the feature maps with stride=1, and produce 8192 33 * 33 pixels
feature maps.
Output size = [39 – 7]/1 +1 = 33
Pooling Layer 2
After the second convolutional layer, the feature maps are pooled with 2 * 2
max pool layer with stride=2, and produce 8192 16 * 16 pixels
feature maps.
Output size = [33 – 2]/2 + 1 = 16
Convolutional Layer 3
After the second pooling layer, the feature map is 16 * 16 pixels
. The filter kernel is 7 * 7 pixels
. The 128 filter kernels will convolve with the feature maps with stride=1, and produce 1048576 10 * 10 pixels
feature maps.
Output size = [16 – 7]/1 +1 = 10
Pooling Layer 3
After the third convolutional layer, the feature maps are pooled with 2 * 2
max pool layer with stride=2, and produce 1048576 5 * 5 pixels
feature maps.
Output size = [10 - 2]/2 + 1 = 5
Joey Lim, Y.F.,Tan, J.C.,Tan, Z.X.,Ng, B.S.,Leong
This project is made for my TML 2221 Machine Learning
subject. The original program of this assignment is modified and updated.