13 lines
532 B
Python
13 lines
532 B
Python
from similarity_finder import ImageSimilarityFinder
|
|
|
|
# Initialize with the embeddings pickle file (not an image file)
|
|
finder = ImageSimilarityFinder("E:/GiteaRepo/text2img/embeddings/image_embeddings.pkl")
|
|
|
|
# Query with the actual image path
|
|
query_image = "data/coco/val2017/1140002154.jpg"
|
|
similar_images = finder.find_similar_by_path(query_image, k=5)
|
|
|
|
print(f"Top 5 similar images to {query_image}:")
|
|
for i, (image_path, similarity) in enumerate(similar_images, 1):
|
|
print(f"{i}. {image_path} (similarity: {similarity:.4f})")
|