Step 4: Customizing Vector Stores
Customizing the Deep Lake Vector Store
How to Customize Deep Lake Vector Stores for Images, Multi-Embedding Applications, and More.
Under-the-hood, Deep Lake vector stores use the Deep Lake tabular format, where Tensors
are conceptually equivalent to columns. A unique feature in Deep Lake is that Tensors can be customized to a variety of use-cases beyond simple embeddings of text.
Creating vector stores with non-text data
To create a Vector Store for images, we should write a custom embedding function that embeds images from a file using a neural network, since we cannot use OpenAI for embedding images yet.
Lets download and unzip 6 example images with common objects and create a list of containing their filenames.
Earlier in this tutorial, we did not specify any data-structure-related information when initializing the Vector Store, which by default creates a vector store with tensors for text
, metadata
, id (auto-populated)
, and embedding
.
Here, we create a Vector Store for image similarity search, which should contains tensors for the image
, its embedding
, and the filename
for the image. This can be achieved by specifying custom tensor_params
.
We add data to the Vector Store just as if we were adding text data earlier in the Getting Started Guide.
Performing image similarity search
Let's find the image in the Vector Store that is most similar to the reference image below.
We can display the result of the most similar image, which shows a picture of a yellow Lamborghini, which is fairly similar to the black Porsche above.
Creating Vector Stores with multiple embeddings
COMING SOON