Project to identify products from IKEA product categories.
Requirements
All dependencies can be installed by running
pip install -r requirements.txt
Data
This project has data scraped from IKEA on four different classes:
Chairs
Beds
Candle Holders
Wardrobes
There are total 2,421 product images in data/model_data directory. However,
Images scrapped alone from IKEA website (using src/FetchData.py) for each product category is
not enough to train a multiclass classifier using a pretrained model.
Hence additional data scraped from google images has been added
to raise number of samples per class at least to 400 images(Images from
google images were downloaded using Download all Images
chrome extension).
Scrapped data is split into train and validation datasets where
validation data has atleast 40 samples per each class
Data preprocessing
Images are standardized by using ImageNet data mean and standard deviations.
Data Augmentations used
random_flip: with p=0.5
rotate: between -10 to 10 degrees
zoom
lightning variations
wrapping
Training a multi-class classifier
Why ResNext_50?
In general ResNet based architectures are found to generalise better
on custom datasets.
ResNext based architecture has a higher model capacity at parameter
cost almost equivalent to ResNet based equivalent architecture
Model specifications
ResNext_50(R50) pretrained is used as a classifier.
Model is defined and trained using src/ResNext_50.ipynb
For transfer learning, the ImageNet specific FC layer of the R50 is removed and replaced
with the following layers
AdaptiveAvgPool2d
AdaptiveMaxPool2d
Flatten
BatchNorm1d
Dropout(p=0.25)
FC (512 units)
ReLU
BatchNorm1d
Dropout(p=0.5)
FC(4 units)
R50 is trained for 20 epochs using one cycle learning rate policy
Train model on IKEA data
To train the model use src/ResNext_50.ipynb notebook
If you are unable to see the notebook in github, you can open it in colab here
Training and Validation loss
Confusion matrix
Interpreting model predictions
As it can be clearly seen the first and second are wrong predictions.
However, in the first example even though the actual label is Bed model predicts it as charis
because this product looks like a sofa, convertable to bed and it also shares lot of common
features with chairs class.
In second prediction, model is predicting as wardrobe because of the
background in the image which do have a mini shelf structure similar to wardrobe.
Model weights
Model weights are saved to data/model_data/models dir when model.save(‘model_name’’) is performed
in src/ResNext_50.ipynb