images to convert to COLOR_BGR2RGB
Browse files- s23_openai_clip.py +8 -1
s23_openai_clip.py
CHANGED
@@ -439,7 +439,14 @@ def find_matches(model, image_embeddings, query, image_filenames, n=9):
|
|
439 |
|
440 |
values, indices = torch.topk(dot_similarity.squeeze(0), n * 5)
|
441 |
matches = [image_filenames[idx] for idx in indices[::5]]
|
442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
|
444 |
|
445 |
"""This is how we use this function. Aaaannnndddd the results:
|
|
|
439 |
|
440 |
values, indices = torch.topk(dot_similarity.squeeze(0), n * 5)
|
441 |
matches = [image_filenames[idx] for idx in indices[::5]]
|
442 |
+
|
443 |
+
images = []
|
444 |
+
_, axes = plt.subplots(3, 3, figsize=(10, 10))
|
445 |
+
for match, ax in zip(matches, axes.flatten()):
|
446 |
+
image = cv2.imread(f"{CFG.image_path}/{match}")
|
447 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
448 |
+
images.append(image)
|
449 |
+
return images
|
450 |
|
451 |
|
452 |
"""This is how we use this function. Aaaannnndddd the results:
|