Developing a deep learning model to classify product images within the Slash application into predefined groups, streamlining product categorization.
Thank you for considering me for the AI Internship at Slash! This repository contains my solution for the Product Image Classifier task.
To tackle this task, I followed a step-by-step approach outlined below:
-
Dataset Download: I obtained the product images by screenshotting them through the Slash application. I used OpenCV to clean the images and unify their shapes, I made two shapes
(1080, 1080, 3)
and(480, 480, 3)
, and because of limited resources, I used the(480, 480, 3)
images to train the model. -
Data Preparation: I preprocessed the images by normalization, and splitting the data into training and validation sets
80:20
. And for the labels, I use one hot encoding as a common practice for my case. -
Model Building: As we have a small dataset I used transfer learning to enhance my model performance and
DenseNet121
was the one that improved the accuracy rather thanInception-ResNet-v2
. I usedsoftmax
as an activation function for the output layer as the model is considered to classify multiple labels instead of a binary label. I usedadam
as an optimizer with a learning rate of0.0001
as it improved accuracy and reduced overfit ( I used dropout layers too in the model architecture to handle the overfitting issue. ). -
Training: I trained the CNN model on the prepared dataset. I used a callback function to save the model state at its best weights tracking the least
val_loss
value which was0.1343
-
Validation: I evaluated the trained model's performance using the validation set to ensure it generalizes well to unseen data, it showed an accuracy of
94.79%
and a loss of0.1343
. -
Testing: Finally, I tested the trained model on a separate test set to assess its overall accuracy and effectiveness in classifying product images.
The dataset used for training the model is available on Kaggle. You can download it from the following link: Kaggle Dataset.
I have also created a Kaggle notebook for this project. You can access it here.
Here's a short video demonstrating the functionality of the Product Image Classifier: Demo