Using vector stores
The intuition of vector stores is as follows: if we can group all the vectors into a certain number of clusters, for a new vector, we can first identify the cluster that it is likely to belong to, and then we can calculate the distance of the new vector with the images that belong to the same cluster.
This process helps to avoid computation across all images, thereby reducing the computation time considerably.
FAISS is an open-source library built by Meta to perform fast approximate similarity search between vectors. There is a wide range of both open-source and proprietary vector store libraries. We strongly recommend you review those once you understand the need for vector stores through the following scenario.
Now that we have an understanding of vector stores, let’s go ahead and perform the following steps:
- Store the training image embeddings in a vector store.
- Compare the time it takes to retrieve the three closest images...