Spaces:
Sleeping
Sleeping
File size: 580 Bytes
e7f1517 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import numpy as np
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
import pickle
data = pickle.load(open("embeddings.pkl", "rb"))
embeddings = data["embeddings"]
filenames = data["filenames"]
thumbs = data["thumbs"]
tsne = TSNE(n_components=2)
reduced = tsne.fit_transform(embeddings)
fig, ax = plt.subplots()
# ax.scatter(reduced[:, 0], reduced[:, 1])
delta = 0.5
for i, txt in enumerate(filenames):
# ax.annotate(txt, (reduced[i, 0], reduced[i, 1]))
x, y = reduced[i]
ax.imshow(thumbs[i], extent=[x-delta, x+delta, y-delta, y+delta])
plt.show()
|