title: Tensorflow return similar images
body: <p>I want to use Google's Tensorflow to return similar images to an input image.</p>
  
  <p>I have installed Tensorflow from <a href="http://www.tensorflow.org" rel="noreferrer">http://www.tensorflow.org</a> (using PIP installation - pip and python 2.7) on Ubuntu14.04 on a virtual machine CPU.</p>
  
  <p>I have downloaded the trained model Inception-V3 (inception-2015-12-05.tgz) from <a href="http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz" rel="noreferrer">http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz</a> that is trained on ImageNet Large Visual Recognition Challenge using the data from 2012, but I think it has both the Neural network and the classifier inside it (as the task there was to predict the category). I have also downloaded the file classify_image.py that classifies an image in 1 of the 1000 classes in the model.</p>
  
  <p>So I have a random image image.jpg that I an running to test the model. when I run the command:</p>
  
  <pre><code>python /home/amit/classify_image.py --image_file=/home/amit/image.jpg
  </code></pre>
  
  <p>I get the below output: (Classification is done using softmax)</p>
  
  <pre><code>I tensorflow/core/common_runtime/local_device.cc:40] Local device intra op parallelism threads: 3
  I tensorflow/core/common_runtime/direct_session.cc:58] Direct session inter op parallelism threads: 3
  trench coat (score = 0.62218)
  overskirt (score = 0.18911)
  cloak (score = 0.07508)
  velvet (score = 0.02383)
  hoopskirt, crinoline (score = 0.01286)
  </code></pre>
  
  <p>Now, the task at hand is to find images that are similar to the input image (image.jpg) out of a database of 60,000 images (jpg format, and kept in a folder at /home/amit/images). I believe this can be done by removing the final classification layer from the inception-v3 model, and using the feature set of the input image to find cosine distance from the feature set all the 60,000 images, and we can return the images having less distance (cos 0 = 1)</p>
  
  <p>Please suggest me the way forward for this problem and how do I do this using Python API.</p>