Spaces:
Running
Running
Commit
·
9c5fd14
1
Parent(s):
d259cfc
update: gim
Browse files- hloc/matchers/gim.py +0 -5
hloc/matchers/gim.py
CHANGED
@@ -72,21 +72,17 @@ class GIM(BaseModel):
|
|
72 |
# )
|
73 |
|
74 |
image0, image1 = data['image0'], data['image1']
|
75 |
-
print('1.', 'image0', image0.shape, 'image1', image1.shape)
|
76 |
orig_width0 = image0.shape[3]
|
77 |
orig_height0 = image0.shape[2]
|
78 |
orig_width1 = image1.shape[3]
|
79 |
orig_height1 = image1.shape[2]
|
80 |
aspect_ratio = 896 / 672
|
81 |
-
|
82 |
new_width0 = max(orig_width0, int(orig_height0 * aspect_ratio))
|
83 |
new_height0 = max(orig_height0, int(orig_width0 / aspect_ratio))
|
84 |
new_width1 = max(orig_width1, int(orig_height1 * aspect_ratio))
|
85 |
new_height1 = max(orig_height1, int(orig_width1 / aspect_ratio))
|
86 |
-
|
87 |
new_width = max(new_width0, new_width1)
|
88 |
new_height = max(new_height0, new_height1)
|
89 |
-
|
90 |
pad_height0 = new_height - orig_height0
|
91 |
pad_width0 = new_width - orig_width0
|
92 |
pad_height1 = new_height - orig_height1
|
@@ -101,7 +97,6 @@ class GIM(BaseModel):
|
|
101 |
pad_right1 = pad_width1 - pad_left1
|
102 |
image0 = torch.nn.functional.pad(image0, (pad_left0, pad_right0, pad_top0, pad_bottom0))
|
103 |
image1 = torch.nn.functional.pad(image1, (pad_left1, pad_right1, pad_top1, pad_bottom1))
|
104 |
-
print('2.', 'image0', image0.shape, 'image1', image1.shape)
|
105 |
dense_matches, dense_certainty = self.net.match(image0, image1)
|
106 |
sparse_matches, mconf = self.net.sample(dense_matches, dense_certainty, self.conf["max_keypoints"])
|
107 |
height0, width0 = image0.shape[-2:]
|
|
|
72 |
# )
|
73 |
|
74 |
image0, image1 = data['image0'], data['image1']
|
|
|
75 |
orig_width0 = image0.shape[3]
|
76 |
orig_height0 = image0.shape[2]
|
77 |
orig_width1 = image1.shape[3]
|
78 |
orig_height1 = image1.shape[2]
|
79 |
aspect_ratio = 896 / 672
|
|
|
80 |
new_width0 = max(orig_width0, int(orig_height0 * aspect_ratio))
|
81 |
new_height0 = max(orig_height0, int(orig_width0 / aspect_ratio))
|
82 |
new_width1 = max(orig_width1, int(orig_height1 * aspect_ratio))
|
83 |
new_height1 = max(orig_height1, int(orig_width1 / aspect_ratio))
|
|
|
84 |
new_width = max(new_width0, new_width1)
|
85 |
new_height = max(new_height0, new_height1)
|
|
|
86 |
pad_height0 = new_height - orig_height0
|
87 |
pad_width0 = new_width - orig_width0
|
88 |
pad_height1 = new_height - orig_height1
|
|
|
97 |
pad_right1 = pad_width1 - pad_left1
|
98 |
image0 = torch.nn.functional.pad(image0, (pad_left0, pad_right0, pad_top0, pad_bottom0))
|
99 |
image1 = torch.nn.functional.pad(image1, (pad_left1, pad_right1, pad_top1, pad_bottom1))
|
|
|
100 |
dense_matches, dense_certainty = self.net.match(image0, image1)
|
101 |
sparse_matches, mconf = self.net.sample(dense_matches, dense_certainty, self.conf["max_keypoints"])
|
102 |
height0, width0 = image0.shape[-2:]
|