turhancan97 commited on
Commit
def8bfd
1 Parent(s): ee8e678

new model added

Browse files
Files changed (2) hide show
  1. app.py +12 -6
  2. 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((96, 96)),
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
- # make the plt figure larger
58
  plt.figure(figsize=(18, 8))
59
 
60
  plt.subplot(1, 4, 1)
61
- show_image(img[0], "original")
62
 
63
  plt.subplot(1, 4, 2)
64
- show_image(im_masked[0], "masked")
65
 
66
  plt.subplot(1, 4, 3)
67
- show_image(predicted_img[0], "reconstruction")
68
 
69
  plt.subplot(1, 4, 4)
70
- show_image(im_paste[0], "reconstruction + visible")
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:0abe9d41d86e1dab46b8ae0139e6bfd5c3e909c41ccb7b7d7e77f8558e4f6db1
3
- size 29121704
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:852a6a0806c42a8c725b0de82cd0e7b59d7d79ad21f8e012bc599eedcce15375
3
+ size 28972154