Spaces:
Sleeping
Sleeping
Chnaged input type
Browse files- similarity_search.py +5 -3
similarity_search.py
CHANGED
@@ -90,18 +90,20 @@ def get_feature_vector_img(model, imgs, epoch=10, use_cuda=False):
|
|
90 |
|
91 |
def Model():
|
92 |
backbone = open_clip.create_model_and_transforms('ViT-H-14', None)[0].visual
|
93 |
-
backbone.load_state_dict(th.load('https://huggingface.co/Thenujan/ViT-H-14/blob/main/model.bin')) #
|
94 |
backbone.eval() # Dropping unecessary layers
|
95 |
return backbone
|
96 |
|
97 |
def find(image):
|
|
|
|
|
|
|
|
|
98 |
|
99 |
image = transform_img(image)
|
100 |
|
101 |
image = image.unsqueeze(dim=0)
|
102 |
|
103 |
-
# print(image.shape)
|
104 |
-
|
105 |
feature_vectors_gallery = np.load('./VPR image similarity search/gallary_embedding/feature_vectors_gallery.npy')
|
106 |
|
107 |
model = Model()
|
|
|
90 |
|
91 |
def Model():
|
92 |
backbone = open_clip.create_model_and_transforms('ViT-H-14', None)[0].visual
|
93 |
+
backbone.load_state_dict(th.load('https://huggingface.co/Thenujan/ViT-H-14/blob/main/model.bin')) #https://huggingface.co/hca97/aicrowd-visual-recognition-models/blob/main/model1.pt
|
94 |
backbone.eval() # Dropping unecessary layers
|
95 |
return backbone
|
96 |
|
97 |
def find(image):
|
98 |
+
# img_path = '/kaggle/input/vprtestdata/public_dataset/queries/abiding-inchworm-of-ultimate-freedom.jpeg'
|
99 |
+
|
100 |
+
# image = read_image(img_path)
|
101 |
+
image = np.array(image)
|
102 |
|
103 |
image = transform_img(image)
|
104 |
|
105 |
image = image.unsqueeze(dim=0)
|
106 |
|
|
|
|
|
107 |
feature_vectors_gallery = np.load('./VPR image similarity search/gallary_embedding/feature_vectors_gallery.npy')
|
108 |
|
109 |
model = Model()
|