Searching images

In previous lessons, you learned how vectors and embeddings can represent data in different formats. You used embeddings and a vector index to find similar text.

In this lesson, you will explore a dataset of movie posters and see how you can use vectors and embeddings to find similar images.

Movie posters

GraphAcademy has loaded a dataset of movie posters into the sandbox. Each movie has a URL to a poster image:

cypher
MATCH (m:Movie {title: 'Toy Story'})
RETURN m.title, m.poster

Toy Story movie poster

The data also contains embeddings for each poster:

cypher
MATCH (m:Movie {title: 'Toy Story'})
RETURN m.title, m.posterEmbedding

Creating the embeddings

We used the OpenAI Clip Model to create the poster embeddings.

The solutions/poster_embeddings.py program in the llm-vectors-unstructured repository created the embeddings by downloading the posters and passing them to the clip model.

Similar posters

In the same way, you can use a vector index to find similar text; you can use a vector index to find similar images.

cypher
MATCH (m:Movie{title: 'Babe'})

CALL db.index.vector.queryNodes('moviePosters', 6, m.posterEmbedding)
YIELD node, score

RETURN node.title, node.poster, score;
3 movie posters

While the posters may be similar, the movies may not be. The embeddings are of the images, not the movie content.

Pick a different movie and write a similar Cypher query to find similar posters.

cypher
Find all movies
MATCH (m:Movie)
RETURN m.title

Once you have finished exploring the movie posters, click Continue to move on to the next module.

Lesson Summary

In this lesson, you explored using vectors and embeddings to find similar images.

In the next module, you will learn how to create embeddings and vector indexes.