Creating an inverse image search index with deep learning
Because the whole point of an autoencoder is to learn an encoding or a low-dimensional representation of a set of images, they make for great feature extractors. Furthermore, we can use them as the perfect building blocks of image search indices, as we'll discover in this recipe.
Getting ready
Let's install OpenCV
with pip
. We'll use it to visualize the outputs of our autoencoder, in order to visually assess the effectiveness of the image search index:
$> pip install opencv-python
We'll start implementing the recipe in the next section.
How to do it…
Follow these steps to create your own image search index:
- Import the necessary libraries:
import cv2 import numpy as np from tensorflow.keras import Model from tensorflow.keras.datasets import fashion_mnist from tensorflow.keras.layers import *
- Define
build_autoencoder()
, which instantiates the autoencoder. First, let&apos...