From the course: Advanced RAG Applications with Vector Databases
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Solution: Find the dog most similar to a cat
From the course: Advanced RAG Applications with Vector Databases
Solution: Find the dog most similar to a cat
(bright upbeat music) - [Instructor] We're looking for the dog that is most similar to cats. So, we have all of our vectors stored in our vector store, we have our retriever. What we do now is we create this path here, which gives us all of the paths of the dog images, then we create a dictionary that will map the paths of the dogs to the paths of the cats in an inversely-weighted order. So, for each of those dog paths, we retrieve the top four images based on the Base64 encoding of that dog image, and then we set this cats_retrieved image to zero, and we loop through this enumerated list of all of the return documents. And if the word cat is in the source returned, then we know that that's a cat image. We add 4 minus I, which is the inverse weight of that image based on where it appears in your top four results to the number of cats retrieved. After we do this calculation, we go through, and we attach to each dog image what its cat score was, and when we look at these scores, we can…
Contents
-
-
-
-
(Locked)
Introduction to vector embeddings for images2m 8s
-
Vision models 1014m 58s
-
(Locked)
Demo: Getting semantic vectors57s
-
(Locked)
Demo: Storing image vectors1m 10s
-
(Locked)
Demo: Comparing images semantically46s
-
(Locked)
Challenge: Find the dog most similar to a cat42s
-
(Locked)
Solution: Find the dog most similar to a cat1m 46s
-
(Locked)
-
-