Spaces:
Build error
Build error
edits
Browse files
app.py
CHANGED
@@ -91,7 +91,7 @@ def match(query_feat, pos_feat, LoweRatioTh=0.9):
|
|
91 |
|
92 |
col = plt.get_cmap('tab10')
|
93 |
|
94 |
-
def generate_matching_superfeatures(im1, im2, model_fn, scale_id=6, threshold=50, sf_ids='', only_matching=True):
|
95 |
print('im1:', im1.size)
|
96 |
print('im2:', im2.size)
|
97 |
|
@@ -142,13 +142,10 @@ def generate_matching_superfeatures(im1, im2, model_fn, scale_id=6, threshold=50
|
|
142 |
|
143 |
# which sf
|
144 |
sf_idx_ = [55, 14, 5, 4, 52, 57, 40, 9]
|
145 |
-
|
146 |
-
|
147 |
-
if sf_ids.lower().startswith('r'):
|
148 |
-
random_mode = True
|
149 |
-
n_sf_ids = int(sf_ids[1:])
|
150 |
sf_idx_ = np.random.randint(256, size=n_sf_ids)
|
151 |
-
|
152 |
sf_idx_ = map(int, sf_ids.strip().split(','))
|
153 |
|
154 |
if only_matching:
|
@@ -267,8 +264,9 @@ iface = gr.Interface(
|
|
267 |
gr.inputs.Radio(["ImageNet", "SfM-120k (landmarks)"], label="Model", optional=False),
|
268 |
gr.inputs.Slider(minimum=0, maximum=6, step=1, default=2, label="Scale"),
|
269 |
gr.inputs.Slider(minimum=0, maximum=255, step=25, default=150, label="Binarization Threshold"),
|
|
|
270 |
gr.inputs.Textbox(lines=1, default="", label="SF IDs to show (comma separated numbers from 0-255; typing 'rX' will return X random SFs", optional=True),
|
271 |
-
gr.inputs.Checkbox(default=True, label="Show only matching SFs"
|
272 |
],
|
273 |
outputs=[
|
274 |
gr.outputs.Image(type="plot", label="First Image SFs"),
|
|
|
91 |
|
92 |
col = plt.get_cmap('tab10')
|
93 |
|
94 |
+
def generate_matching_superfeatures(im1, im2, model_fn, scale_id=6, threshold=50, random_mode=False, sf_ids='', only_matching=True):
|
95 |
print('im1:', im1.size)
|
96 |
print('im2:', im2.size)
|
97 |
|
|
|
142 |
|
143 |
# which sf
|
144 |
sf_idx_ = [55, 14, 5, 4, 52, 57, 40, 9]
|
145 |
+
n_sf_ids = 8
|
146 |
+
if random_mode or sf_ids == '':
|
|
|
|
|
|
|
147 |
sf_idx_ = np.random.randint(256, size=n_sf_ids)
|
148 |
+
else:
|
149 |
sf_idx_ = map(int, sf_ids.strip().split(','))
|
150 |
|
151 |
if only_matching:
|
|
|
264 |
gr.inputs.Radio(["ImageNet", "SfM-120k (landmarks)"], label="Model", optional=False),
|
265 |
gr.inputs.Slider(minimum=0, maximum=6, step=1, default=2, label="Scale"),
|
266 |
gr.inputs.Slider(minimum=0, maximum=255, step=25, default=150, label="Binarization Threshold"),
|
267 |
+
gr.inputs.Checkbox(default=False, label="Show random matching SFs"),
|
268 |
gr.inputs.Textbox(lines=1, default="", label="SF IDs to show (comma separated numbers from 0-255; typing 'rX' will return X random SFs", optional=True),
|
269 |
+
gr.inputs.Checkbox(default=True, label="Show only matching SFs"),
|
270 |
],
|
271 |
outputs=[
|
272 |
gr.outputs.Image(type="plot", label="First Image SFs"),
|