YannisK commited on
Commit
b2bf1e7
1 Parent(s): cb3d625
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -88,6 +88,11 @@ def match(query_feat, pos_feat, LoweRatioTh=0.9):
88
 
89
 
90
  # sf_idx_ = [55, 14, 5, 4, 52, 57, 40, 9]
 
 
 
 
 
91
 
92
  col = plt.get_cmap('tab10')
93
 
@@ -95,6 +100,8 @@ def generate_matching_superfeatures(im1, im2, Imagenet_model=False, scale_id=6,
95
  print('im1:', im1.size)
96
  print('im2:', im2.size)
97
 
 
 
98
  net = net_sfm
99
  if Imagenet_model:
100
  net = net_imagenet
@@ -156,8 +163,6 @@ def generate_matching_superfeatures(im1, im2, Imagenet_model=False, scale_id=6,
156
  else:
157
  sf_idx_ = [i for i in sf_idx_ if i in list(ind_match)]
158
 
159
-
160
-
161
  # Store all binary SF att maps to show them all at once in the end
162
  all_att_bin1 = []
163
  all_att_bin2 = []
@@ -245,7 +250,6 @@ def generate_matching_superfeatures(im1, im2, Imagenet_model=False, scale_id=6,
245
 
246
  f = lambda m,c: plt.plot([],[],marker=m, color=c, ls="none")[0]
247
  handles = [f("s", col.colors[i]) for i in range(n_sf_ids)]
248
- labels = sf_idx_
249
  fig_leg = plt.figure(3)
250
  legend = plt.legend(handles, sf_idx_, framealpha=1, frameon=False, facecolor='w',fontsize=15, loc="center")
251
  # fig_leg = legend.figure
 
88
 
89
 
90
  # sf_idx_ = [55, 14, 5, 4, 52, 57, 40, 9]
91
+ def clear_figures():
92
+ plt.figure().clear()
93
+ plt.close()
94
+ plt.cla()
95
+ plt.clf()
96
 
97
  col = plt.get_cmap('tab10')
98
 
 
100
  print('im1:', im1.size)
101
  print('im2:', im2.size)
102
 
103
+ clear_figures()
104
+
105
  net = net_sfm
106
  if Imagenet_model:
107
  net = net_imagenet
 
163
  else:
164
  sf_idx_ = [i for i in sf_idx_ if i in list(ind_match)]
165
 
 
 
166
  # Store all binary SF att maps to show them all at once in the end
167
  all_att_bin1 = []
168
  all_att_bin2 = []
 
250
 
251
  f = lambda m,c: plt.plot([],[],marker=m, color=c, ls="none")[0]
252
  handles = [f("s", col.colors[i]) for i in range(n_sf_ids)]
 
253
  fig_leg = plt.figure(3)
254
  legend = plt.legend(handles, sf_idx_, framealpha=1, frameon=False, facecolor='w',fontsize=15, loc="center")
255
  # fig_leg = legend.figure