YannisK commited on
Commit
5d89783
·
1 Parent(s): b489890
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -37,24 +37,24 @@ transform = transforms.Compose([
37
  ])
38
  # ---------------------------------------
39
 
40
- class ImgDataset(data.Dataset):
41
-
42
- def __init__(self, images, imsize):
43
- self.images = images
44
- self.imsize = imsize
45
- self.transform = transforms.Compose([transforms.ToTensor(), \
46
- transforms.Normalize(**dict(zip(["mean", "std"], net.runtime['mean_std'])))])
47
 
48
 
49
- def __getitem__(self, index):
50
- img = self.images[index]
51
- img.thumbnail((self.imsize, self.imsize), Image.Resampling.LANCZOS)
52
- print('after imresize:', img.size)
53
- return self.transform(img)
54
 
55
 
56
- def __len__(self):
57
- return len(self.images)
58
 
59
  # ---------------------------------------
60
 
@@ -132,7 +132,7 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50, sf_ids='
132
  print('im1:', im1.size)
133
  print('img1rsz:', img1rsz.shape)
134
  for j, att in enumerate(all_att_bin1):
135
- att = cv2.resize(att, im1.size, interpolation=cv2.INTER_NEAREST)
136
  # att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
137
  # att = cv2.resize(att, imgz[i].shape[:2][::-1])
138
  # att = att.resize(shape)
@@ -149,7 +149,7 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50, sf_ids='
149
  print('im2:', im2.size)
150
  print('img2rsz:', img2rsz.shape)
151
  for j, att in enumerate(all_att_bin2):
152
- att = cv2.resize(att, im2.size, interpolation=cv2.INTER_NEAREST)
153
  # att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
154
  # # att = cv2.resize(att, imgz[i].shape[:2][::-1])
155
  # att = att.resize(im2.shape)
 
37
  ])
38
  # ---------------------------------------
39
 
40
+ # class ImgDataset(data.Dataset):
41
+
42
+ # def __init__(self, images, imsize):
43
+ # self.images = images
44
+ # self.imsize = imsize
45
+ # self.transform = transforms.Compose([transforms.ToTensor(), \
46
+ # transforms.Normalize(**dict(zip(["mean", "std"], net.runtime['mean_std'])))])
47
 
48
 
49
+ # def __getitem__(self, index):
50
+ # img = self.images[index]
51
+ # img.thumbnail((self.imsize, self.imsize), Image.Resampling.LANCZOS)
52
+ # print('after imresize:', img.size)
53
+ # return self.transform(img)
54
 
55
 
56
+ # def __len__(self):
57
+ # return len(self.images)
58
 
59
  # ---------------------------------------
60
 
 
132
  print('im1:', im1.size)
133
  print('img1rsz:', img1rsz.shape)
134
  for j, att in enumerate(all_att_bin1):
135
+ att = cv2.resize(att, img1rsz.shape[:2], interpolation=cv2.INTER_NEAREST)
136
  # att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
137
  # att = cv2.resize(att, imgz[i].shape[:2][::-1])
138
  # att = att.resize(shape)
 
149
  print('im2:', im2.size)
150
  print('img2rsz:', img2rsz.shape)
151
  for j, att in enumerate(all_att_bin2):
152
+ att = cv2.resize(att, img2rsz.shape[:2], interpolation=cv2.INTER_NEAREST)
153
  # att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
154
  # # att = cv2.resize(att, imgz[i].shape[:2][::-1])
155
  # att = att.resize(im2.shape)