Giter Site home page Giter Site logo

morslomi / deepfashion Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 6.0 18.12 MB

Implementation of a convolutional neural network model on real life data (self-taken images). Using transfer learning technique with a pre-trained model (VGG16) to classify images of clothing, built by Keras, Python.

Python 100.00%
deep-learning convolutional-neural-networks fashion-classifier keras image-classification transfer-learning

deepfashion's Introduction

DeepFashion

The inspiration of starting this project came from the passion I have for Technolegy & Fashion. The idea was to create an image classification with data that I have intrest in (my own clothes). My goal of this project is to create an accurate image classifier using images of clothes from my own closet in order to challenge myself and deal with real life data problems.

Dataset

As mentioned, the dataset consists of images of clothes from my own closet: 50 Tops, 50 Bottoms, 26 shoes (in the near future I will add more images). Here's an example of some images (after resizing the images 244 * 244) :

DeepFashionVGG16_presenting_imgs

All images were taken from a cell phone camera.

I moved the images to google drive in order to work with google colab (which enables to speed up the running time of the network with GPU). Then separated the data into train (106 images) and validation (21 images) and kept it in the “train” and “validation” folders.

As you can see, my dataset is small and there are not enough images in order to train a model from scratch, for this reason I decided to use a pre-trained model (VGG16) and fine-tune it with my data. To do so I loaded the pre-trained model without the top layer (which consists of fully connected layers). Then freeze the weights of all layers so that these layers will not be trained again.

Building the model

I created a new model. The new model is based on the pre-trained model (VGG16 without the top layer). On top of it I added a fully connected layer, a batch normalization layer, a dropout layer and a softmax layer with three outputs (as the number of classes).

summary_model

In addition, I preformed data augmentation, which is a technique that can be used to artificially expand the size of a training dataset by creating modified versions of images in the dataset. Commom techniques of data augmentation include rotation, zooming, cropping, flipping, etc. The techniques I used are rescale, shifting the picture a few pixels, shearing, zooming and fliping.

Training the model

Next, I trained the model with the following hyperparameters:

  • Training batch size = 30
  • Validation batch size = 21
  • Epochs = 45
  • 'Adam' optimizer with learning rate = 1e-5 and momentum = 0.99

Evaluation

In order to evatuate the model I created learning curves:

Learning Curves - Accuracy Learning Curves - Accuracy

The validation accuracy is: 0.98

The validation loss is: 0.119

If we take a look at the confusion matrix, we will find out that the only error is between bottom and top:

Confusion_matrix

Here's an example of the predicted labels vs. the real labels for a few images: predicted_images

Future Work

In the near future, my intention is to add more images and insert them as testset. In addition, I am thinking to add more images of different classes of clothes (as dresses, coats, jumpers, etc).

deepfashion's People

Contributors

morslomi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.