UMass-Rescue / ImageSearch_CLIP

A system that creates clip embedding vectors for a large corpus of images, enabling efficient retrieval of images based on natural language text.
0 stars 1 forks source link

Add Normalization for Cosine Similarity in FAISS Indexing #72

Closed sravanigona closed 1 week ago

sravanigona commented 1 week ago

Description: Currently, the image embeddings are added to the FAISS index using the inner product similarity (IndexFlatIP). However, for accurate cosine similarity comparison, the embeddings need to be normalized to unit vectors. This normalization ensures that the inner product will directly correspond to cosine similarity.

Outcome: The embeddings are normalized to unit vectors, ensuring they represent cosine similarity when using the FAISS index with IndexFlatIP.