Skip to content

Instantly share code, notes, and snippets.

@gautham20
Created July 13, 2019 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gautham20/4a091c7505747e58152eea1f61d8f27a to your computer and use it in GitHub Desktop.
Save gautham20/4a091c7505747e58152eea1f61d8f27a to your computer and use it in GitHub Desktop.
def get_similar_images_annoy(img_index):
start = time.time()
base_img_id, base_vector, base_label = img_repr_df.iloc[img_index, [0, 1, 2]]
similar_img_ids = t.get_nns_by_item(img_index, 13)
end = time.time()
print(f'{(end - start) * 1000} ms')
return base_img_id, base_label, img_repr_df.iloc[similar_img_ids[1:]]
base_image, base_label, similar_images_df = get_similar_images_annoy(212693)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment