loki.retrieve.retrieve_st_by_image
- loki.retrieve.retrieve_st_by_image(image_embeddings, all_text_embeddings, dataframe, k=3)
Retrieves the top-k most similar ST based on the similarity between ST embeddings and image embeddings.
- Parameters:
image_embeddings – A numpy array or torch tensor containing image embeddings (shape: [1, embedding_dim]).
all_text_embeddings – A numpy array or torch tensor containing ST embeddings (shape: [n_samples, embedding_dim]).
dataframe – A pandas DataFrame containing information about the ST samples, specifically the image indices in the ‘img_idx’ column.
k – The number of top similar samples to retrieve. Default is 3.
- Returns:
A list of the filenames or indices corresponding to the top-k similar samples.