Spaces:
Running
on
Zero
Running
on
Zero
Update ui/app_class.py
Browse files- ui/app_class.py +16 -10
ui/app_class.py
CHANGED
|
@@ -28,20 +28,24 @@ DESCRIPTION = """
|
|
| 28 |
MINIMA: Modality Invariant Image Matching
|
| 29 |
</h1>
|
| 30 |
</div>
|
|
|
|
| 31 |
<div style="display: flex; justify-content: center; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px;">
|
| 32 |
<div>
|
| 33 |
<a href="https://github.com/LSXI7/MINIMA"><img src="https://img.shields.io/badge/Source_Code-black?logo=Github" alt="Github Source Code"></a>
|
| 34 |
</div>
|
| 35 |
<div>
|
| 36 |
-
<a href="https://
|
| 37 |
</div>
|
| 38 |
</div>
|
|
|
|
| 39 |
<p style="text-align: center; font-size: 16px; color: #666;">
|
| 40 |
This Space is derived from <a href="https://github.com/Vincentqyw/image-matching-webui" style="color: #007BFF;">Image Matching WebUI</a>.
|
| 41 |
</p>
|
|
|
|
| 42 |
<p style="text-align: center; font-size: 16px; color: #666;">
|
| 43 |
We are grateful to the authors for their contribution of the source code.
|
| 44 |
</p>
|
|
|
|
| 45 |
<p style="text-align: center; font-size: 16px; color: #666;">
|
| 46 |
Here we provide our MINIMA-model in our paper for test and comparison, and this project is undergoing continuous enhancement.
|
| 47 |
</p>
|
|
@@ -56,9 +60,9 @@ body {
|
|
| 56 |
padding: 0;
|
| 57 |
}
|
| 58 |
#logo-img {
|
| 59 |
-
width:
|
| 60 |
height: auto;
|
| 61 |
-
margin:
|
| 62 |
display: block;
|
| 63 |
}
|
| 64 |
h1 {
|
|
@@ -80,7 +84,6 @@ a:hover {
|
|
| 80 |
"""
|
| 81 |
|
| 82 |
|
| 83 |
-
|
| 84 |
class ImageMatchingApp:
|
| 85 |
def __init__(self, server_name="0.0.0.0", server_port=7860, **kwargs):
|
| 86 |
self.server_name = server_name
|
|
@@ -105,7 +108,7 @@ class ImageMatchingApp:
|
|
| 105 |
with gr.Blocks(css=CSS) as self.app:
|
| 106 |
with gr.Tab("Image Matching"):
|
| 107 |
with gr.Row():
|
| 108 |
-
with gr.Column(scale=1
|
| 109 |
gr.Image(
|
| 110 |
str(
|
| 111 |
Path(__file__).parent.parent
|
|
@@ -116,14 +119,14 @@ class ImageMatchingApp:
|
|
| 116 |
show_share_button=False,
|
| 117 |
show_download_button=False,
|
| 118 |
)
|
| 119 |
-
with gr.Column(scale=
|
| 120 |
gr.HTML(DESCRIPTION)
|
| 121 |
with gr.Row(equal_height=False):
|
| 122 |
with gr.Column():
|
| 123 |
with gr.Row():
|
| 124 |
matcher_list = gr.Dropdown(
|
| 125 |
choices=self.init_matcher_dropdown(),
|
| 126 |
-
value="superpoint
|
| 127 |
label="Matching Model",
|
| 128 |
interactive=True,
|
| 129 |
)
|
|
@@ -196,7 +199,7 @@ class ImageMatchingApp:
|
|
| 196 |
maximum=10000,
|
| 197 |
step=10,
|
| 198 |
label="Max features",
|
| 199 |
-
value=
|
| 200 |
)
|
| 201 |
# TODO: add line settings
|
| 202 |
with gr.Row():
|
|
@@ -490,8 +493,10 @@ class ImageMatchingApp:
|
|
| 490 |
def ui_change_imagebox(self, choice):
|
| 491 |
"""
|
| 492 |
Updates the image box with the given choice.
|
|
|
|
| 493 |
Args:
|
| 494 |
choice (list): The list of image sources to be displayed in the image box.
|
|
|
|
| 495 |
Returns:
|
| 496 |
dict: A dictionary containing the updated value, sources, and type for the image box.
|
| 497 |
"""
|
|
@@ -541,6 +546,7 @@ class ImageMatchingApp:
|
|
| 541 |
]:
|
| 542 |
"""
|
| 543 |
Reset the state of the UI.
|
|
|
|
| 544 |
Returns:
|
| 545 |
tuple: A tuple containing the initial values for the UI state.
|
| 546 |
"""
|
|
@@ -766,7 +772,7 @@ class AppSfmUI(AppBaseUI):
|
|
| 766 |
label="Match Threshold",
|
| 767 |
minimum=0.01,
|
| 768 |
maximum=12.0,
|
| 769 |
-
value=0
|
| 770 |
)
|
| 771 |
self.inputs.ransac_threshold = gr.Slider(
|
| 772 |
label="Ransac Threshold",
|
|
@@ -782,7 +788,7 @@ class AppSfmUI(AppBaseUI):
|
|
| 782 |
label="Ransac Confidence",
|
| 783 |
minimum=0.01,
|
| 784 |
maximum=1.0,
|
| 785 |
-
value=0.
|
| 786 |
step=0.0001,
|
| 787 |
interactive=True,
|
| 788 |
)
|
|
|
|
| 28 |
MINIMA: Modality Invariant Image Matching
|
| 29 |
</h1>
|
| 30 |
</div>
|
| 31 |
+
|
| 32 |
<div style="display: flex; justify-content: center; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px;">
|
| 33 |
<div>
|
| 34 |
<a href="https://github.com/LSXI7/MINIMA"><img src="https://img.shields.io/badge/Source_Code-black?logo=Github" alt="Github Source Code"></a>
|
| 35 |
</div>
|
| 36 |
<div>
|
| 37 |
+
<a href="https://arxiv.org/abs/0.0"><img src="https://img.shields.io/badge/arXiv-PDF-b31b1b" alt="arXiv"></a>
|
| 38 |
</div>
|
| 39 |
</div>
|
| 40 |
+
|
| 41 |
<p style="text-align: center; font-size: 16px; color: #666;">
|
| 42 |
This Space is derived from <a href="https://github.com/Vincentqyw/image-matching-webui" style="color: #007BFF;">Image Matching WebUI</a>.
|
| 43 |
</p>
|
| 44 |
+
|
| 45 |
<p style="text-align: center; font-size: 16px; color: #666;">
|
| 46 |
We are grateful to the authors for their contribution of the source code.
|
| 47 |
</p>
|
| 48 |
+
|
| 49 |
<p style="text-align: center; font-size: 16px; color: #666;">
|
| 50 |
Here we provide our MINIMA-model in our paper for test and comparison, and this project is undergoing continuous enhancement.
|
| 51 |
</p>
|
|
|
|
| 60 |
padding: 0;
|
| 61 |
}
|
| 62 |
#logo-img {
|
| 63 |
+
width: 100px;
|
| 64 |
height: auto;
|
| 65 |
+
margin: 20px auto;
|
| 66 |
display: block;
|
| 67 |
}
|
| 68 |
h1 {
|
|
|
|
| 84 |
"""
|
| 85 |
|
| 86 |
|
|
|
|
| 87 |
class ImageMatchingApp:
|
| 88 |
def __init__(self, server_name="0.0.0.0", server_port=7860, **kwargs):
|
| 89 |
self.server_name = server_name
|
|
|
|
| 108 |
with gr.Blocks(css=CSS) as self.app:
|
| 109 |
with gr.Tab("Image Matching"):
|
| 110 |
with gr.Row():
|
| 111 |
+
with gr.Column(scale=1):
|
| 112 |
gr.Image(
|
| 113 |
str(
|
| 114 |
Path(__file__).parent.parent
|
|
|
|
| 119 |
show_share_button=False,
|
| 120 |
show_download_button=False,
|
| 121 |
)
|
| 122 |
+
with gr.Column(scale=3):
|
| 123 |
gr.HTML(DESCRIPTION)
|
| 124 |
with gr.Row(equal_height=False):
|
| 125 |
with gr.Column():
|
| 126 |
with gr.Row():
|
| 127 |
matcher_list = gr.Dropdown(
|
| 128 |
choices=self.init_matcher_dropdown(),
|
| 129 |
+
value="superpoint-minima_lightglue",
|
| 130 |
label="Matching Model",
|
| 131 |
interactive=True,
|
| 132 |
)
|
|
|
|
| 199 |
maximum=10000,
|
| 200 |
step=10,
|
| 201 |
label="Max features",
|
| 202 |
+
value=2048,
|
| 203 |
)
|
| 204 |
# TODO: add line settings
|
| 205 |
with gr.Row():
|
|
|
|
| 493 |
def ui_change_imagebox(self, choice):
|
| 494 |
"""
|
| 495 |
Updates the image box with the given choice.
|
| 496 |
+
|
| 497 |
Args:
|
| 498 |
choice (list): The list of image sources to be displayed in the image box.
|
| 499 |
+
|
| 500 |
Returns:
|
| 501 |
dict: A dictionary containing the updated value, sources, and type for the image box.
|
| 502 |
"""
|
|
|
|
| 546 |
]:
|
| 547 |
"""
|
| 548 |
Reset the state of the UI.
|
| 549 |
+
|
| 550 |
Returns:
|
| 551 |
tuple: A tuple containing the initial values for the UI state.
|
| 552 |
"""
|
|
|
|
| 772 |
label="Match Threshold",
|
| 773 |
minimum=0.01,
|
| 774 |
maximum=12.0,
|
| 775 |
+
value=0.1,
|
| 776 |
)
|
| 777 |
self.inputs.ransac_threshold = gr.Slider(
|
| 778 |
label="Ransac Threshold",
|
|
|
|
| 788 |
label="Ransac Confidence",
|
| 789 |
minimum=0.01,
|
| 790 |
maximum=1.0,
|
| 791 |
+
value=0.999,
|
| 792 |
step=0.0001,
|
| 793 |
interactive=True,
|
| 794 |
)
|