Spaces:
Sleeping
Sleeping
turhancan97
commited on
Commit
•
def8bfd
1
Parent(s):
ee8e678
new model added
Browse files- app.py +12 -6
- vit-t-mae-pretrain.pt +2 -2
app.py
CHANGED
@@ -19,7 +19,7 @@ device = torch.device("cpu")
|
|
19 |
model.to(device)
|
20 |
|
21 |
transform = v2.Compose([
|
22 |
-
v2.Resize((
|
23 |
v2.ToTensor(),
|
24 |
v2.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]),
|
25 |
])
|
@@ -53,21 +53,27 @@ def visualize_single_image(image_path):
|
|
53 |
|
54 |
# MAE reconstruction pasted with visible patches
|
55 |
im_paste = img * (1 - mask) + predicted_img * mask
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
58 |
plt.figure(figsize=(18, 8))
|
59 |
|
60 |
plt.subplot(1, 4, 1)
|
61 |
-
show_image(img
|
62 |
|
63 |
plt.subplot(1, 4, 2)
|
64 |
-
show_image(im_masked
|
65 |
|
66 |
plt.subplot(1, 4, 3)
|
67 |
-
show_image(predicted_img
|
68 |
|
69 |
plt.subplot(1, 4, 4)
|
70 |
-
show_image(im_paste
|
71 |
|
72 |
plt.tight_layout()
|
73 |
|
|
|
19 |
model.to(device)
|
20 |
|
21 |
transform = v2.Compose([
|
22 |
+
v2.Resize((32, 32)),
|
23 |
v2.ToTensor(),
|
24 |
v2.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]),
|
25 |
])
|
|
|
53 |
|
54 |
# MAE reconstruction pasted with visible patches
|
55 |
im_paste = img * (1 - mask) + predicted_img * mask
|
56 |
+
|
57 |
+
# resize the image to 96 x 96
|
58 |
+
img = v2.functional.resize(img[0], (96, 96))
|
59 |
+
im_masked = v2.functional.resize(im_masked[0], (96, 96))
|
60 |
+
predicted_img = v2.functional.resize(predicted_img[0], (96, 96))
|
61 |
+
im_paste = v2.functional.resize(im_paste[0], (96, 96))
|
62 |
|
63 |
+
# make the plt figure larger
|
64 |
plt.figure(figsize=(18, 8))
|
65 |
|
66 |
plt.subplot(1, 4, 1)
|
67 |
+
show_image(img, "original")
|
68 |
|
69 |
plt.subplot(1, 4, 2)
|
70 |
+
show_image(im_masked, "masked")
|
71 |
|
72 |
plt.subplot(1, 4, 3)
|
73 |
+
show_image(predicted_img, "reconstruction")
|
74 |
|
75 |
plt.subplot(1, 4, 4)
|
76 |
+
show_image(im_paste, "reconstruction + visible")
|
77 |
|
78 |
plt.tight_layout()
|
79 |
|
vit-t-mae-pretrain.pt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:852a6a0806c42a8c725b0de82cd0e7b59d7d79ad21f8e012bc599eedcce15375
|
3 |
+
size 28972154
|