gremlin97 commited on
Commit
560a8bd
Β·
0 Parent(s):

Initial Commit

Browse files
Files changed (3) hide show
  1. README.md +61 -0
  2. app.py +221 -0
  3. requirements.txt +2 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Mars Vision Leaderboard
3
+ emoji: πŸš€
4
+ colorFrom: red
5
+ colorTo: orange
6
+ sdk: gradio
7
+ sdk_version: 4.0.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # Mars Vision Leaderboard πŸš€
13
+
14
+ A modern leaderboard for comparing state-of-the-art computer vision models across different tasks: Classification, Segmentation, and Object Detection.
15
+
16
+ ## Features
17
+
18
+ - **Three Task Categories**: Classification, Segmentation, and Object Detection
19
+ - **Interactive Filters**:
20
+ - Dataset selection with checkboxes
21
+ - Metrics selection with checkboxes
22
+ - Model type/organization filtering
23
+ - **Real-time Updates**: Table updates dynamically based on selected filters
24
+ - **Clean UI**: Modern design inspired by leading HuggingFace leaderboards
25
+
26
+ ## How to Use
27
+
28
+ 1. Select a tab for the task you're interested in (Classification, Segmentation, or Object Detection)
29
+ 2. Use the filter boxes to select:
30
+ - Which datasets to display
31
+ - Which metrics to show
32
+ - Which model types/organizations to include
33
+ 3. The leaderboard table updates automatically based on your selections
34
+
35
+ ## Local Development
36
+
37
+ ```bash
38
+ # Install dependencies
39
+ pip install -r requirements.txt
40
+
41
+ # Run the app
42
+ python app.py
43
+ ```
44
+
45
+ ## Customization
46
+
47
+ To add your own data, modify the data dictionaries in `app.py`:
48
+ - `CLASSIFICATION_DATA`
49
+ - `SEGMENTATION_DATA`
50
+ - `DETECTION_DATA`
51
+
52
+ Each entry should have:
53
+ - `model`: Model name
54
+ - `organization`: Organization/creator
55
+ - `dataset`: Dataset name
56
+ - `metric`: Metric name
57
+ - `value`: Numeric value
58
+
59
+ ## License
60
+
61
+ MIT
app.py ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+
4
+ CLASSIFICATION_DATA = {
5
+ "Model": [
6
+ "ResNet-50", "ViT-Base", "Swin-T", "InceptionV3", "SqueezeNet",
7
+ "ResNet-50", "ViT-Base", "Swin-T", "InceptionV3", "SqueezeNet",
8
+ "ResNet-50", "ViT-Base", "Swin-T", "InceptionV3", "SqueezeNet",
9
+ ],
10
+ "Dataset": [
11
+ "DoMars16", "DoMars16", "DoMars16", "DoMars16", "DoMars16",
12
+ "Atmospheric Dust", "Atmospheric Dust", "Atmospheric Dust", "Atmospheric Dust", "Atmospheric Dust",
13
+ "Martian Frost", "Martian Frost", "Martian Frost", "Martian Frost", "Martian Frost",
14
+ ],
15
+ "Accuracy": [
16
+ 92.5, 94.2, 95.8, 93.1, 89.7,
17
+ 88.3, 90.1, 91.5, 89.8, 87.2,
18
+ 85.6, 87.9, 88.4, 86.7, 84.3,
19
+ ],
20
+ "F1-Score": [
21
+ 91.8, 93.5, 94.9, 92.4, 88.6,
22
+ 87.5, 89.2, 90.7, 88.9, 86.3,
23
+ 84.8, 86.9, 87.5, 85.8, 83.4,
24
+ ],
25
+ }
26
+
27
+ DETECTION_DATA = {
28
+ "Model": [
29
+ "Faster R-CNN", "YOLOv5", "DETR", "RetinaNet", "SSD",
30
+ "Faster R-CNN", "YOLOv5", "DETR", "RetinaNet", "SSD",
31
+ "Faster R-CNN", "YOLOv5", "DETR", "RetinaNet", "SSD",
32
+ ],
33
+ "Dataset": [
34
+ "Mars Crater", "Mars Crater", "Mars Crater", "Mars Crater", "Mars Crater",
35
+ "Rover Component", "Rover Component", "Rover Component", "Rover Component", "Rover Component",
36
+ "Geological Feature", "Geological Feature", "Geological Feature", "Geological Feature", "Geological Feature",
37
+ ],
38
+ "mAP": [
39
+ 78.5, 80.2, 82.1, 79.3, 77.8,
40
+ 75.6, 77.3, 78.9, 76.7, 75.1,
41
+ 73.4, 75.1, 76.7, 74.5, 73.0,
42
+ ],
43
+ "IoU": [
44
+ 0.72, 0.74, 0.76, 0.73, 0.71,
45
+ 0.69, 0.71, 0.73, 0.70, 0.68,
46
+ 0.67, 0.69, 0.71, 0.68, 0.67,
47
+ ],
48
+ }
49
+
50
+ SEGMENTATION_DATA = {
51
+ "Model": [
52
+ "U-Net", "DeepLabV3+", "Mask R-CNN", "SegFormer", "HRNet",
53
+ "U-Net", "DeepLabV3+", "Mask R-CNN", "SegFormer", "HRNet",
54
+ "U-Net", "DeepLabV3+", "Mask R-CNN", "SegFormer", "HRNet",
55
+ ],
56
+ "Dataset": [
57
+ "Mars Terrain", "Mars Terrain", "Mars Terrain", "Mars Terrain", "Mars Terrain",
58
+ "Dust Storm", "Dust Storm", "Dust Storm", "Dust Storm", "Dust Storm",
59
+ "Geological Feature", "Geological Feature", "Geological Feature", "Geological Feature", "Geological Feature",
60
+ ],
61
+ "Dice Score": [
62
+ 0.85, 0.87, 0.88, 0.86, 0.84,
63
+ 0.82, 0.84, 0.85, 0.83, 0.82,
64
+ 0.81, 0.83, 0.84, 0.82, 0.81,
65
+ ],
66
+ "IoU": [
67
+ 0.74, 0.76, 0.78, 0.75, 0.73,
68
+ 0.70, 0.72, 0.74, 0.71, 0.70,
69
+ 0.68, 0.70, 0.72, 0.69, 0.68,
70
+ ],
71
+ }
72
+
73
+
74
+ def filter_and_search(df, search, datasets, models, columns):
75
+ filtered = df.copy()
76
+
77
+ if search:
78
+ mask = filtered.apply(lambda row: row.astype(str).str.contains(search, case=False).any(), axis=1)
79
+ filtered = filtered[mask]
80
+
81
+ if datasets:
82
+ filtered = filtered[filtered["Dataset"].isin(datasets)]
83
+ if models:
84
+ filtered = filtered[filtered["Model"].isin(models)]
85
+
86
+ if columns:
87
+ display_cols = [col for col in columns if col in filtered.columns]
88
+ filtered = filtered[display_cols]
89
+
90
+ return filtered
91
+
92
+
93
+ def build_tab(data, name):
94
+ df = pd.DataFrame(data)
95
+ datasets = sorted(df["Dataset"].unique().tolist())
96
+ models = sorted(df["Model"].unique().tolist())
97
+ metric_cols = [col for col in df.columns if col not in ["Model", "Dataset"]]
98
+ all_cols = ["Model", "Dataset"] + metric_cols
99
+
100
+ with gr.TabItem(name, elem_id="llm-benchmark-tab-table"):
101
+ with gr.Row():
102
+ with gr.Column(scale=4):
103
+ search_bar = gr.Textbox(
104
+ label="Search",
105
+ placeholder="Separate multiple queries with ';'",
106
+ elem_id="search-bar"
107
+ )
108
+
109
+ col_selector = gr.CheckboxGroup(
110
+ choices=all_cols,
111
+ value=all_cols,
112
+ label="Select Columns to Display:",
113
+ elem_classes="column-select"
114
+ )
115
+
116
+ table = gr.Dataframe(
117
+ value=df,
118
+ wrap=True,
119
+ interactive=False,
120
+ elem_id="leaderboard-table"
121
+ )
122
+
123
+ with gr.Column(scale=1):
124
+ gr.Markdown("**Model types**")
125
+ model_filter = gr.CheckboxGroup(
126
+ choices=models,
127
+ value=models,
128
+ label="",
129
+ elem_classes="filter-group"
130
+ )
131
+
132
+ gr.Markdown("**Datasets**")
133
+ dataset_filter = gr.CheckboxGroup(
134
+ choices=datasets,
135
+ value=datasets,
136
+ label="",
137
+ elem_classes="filter-group"
138
+ )
139
+
140
+ def update(search, ds, md, cols):
141
+ return filter_and_search(df, search, ds, md, cols)
142
+
143
+ search_bar.change(update, [search_bar, dataset_filter, model_filter, col_selector], table)
144
+ dataset_filter.change(update, [search_bar, dataset_filter, model_filter, col_selector], table)
145
+ model_filter.change(update, [search_bar, dataset_filter, model_filter, col_selector], table)
146
+ col_selector.change(update, [search_bar, dataset_filter, model_filter, col_selector], table)
147
+
148
+
149
+ custom_css = """
150
+ .markdown-text {
151
+ font-size: 16px !important;
152
+ }
153
+
154
+ #leaderboard-table {
155
+ margin-top: 15px;
156
+ }
157
+
158
+ #search-bar-table-box > div:first-child {
159
+ background: none;
160
+ border: none;
161
+ }
162
+
163
+ #search-bar {
164
+ padding: 0px;
165
+ }
166
+
167
+ table td:first-child,
168
+ table th:first-child {
169
+ max-width: 400px;
170
+ overflow: auto;
171
+ white-space: nowrap;
172
+ }
173
+
174
+ .tab-buttons button {
175
+ font-size: 20px;
176
+ }
177
+
178
+ .filter-group {
179
+ margin-bottom: 1em;
180
+ }
181
+
182
+ .filter-group label {
183
+ font-size: 14px;
184
+ }
185
+
186
+ .column-select {
187
+ margin-bottom: 1.5em;
188
+ }
189
+
190
+ .column-select label {
191
+ display: flex;
192
+ flex-wrap: wrap;
193
+ gap: 0.5em;
194
+ }
195
+
196
+ /* Styling for the column select checkboxes to display in rows */
197
+ .column-select label > span {
198
+ display: inline-flex;
199
+ align-items: center;
200
+ }
201
+ """
202
+
203
+ TITLE = """<h1 align="center" id="space-title">Mars Vision Leaderboard</h1>"""
204
+
205
+ INTRO = """
206
+ A comprehensive benchmark for evaluating computer vision models on Mars-specific datasets.
207
+ This leaderboard tracks model performance across three key tasks: classification, segmentation, and object detection.
208
+ """
209
+
210
+ demo = gr.Blocks(css=custom_css, title="Mars Vision Leaderboard")
211
+ with demo:
212
+ gr.HTML(TITLE)
213
+ gr.Markdown(INTRO, elem_classes="markdown-text")
214
+
215
+ with gr.Tabs(elem_classes="tab-buttons"):
216
+ build_tab(CLASSIFICATION_DATA, "πŸ… Classification")
217
+ build_tab(SEGMENTATION_DATA, "πŸ… Segmentation")
218
+ build_tab(DETECTION_DATA, "πŸ… Object Detection")
219
+
220
+ if __name__ == "__main__":
221
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio>=4.0.0
2
+ pandas>=2.0.0