更新 find_similar_img.py

This commit is contained in:
ldy 2025-06-13 07:16:28 +00:00
parent 47b9279725
commit a4f028c25d

View File

@ -6,8 +6,8 @@ from sklearn.metrics.pairwise import cosine_similarity
from embedder import ImageEmbedder from embedder import ImageEmbedder
# ——— Load stored embeddings & mapping ——— # ——— Load stored embeddings & mapping ———
vecs = np.load("processed_images/image_vectors.npy") # (N, D) vecs = np.load("imgVecs/image_vectors.npy") # (N, D)
with open("processed_images/index_to_file.pkl", "rb") as f: with open("imgVecs/index_to_file.pkl", "rb") as f:
idx2file = pickle.load(f) # dict: idx → filepath idx2file = pickle.load(f) # dict: idx → filepath
# ——— Specify query image ——— # ——— Specify query image ———