This note is about how to make a simple image search by another image with Tensroflow.

This type of search is useful:

  1. If you need to find similar images in your image database.
  2. If you need to be sure that new image which you want to add to your collection is unique.
  3. Other cases.

Example from Google:
image search from google

Algorithm

  1. Extract features from all images in your database with pretrained tensorflow model for image classification (MobileNet in this example).
  2. Extract feature from image which you want to use for search.
  3. Get the distance between feature vectors and sort them in ascending order.
  4. The distance that is closer to zero will correspond to the most similar image.

Full code

In this example we used image database from Meming Bot.