This notebook will guide you through the process of analyzing an image dataset using a pre-trained convolution network (VGG16) and extracting feature vectors for each image
Post analysis we try to demonstrate 'reverse image search' one of the widely popular applications of image analysis.
-
Download VGG16 pre-trained model using keras
-
Perform Feature Extraction :
Here we remove the last layer ie.,the softmax classification layer so our output model now has only 12 layers and the last layer would be fc2(Dense) a fully connected layer
-
Get feature vectors for all the images then scale them down using PCA
-
Use cosine distance between pca features to compare the query image to 5 number of closest images and return them as thumbnails
-
Sign up for IBM's Watson Studio. By creating a project in Watson Studio a free tier
Object Storage
service will be created in your IBM Cloud account. Take note of your service names as you will need to select them in the following steps. -
If you are running it on cpu and have decided to reduce the image dataset size you may end up with reduced prediction accuracy
Note: When creating your Object Storage service, select the
Free
storage type in order to avoid having to pay an upgrade fee.
- Create a new Project in Watson Studio (New --> Standard project)
- Create a GPU Environment (Environment --> New Environment --> GPU Beta)
- Create a new Notebook (Add to project --> Notebook --> from url)
- Provision the notebook on newly created GPU Environment
- Stop the Environment Post usage
- Clone the repository
git clone https://github.com/krishnac7/Reverse_image_search.git
- Navigate into the directory
cd Reverse_image_search-master
- Run using Jupyter notebooks
jupyter notebook
This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 and the Apache License, Version 2.