Git Product home page Git Product logo

imagesearch_vgg16's Introduction

Image search engine using Deep Learning Model based on matsui528 code.

Just like Google image search, here we are going to build a simple Image search engine using the Deep learning model VGG16. Given a query image, we are going to display images similar to it. We are going to implement it using Keras (It is an open-source software library that provides a Python interface for artificial neural networks)and Flask (It is a micro web framework written in Python).

Table of Contents:

  1. VGG16 Architecture
  2. Image search engine flow and code
  3. Conclusion

Example:

image

1. VGG16 Architecture:

VGG16 is a convolutional neural network model that is 16 years deep. It is trained on the ImageNet dataset. The input image should always has the size of 224x224x3 for the VGG16 to work. Here, we are not going to train the VGG16 from scratch because it will take large amount of time and GPU utilization. So we are going to use the weights of the pre-trained model.

VGG16 has multiple convolution, max pool and full connected layers. Convolution: In this layer, we perform the convolution operation over the image using a filter/kernel to detect the edges in the image. Max-pool: It is used to reduce the spatial size of the image and it also helps to reduce over-fitting.

2. Image search engine flow and code:

To implement our image search engine, we are going to use the images from COCO dataset to train our model.

Steps to Implement:

  • First, we will convert our images into the size 224x224x3 because the input of VGG16 should always be 224x224x3.
  • Next, we are going to extract the deep features from all the images in the training dataset (i.e. we are going to convert the image into vector). To extract the deep features, we are passing our input images through the 16 layered VGG model. In the final layer (16th layer) of VGG model, we have 1000 parameters which is used to classify the input images. In our example we will extract the parameters/features from the 15th layers which is a Fully connected layer with 4096 parameters.
  • Basically, we are just converting all our input images of the training dataset into a vector of size 4096 with the help of VGG16.
  • We will then convert the data to an n-dimensional array and perform data pre-processing.

Now we have converted the images into features, our next step is, given an image, we need to find the images which are similar to query image.

  • To do that, whenever we get a query image, we have to convert the query image to vectors by using the same feature extraction technique which we applied on the training images.
  • Then, to identify the similarity between the query image and training data, we calculate the Euclidean distance between the query image and all the training images and sort them based on scores. Euclidean distance/ L2 Norm is the shortest distance between two points in an N dimensional space. It is used as a common metric to measure the similarity between two data points.

To get the query input image and to display the output images to the website, we are using Flask API. Below is the simple html code in order to perform this function.

3. Conclusion:

With the help of VGG16, we have trained a simple image search engine and by training the model on a large dataset, we can have high accuracy.

Note:

This has been added to my Medium story in the below link.
https://prabhitha3.medium.com/image-search-engine-using-deep-learning-model-c452d2637cf6

imagesearch_vgg16's People

Contributors

prabhitha avatar

Stargazers

al-fariqy raihan ( qywok ) avatar 筱枫 avatar Jeremi Herodian Abednigo avatar  avatar Abdul Moeez avatar

Watchers

James Cloos 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.