Spaces:
Build error
Build error
temp
Browse files
app.py
CHANGED
|
@@ -63,8 +63,8 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50):
|
|
| 63 |
print(strenghts1.shape, strenghts2.shape)
|
| 64 |
|
| 65 |
# Store all binary SF att maps to show them all at once in the end
|
| 66 |
-
all_att_bin1 =
|
| 67 |
-
all_att_bin2 =
|
| 68 |
for n, i in enumerate(sf_idx_):
|
| 69 |
# all_atts[n].append(attn[j][scale_id][0,i,:,:].numpy())
|
| 70 |
att_heat = np.array(attns1[0,i,:,:].numpy(), dtype=np.float32)
|
|
@@ -94,11 +94,13 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50):
|
|
| 94 |
fin_img.append(img1rsz)
|
| 95 |
|
| 96 |
img2rsz = np.copy(im2)
|
|
|
|
| 97 |
for j, att in enumerate(all_att_bin2):
|
| 98 |
# att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_NEAREST)
|
| 99 |
# att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
|
| 100 |
# att = cv2.resize(att, imgz[i].shape[:2][::-1])
|
| 101 |
att = att.resize(im2.size)
|
|
|
|
| 102 |
mask2d = zip(*np.where(att==255))
|
| 103 |
for m,n in mask2d:
|
| 104 |
col_ = col.colors[j] if j < 7 else col.colors[j+1]
|
|
|
|
| 63 |
print(strenghts1.shape, strenghts2.shape)
|
| 64 |
|
| 65 |
# Store all binary SF att maps to show them all at once in the end
|
| 66 |
+
all_att_bin1 = []
|
| 67 |
+
all_att_bin2 = []
|
| 68 |
for n, i in enumerate(sf_idx_):
|
| 69 |
# all_atts[n].append(attn[j][scale_id][0,i,:,:].numpy())
|
| 70 |
att_heat = np.array(attns1[0,i,:,:].numpy(), dtype=np.float32)
|
|
|
|
| 94 |
fin_img.append(img1rsz)
|
| 95 |
|
| 96 |
img2rsz = np.copy(im2)
|
| 97 |
+
print(img2rsz.size)
|
| 98 |
for j, att in enumerate(all_att_bin2):
|
| 99 |
# att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_NEAREST)
|
| 100 |
# att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
|
| 101 |
# att = cv2.resize(att, imgz[i].shape[:2][::-1])
|
| 102 |
att = att.resize(im2.size)
|
| 103 |
+
print('att:', att.size)
|
| 104 |
mask2d = zip(*np.where(att==255))
|
| 105 |
for m,n in mask2d:
|
| 106 |
col_ = col.colors[j] if j < 7 else col.colors[j+1]
|