Last active
October 31, 2021 07:06
-
-
Save MaartenGr/c826102b602090b9a7db011b09c4645d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
from sentence_transformers import util | |
# Load pre-trained image embeddings | |
emb_filename = 'unsplash-25k-photos-embeddings.pkl' | |
if not os.path.exists(emb_filename): #Download dataset if does not exist | |
util.http_get('http://sbert.net/datasets/'+emb_filename, emb_filename) | |
with open(emb_filename, 'rb') as fIn: | |
img_names, image_embeddings = pickle.load(fIn) | |
img_names = [f"photos/{path}" for path in img_names] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment