lsxi77777 commited on
Commit
589716d
·
1 Parent(s): cd6b6ae

fix bug and add stop button

Browse files
Files changed (1) hide show
  1. ui/app_class.py +12 -6
ui/app_class.py CHANGED
@@ -161,6 +161,8 @@ class ImageMatchingApp:
161
  button_run = gr.Button(
162
  value="Run Match", variant="primary"
163
  )
 
 
164
 
165
  with gr.Accordion("Advanced Setting", open=False):
166
  with gr.Accordion("Image Setting", open=True):
@@ -207,7 +209,7 @@ class ImageMatchingApp:
207
  detect_keypoints_threshold = gr.Slider(
208
  minimum=0,
209
  maximum=1,
210
- step=0.001,
211
  label="Keypoint threshold",
212
  value=0.0005,
213
  )
@@ -251,7 +253,6 @@ class ImageMatchingApp:
251
  "ransac_confidence"
252
  ],
253
  )
254
- print(self.cfg["defaults"]["ransac_max_iter"])
255
  ransac_max_iter = gr.Slider(
256
  minimum=0.0,
257
  maximum=100000,
@@ -331,7 +332,7 @@ class ImageMatchingApp:
331
  with gr.Accordion(
332
  (
333
  "Open for More: Raw Matches"
334
- " (Green for good matches, Red for bad)"
335
  ),
336
  open=False,
337
  ):
@@ -342,7 +343,7 @@ class ImageMatchingApp:
342
  with gr.Accordion(
343
  (
344
  "Open for More: Ransac Matches"
345
- " (Green for good matches, Red for bad)"
346
  ),
347
  open=True,
348
  ):
@@ -402,9 +403,14 @@ class ImageMatchingApp:
402
  output_pred,
403
  ]
404
  # button callbacks
405
- button_run.click(
406
  fn=run_matching, inputs=inputs, outputs=outputs
407
  )
 
 
 
 
 
408
  # Reset images
409
  reset_outputs = [
410
  input_image0,
@@ -746,7 +752,7 @@ class AppSfmUI(AppBaseUI):
746
  # matcher setting
747
  self.inputs.matcher_key = gr.Dropdown(
748
  choices=self.matcher_zoo.keys(),
749
- value="superpoint-minima_lightglue",
750
  label="Matching Model",
751
  interactive=True,
752
  )
 
161
  button_run = gr.Button(
162
  value="Run Match", variant="primary"
163
  )
164
+ with gr.Row():
165
+ button_stop = gr.Button(value="Force Stop", variant="stop")
166
 
167
  with gr.Accordion("Advanced Setting", open=False):
168
  with gr.Accordion("Image Setting", open=True):
 
209
  detect_keypoints_threshold = gr.Slider(
210
  minimum=0,
211
  maximum=1,
212
+ step=0.0001,
213
  label="Keypoint threshold",
214
  value=0.0005,
215
  )
 
253
  "ransac_confidence"
254
  ],
255
  )
 
256
  ransac_max_iter = gr.Slider(
257
  minimum=0.0,
258
  maximum=100000,
 
332
  with gr.Accordion(
333
  (
334
  "Open for More: Raw Matches"
335
+ " (High confidence is represented by green)"
336
  ),
337
  open=False,
338
  ):
 
343
  with gr.Accordion(
344
  (
345
  "Open for More: Ransac Matches"
346
+ " (High confidence is represented by green)"
347
  ),
348
  open=True,
349
  ):
 
403
  output_pred,
404
  ]
405
  # button callbacks
406
+ click_event=button_run.click(
407
  fn=run_matching, inputs=inputs, outputs=outputs
408
  )
409
+ # stop button
410
+ button_stop.click(
411
+ fn=None, inputs=None, outputs=None, cancels=[click_event]
412
+ )
413
+
414
  # Reset images
415
  reset_outputs = [
416
  input_image0,
 
752
  # matcher setting
753
  self.inputs.matcher_key = gr.Dropdown(
754
  choices=self.matcher_zoo.keys(),
755
+ value="superpoint+minima(lightglue)",
756
  label="Matching Model",
757
  interactive=True,
758
  )