Update app.py
Browse files
app.py
CHANGED
|
@@ -116,5 +116,97 @@ else:
|
|
| 116 |
fig_flops = px.scatter(detr_data, x='FLOPS', y='mAP', hover_name='Model', title='DETR: FLOPS vs mAP')
|
| 117 |
fig_params = px.scatter(detr_data, x='Params', y='mAP', hover_name='Model', title='DETR: Params vs mAP')
|
| 118 |
st.plotly_chart(fig_flops)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
st.plotly_chart(fig_params)
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
fig_flops = px.scatter(detr_data, x='FLOPS', y='mAP', hover_name='Model', title='DETR: FLOPS vs mAP')
|
| 117 |
fig_params = px.scatter(detr_data, x='Params', y='mAP', hover_name='Model', title='DETR: Params vs mAP')
|
| 118 |
st.plotly_chart(fig_flops)
|
| 119 |
+
st.plotly_chart(fig_params)import streamlit as st
|
| 120 |
+
import pandas as pd
|
| 121 |
+
import numpy as np
|
| 122 |
+
import plotly.express as px
|
| 123 |
+
|
| 124 |
+
# Function to generate example data for SSD (replace with your data)
|
| 125 |
+
def generate_example_data_ssd(model, task):
|
| 126 |
+
data = {
|
| 127 |
+
'Model': [],
|
| 128 |
+
'KL Factor': [],
|
| 129 |
+
'FLOPS': [],
|
| 130 |
+
'Params': [],
|
| 131 |
+
'mAP': []
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
# Define KL Factor, FLOPS, Params, and mAP for each SSD model and task
|
| 135 |
+
if model == 'SSD300' or model == 'SSD512':
|
| 136 |
+
for _ in range(5): # Generate example data for 5 samples
|
| 137 |
+
data['Model'].append(model)
|
| 138 |
+
data['KL Factor'].append(np.random.uniform(0.1, 1.0))
|
| 139 |
+
data['FLOPS'].append(np.random.randint(100, 300))
|
| 140 |
+
data['Params'].append(np.random.randint(10, 30))
|
| 141 |
+
data['mAP'].append(np.random.uniform(0.7, 0.9))
|
| 142 |
+
|
| 143 |
+
return pd.DataFrame(data)
|
| 144 |
+
|
| 145 |
+
# Function to generate example data for DETR (replace with your data)
|
| 146 |
+
def generate_example_data_detr():
|
| 147 |
+
data = {
|
| 148 |
+
'Model': ['DETR'],
|
| 149 |
+
'FLOPS': [np.random.randint(100, 300)],
|
| 150 |
+
'Params': [np.random.randint(10, 30)],
|
| 151 |
+
'mAP': [np.random.uniform(0.7, 0.9)]
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
return pd.DataFrame(data)
|
| 155 |
+
|
| 156 |
+
# Streamlit app
|
| 157 |
+
st.title("Variational Information Bottleneck")
|
| 158 |
+
|
| 159 |
+
# Text card about the page
|
| 160 |
+
st.markdown("""
|
| 161 |
+
<div class="text-card">
|
| 162 |
+
<p>This page explores Variational Information Bottleneck (VIB) for SSD and DETR models.</p>
|
| 163 |
+
<p>VIB is a technique used for model compression and transfer learning in deep learning tasks.</p>
|
| 164 |
+
</div>
|
| 165 |
+
""", unsafe_allow_html=True)
|
| 166 |
+
|
| 167 |
+
# Create tabs for SSD and DETR
|
| 168 |
+
tabs = st.tabs(["SSD", "DETR"])
|
| 169 |
+
|
| 170 |
+
# SSD tab content
|
| 171 |
+
if tabs[0]:
|
| 172 |
+
st.subheader("SSD")
|
| 173 |
+
|
| 174 |
+
# Filter for Transferability vs Pruning
|
| 175 |
+
task = st.radio("Select Task", ["Transferability", "Pruning"])
|
| 176 |
+
|
| 177 |
+
# Filter for SSD model
|
| 178 |
+
model = st.radio("Select Model", ["SSD300", "SSD512"])
|
| 179 |
+
|
| 180 |
+
# Generate example data based on selected filters
|
| 181 |
+
ssd_data = generate_example_data_ssd(model, task)
|
| 182 |
+
|
| 183 |
+
# Display table for SSD
|
| 184 |
+
st.write("Table for SSD:")
|
| 185 |
+
st.table(ssd_data)
|
| 186 |
+
|
| 187 |
+
# Plot graphs for SSD
|
| 188 |
+
st.write("Graphs for SSD:")
|
| 189 |
+
fig_flops = px.scatter(ssd_data, x='FLOPS', y='mAP', hover_name='Model', title=f'SSD: {task} - FLOPS vs mAP')
|
| 190 |
+
fig_params = px.scatter(ssd_data, x='Params', y='mAP', hover_name='Model', title=f'SSD: {task} - Params vs mAP')
|
| 191 |
+
st.plotly_chart(fig_flops)
|
| 192 |
st.plotly_chart(fig_params)
|
| 193 |
|
| 194 |
+
# DETR tab content
|
| 195 |
+
else:
|
| 196 |
+
st.subheader("DETR")
|
| 197 |
+
|
| 198 |
+
# Generate example data for DETR
|
| 199 |
+
detr_data = generate_example_data_detr()
|
| 200 |
+
|
| 201 |
+
# Display table for DETR
|
| 202 |
+
st.write("Table for DETR:")
|
| 203 |
+
st.table(detr_data)
|
| 204 |
+
|
| 205 |
+
# Plot graphs for DETR
|
| 206 |
+
st.write("Graphs for DETR:")
|
| 207 |
+
fig_flops = px.scatter(detr_data, x='FLOPS', y='mAP', hover_name='Model', title='DETR: FLOPS vs mAP')
|
| 208 |
+
fig_params = px.scatter(detr_data, x='Params', y='mAP', hover_name='Model', title='DETR: Params vs mAP')
|
| 209 |
+
st.plotly_chart(fig_flops)
|
| 210 |
+
st.plotly_chart(fig_params)
|
| 211 |
+
|
| 212 |
+
|