Ajustando limite de resultados
Browse files- image_similarity.py +3 -3
image_similarity.py
CHANGED
|
@@ -18,7 +18,7 @@ class ImageSimilarity(object):
|
|
| 18 |
# all other images and returns a list with the pairs that have the highest
|
| 19 |
# cosine similarity score
|
| 20 |
processed_images = util.paraphrase_mining_embeddings(encoded_image)
|
| 21 |
-
NUM_SIMILAR_IMAGES = 10
|
| 22 |
|
| 23 |
# =================
|
| 24 |
# DUPLICATES
|
|
@@ -43,10 +43,10 @@ class ImageSimilarity(object):
|
|
| 43 |
# you will get larger clusters which have less similar images in it. Threshold 0 - 1.00
|
| 44 |
# A threshold of 1.00 means the two images are exactly the same. Since we are finding near
|
| 45 |
# duplicate images, we can set it at 0.99 or any number 0 < X < 1.00.
|
| 46 |
-
threshold = 0.
|
| 47 |
near_duplicates = [image for image in processed_images if image[0] < threshold]
|
| 48 |
|
| 49 |
-
for score, image_id1, image_id2 in near_duplicates
|
| 50 |
results.append({
|
| 51 |
'score': score,
|
| 52 |
'image1': pil_images[image_id1]["key"],
|
|
|
|
| 18 |
# all other images and returns a list with the pairs that have the highest
|
| 19 |
# cosine similarity score
|
| 20 |
processed_images = util.paraphrase_mining_embeddings(encoded_image)
|
| 21 |
+
# NUM_SIMILAR_IMAGES = 10
|
| 22 |
|
| 23 |
# =================
|
| 24 |
# DUPLICATES
|
|
|
|
| 43 |
# you will get larger clusters which have less similar images in it. Threshold 0 - 1.00
|
| 44 |
# A threshold of 1.00 means the two images are exactly the same. Since we are finding near
|
| 45 |
# duplicate images, we can set it at 0.99 or any number 0 < X < 1.00.
|
| 46 |
+
threshold = 0.99
|
| 47 |
near_duplicates = [image for image in processed_images if image[0] < threshold]
|
| 48 |
|
| 49 |
+
for score, image_id1, image_id2 in near_duplicates:
|
| 50 |
results.append({
|
| 51 |
'score': score,
|
| 52 |
'image1': pil_images[image_id1]["key"],
|