SanjeetS7 / Product-Classification-using-Self-Designed-DataSet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Product Classification using Self Designed DataSet

This project is all about creating your own dataset from scratch and making a robust classifier. There are in total four classes namely Coke Can, ThumbsUp Can, Mirinda Bottle, Tide Packet! The predictions of the network are stored in the Results folder.
The model achieves ~97%-98% accuracy on the data stored in the Results folder with almost 100% accuracy on the training set.
The data was collected in two ways:
  1. Clicking pictures from iPhone 6S plus and,
  2. Recording videos from Laptop.

One of the key aspect while collecting the training data was to make sure all the products have similar backgrounds so that the network learns the meaningful and discriminative features of the products in the images and not the Background.

Second most important part was to make sure that the distribution of the validation data is almost the same as the testing data. This helped me to boost the performance of my network a lot since I made the architectural and hyperparameter changes based on the validation data that had the distribution similar to what I would expect in a real-life scenario (testing environment).

From the Results section it should be clear to you that the background in the images is quite diverse and the model is able to classify almost all of the products correctly.

Link to the Video: Product Classification using Self Designed DataSet Playlist

  1. Install virtual environment
pip3 install virtualenv
  1. Initiate virtual environment
virtualenv venv
  1. Activate virtualenv
source venv/bin/activate
  1. Install the requirements
pip3 install -r requirements.txt
  1. To create your own dataset from videos, run the below command by specifying the video (from path) and frames (to path). You shall expect for a 1 min. video 60 frames.
python3 video_to_images.py
  1. Both training and testing (on images) is in the Classification.ipynb notebook, which can be opened in a jupyter notebook. Otherwise, run the below command in your virtual environment. Make sure to specify correct training and validation data paths.
python3 Classification.py
  1. To test the model in real-time using your laptop's web camera the webcamera.py script can be useful. Multi-threading is used to avoid the delay in reading each frame and model's prediction on each frame. Both .ipynb and .py files are present in the repository.
python3 Web_Camera.py

About


Languages

Language:Jupyter Notebook 98.7%Language:Python 1.3%