Spaces:
Sleeping
Sleeping
Create app
Browse filesadding file
app
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import plotly.graph_objects as go
|
3 |
+
import numpy as np
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
|
7 |
+
def create_sota_plot():
|
8 |
+
# State-of-the-art models data
|
9 |
+
sota_models = {
|
10 |
+
'SIFT + FVs': (2012, 53),
|
11 |
+
'AlexNet': (2012.5, 65),
|
12 |
+
'SPPNet': (2014.5, 74),
|
13 |
+
'Inception V3': (2015.5, 81),
|
14 |
+
'NASNET-A(6)': (2017, 82.7),
|
15 |
+
'CoAtNet-7': (2021.5, 90.88),
|
16 |
+
'': (2022, 87.79), # Last point
|
17 |
+
'': (2022.2, 87.73) # Final value shown
|
18 |
+
}
|
19 |
+
|
20 |
+
# Extract data for SOTA models
|
21 |
+
sota_years = [year for year, _ in sota_models.values() if year != '']
|
22 |
+
sota_accuracy = [acc for _, acc in sota_models.values() if acc != '']
|
23 |
+
sota_labels = [name for name in sota_models.keys() if name != '']
|
24 |
+
|
25 |
+
# Generate synthetic "other models" data (gray points)
|
26 |
+
np.random.seed(42)
|
27 |
+
n_other = 300
|
28 |
+
other_years = np.random.uniform(2010, 2023, n_other)
|
29 |
+
# Create a distribution that's mostly below SOTA but with some variance
|
30 |
+
other_accuracy = []
|
31 |
+
for year in other_years:
|
32 |
+
# Find approximate SOTA accuracy for this year
|
33 |
+
sota_at_year = np.interp(year, sota_years[:len(sota_accuracy)], sota_accuracy[:len(sota_accuracy)])
|
34 |
+
# Add models mostly below SOTA with some variance
|
35 |
+
if year < 2012:
|
36 |
+
acc = np.random.normal(45, 8)
|
37 |
+
else:
|
38 |
+
acc = np.random.normal(sota_at_year - 10, 5)
|
39 |
+
# Some models can be close to SOTA
|
40 |
+
if np.random.random() < 0.1:
|
41 |
+
acc = sota_at_year - np.random.uniform(0, 3)
|
42 |
+
other_accuracy.append(max(30, min(92, acc))) # Clip to reasonable range
|
43 |
+
|
44 |
+
# Create the plot
|
45 |
+
fig = go.Figure()
|
46 |
+
|
47 |
+
# Add other models (gray scatter points)
|
48 |
+
fig.add_trace(go.Scatter(
|
49 |
+
x=other_years,
|
50 |
+
y=other_accuracy,
|
51 |
+
mode='markers',
|
52 |
+
name='Other models',
|
53 |
+
marker=dict(
|
54 |
+
color='lightgray',
|
55 |
+
size=6,
|
56 |
+
opacity=0.5
|
57 |
+
),
|
58 |
+
hovertemplate='Year: %{x:.1f}<br>Accuracy: %{y:.1f}%<extra></extra>'
|
59 |
+
))
|
60 |
+
|
61 |
+
# Add SOTA models line
|
62 |
+
fig.add_trace(go.Scatter(
|
63 |
+
x=sota_years[:len(sota_accuracy)],
|
64 |
+
y=sota_accuracy,
|
65 |
+
mode='lines+markers',
|
66 |
+
name='State-of-the-art models',
|
67 |
+
line=dict(color='#00CED1', width=3),
|
68 |
+
marker=dict(size=10, color='#00CED1'),
|
69 |
+
hovertemplate='%{text}<br>Year: %{x:.1f}<br>Accuracy: %{y:.1f}%<extra></extra>',
|
70 |
+
text=sota_labels[:len(sota_accuracy)]
|
71 |
+
))
|
72 |
+
|
73 |
+
# Add labels for SOTA models
|
74 |
+
for i, (name, (year, acc)) in enumerate(sota_models.items()):
|
75 |
+
if name and i < len(sota_accuracy): # Only label points with names
|
76 |
+
fig.add_annotation(
|
77 |
+
x=year,
|
78 |
+
y=acc,
|
79 |
+
text=name,
|
80 |
+
showarrow=False,
|
81 |
+
yshift=15,
|
82 |
+
font=dict(size=12)
|
83 |
+
)
|
84 |
+
|
85 |
+
# Add the final accuracy values
|
86 |
+
fig.add_annotation(
|
87 |
+
x=2022,
|
88 |
+
y=87.79,
|
89 |
+
text="87.79",
|
90 |
+
showarrow=False,
|
91 |
+
xshift=30,
|
92 |
+
font=dict(size=12, weight='bold')
|
93 |
+
)
|
94 |
+
|
95 |
+
fig.add_annotation(
|
96 |
+
x=2022.2,
|
97 |
+
y=87.73,
|
98 |
+
text="87.73",
|
99 |
+
showarrow=False,
|
100 |
+
xshift=30,
|
101 |
+
yshift=-10,
|
102 |
+
font=dict(size=12)
|
103 |
+
)
|
104 |
+
|
105 |
+
# Update layout
|
106 |
+
fig.update_layout(
|
107 |
+
title='Evolution of Model Performance on ImageNet',
|
108 |
+
xaxis_title='Year',
|
109 |
+
yaxis_title='TOP-1 ACCURACY',
|
110 |
+
xaxis=dict(
|
111 |
+
range=[2010, 2023],
|
112 |
+
tickmode='linear',
|
113 |
+
tick0=2012,
|
114 |
+
dtick=2,
|
115 |
+
showgrid=True,
|
116 |
+
gridcolor='lightgray'
|
117 |
+
),
|
118 |
+
yaxis=dict(
|
119 |
+
range=[35, 100],
|
120 |
+
tickmode='linear',
|
121 |
+
tick0=40,
|
122 |
+
dtick=10,
|
123 |
+
showgrid=True,
|
124 |
+
gridcolor='lightgray'
|
125 |
+
),
|
126 |
+
plot_bgcolor='white',
|
127 |
+
paper_bgcolor='white',
|
128 |
+
height=500,
|
129 |
+
legend=dict(
|
130 |
+
yanchor="bottom",
|
131 |
+
y=0.01,
|
132 |
+
xanchor="center",
|
133 |
+
x=0.5,
|
134 |
+
orientation="h"
|
135 |
+
)
|
136 |
+
)
|
137 |
+
|
138 |
+
return fig
|
139 |
+
|
140 |
+
|
141 |
+
# Create Gradio interface
|
142 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
143 |
+
gr.Markdown("# State-of-the-Art Models Timeline")
|
144 |
+
gr.Markdown(
|
145 |
+
"This visualization shows the evolution of state-of-the-art models' performance over time, similar to the ImageNet benchmark progression.")
|
146 |
+
|
147 |
+
plot = gr.Plot(label="Model Performance Evolution")
|
148 |
+
|
149 |
+
# Create plot on load
|
150 |
+
demo.load(fn=create_sota_plot, outputs=plot)
|
151 |
+
|
152 |
+
# Add interactive controls
|
153 |
+
with gr.Row():
|
154 |
+
refresh_btn = gr.Button("Refresh Plot")
|
155 |
+
|
156 |
+
refresh_btn.click(fn=create_sota_plot, outputs=plot)
|
157 |
+
|
158 |
+
gr.Markdown("""
|
159 |
+
### About this visualization:
|
160 |
+
- **Cyan line**: State-of-the-art models showing the progression of best performance
|
161 |
+
- **Gray dots**: Other models representing the broader research landscape
|
162 |
+
- The plot shows how breakthrough models like AlexNet, Inception, and NASNET pushed the boundaries
|
163 |
+
- Notice the rapid improvement from 2012-2018, followed by more incremental gains
|
164 |
+
""")
|
165 |
+
|
166 |
+
if __name__ == "__main__":
|
167 |
+
demo.launch()
|