Final VPR App
Browse files- .gitignore +0 -1
- app.py +10 -1
- model.ipynb +0 -0
- similarity_search.py +0 -9
.gitignore
CHANGED
@@ -1 +0,0 @@
|
|
1 |
-
model1.pt
|
|
|
|
app.py
CHANGED
@@ -66,6 +66,15 @@ def main():
|
|
66 |
|
67 |
# similar_image_ids = get_similar_images(temp_image_path)
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
client = Client("https://thenujan-vpr-deploy.hf.space/")
|
70 |
result = client.predict(
|
71 |
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image) in 'image' Image component
|
@@ -91,7 +100,7 @@ def main():
|
|
91 |
end_idx = min(start_idx + images_per_page, len(similar_image_ids))
|
92 |
|
93 |
images_per_row = 4
|
94 |
-
target_size = (256, 224) # Size to resize the images
|
95 |
|
96 |
for i in range(start_idx, end_idx, images_per_row):
|
97 |
row_images = similar_image_paths[i:i + images_per_row]
|
|
|
66 |
|
67 |
# similar_image_ids = get_similar_images(temp_image_path)
|
68 |
|
69 |
+
target_size = (224, 280) # Size to resize the images
|
70 |
+
|
71 |
+
search_image = read_image(temp_image_path)
|
72 |
+
|
73 |
+
resized_search_image = Image.fromarray(search_image).resize(target_size)
|
74 |
+
|
75 |
+
st.image(resized_search_image, caption="Input Image", use_column_width=False)
|
76 |
+
|
77 |
+
|
78 |
client = Client("https://thenujan-vpr-deploy.hf.space/")
|
79 |
result = client.predict(
|
80 |
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image) in 'image' Image component
|
|
|
100 |
end_idx = min(start_idx + images_per_page, len(similar_image_ids))
|
101 |
|
102 |
images_per_row = 4
|
103 |
+
# target_size = (256, 224) # Size to resize the images
|
104 |
|
105 |
for i in range(start_idx, end_idx, images_per_row):
|
106 |
row_images = similar_image_paths[i:i + images_per_row]
|
model.ipynb
DELETED
File without changes
|
similarity_search.py
CHANGED
@@ -95,22 +95,13 @@ def Model():
|
|
95 |
return backbone
|
96 |
|
97 |
def find(img_path):
|
98 |
-
# img_path = '/kaggle/input/vprtestdata/public_dataset/queries/abiding-inchworm-of-ultimate-freedom.jpeg'
|
99 |
|
100 |
image = read_image(img_path)
|
101 |
|
102 |
image = transform_img(image)
|
103 |
|
104 |
-
print('1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
105 |
-
|
106 |
image = image.unsqueeze(dim=0)
|
107 |
|
108 |
-
print('2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
109 |
-
|
110 |
-
print(image.shape)
|
111 |
-
|
112 |
-
print('3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
113 |
-
|
114 |
feature_vectors_gallery = np.load('./VPR image similarity search/gallary_embedding/feature_vectors_gallery.npy')
|
115 |
|
116 |
model = Model()
|
|
|
95 |
return backbone
|
96 |
|
97 |
def find(img_path):
|
|
|
98 |
|
99 |
image = read_image(img_path)
|
100 |
|
101 |
image = transform_img(image)
|
102 |
|
|
|
|
|
103 |
image = image.unsqueeze(dim=0)
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
feature_vectors_gallery = np.load('./VPR image similarity search/gallary_embedding/feature_vectors_gallery.npy')
|
106 |
|
107 |
model = Model()
|