Update app.py
Browse files
app.py
CHANGED
@@ -29,9 +29,12 @@ def create_retrieval_figure(res):
|
|
29 |
break
|
30 |
current_image_path = "dataset/" + image.split("/")[3] + "/" + image.split("/")[4]
|
31 |
archive = zipfile.ZipFile('dataset.zip', 'r')
|
32 |
-
|
33 |
-
|
|
|
34 |
# image_resized = cv2.resize(image, (224, 224), interpolation=cv2.INTER_LINEAR)
|
|
|
|
|
35 |
ax = fig.add_subplot(rows, cols, i + 1)
|
36 |
plt.axis('off')
|
37 |
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
|
|
29 |
break
|
30 |
current_image_path = "dataset/" + image.split("/")[3] + "/" + image.split("/")[4]
|
31 |
archive = zipfile.ZipFile('dataset.zip', 'r')
|
32 |
+
try:
|
33 |
+
imgfile = archive.read(current_image_path)
|
34 |
+
image = cv2.imdecode(np.frombuffer(imgfile, np.uint8), 1)
|
35 |
# image_resized = cv2.resize(image, (224, 224), interpolation=cv2.INTER_LINEAR)
|
36 |
+
except Exception:
|
37 |
+
image = cv2.imdecode(np.array((3, 224, 224), np.uint8), 1)
|
38 |
ax = fig.add_subplot(rows, cols, i + 1)
|
39 |
plt.axis('off')
|
40 |
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|