evelyncsb's picture
add imgs
de33293
raw
history blame
413 Bytes
import os
import pickle
# teste = pickle.load(open("df_to_search.pkl","rb"))
def calculate_similarity():
image_features = embeddings[ModalityType.VISION]
text_features = embeddings[ModalityType.TEXT]
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)
similarity = text_features.cpu().numpy() @ image_features.cpu().numpy().T