Update app.py
Browse files
app.py
CHANGED
|
@@ -6,117 +6,7 @@ import plotly.express as px
|
|
| 6 |
st.set_page_config(layout="wide")
|
| 7 |
|
| 8 |
|
| 9 |
-
|
| 10 |
-
def generate_example_data_ssd(model):
|
| 11 |
-
data = {
|
| 12 |
-
'Model': [],
|
| 13 |
-
'KL Factor': [],
|
| 14 |
-
'FLOPS': [],
|
| 15 |
-
'Params': [],
|
| 16 |
-
'mAP': []
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
# Define KL Factor, FLOPS, Params, and mAP for each SSD model
|
| 20 |
-
if model == 'SSD300' or model == 'SSD512':
|
| 21 |
-
data['Model'].append(model)
|
| 22 |
-
data['KL Factor'].append(np.random.uniform(0.1, 1.0))
|
| 23 |
-
data['FLOPS'].append(np.random.randint(100, 300))
|
| 24 |
-
data['Params'].append(np.random.randint(10, 30))
|
| 25 |
-
data['mAP'].append(np.random.uniform(0.7, 0.9))
|
| 26 |
-
|
| 27 |
-
return pd.DataFrame(data)
|
| 28 |
-
|
| 29 |
-
# Function to generate example data for DETR (replace with your data)
|
| 30 |
-
def generate_example_data_detr():
|
| 31 |
-
data = {
|
| 32 |
-
'Model': ['DETR'],
|
| 33 |
-
'FLOPS': [np.random.randint(100, 300)],
|
| 34 |
-
'Params': [np.random.randint(10, 30)],
|
| 35 |
-
'mAP': [np.random.uniform(0.7, 0.9)]
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
return pd.DataFrame(data)
|
| 39 |
-
|
| 40 |
-
# Streamlit app
|
| 41 |
-
st.title("Variational Information Bottleneck")
|
| 42 |
-
|
| 43 |
-
# Text card about the page
|
| 44 |
-
st.markdown("""
|
| 45 |
-
<div class="text-card">
|
| 46 |
-
<p>This page explores Variational Information Bottleneck (VIB) for SSD and DETR models.</p>
|
| 47 |
-
<p>VIB is a technique used for model compression and transfer learning in deep learning tasks.</p>
|
| 48 |
-
</div>
|
| 49 |
-
""", unsafe_allow_html=True)
|
| 50 |
-
|
| 51 |
-
# Create tabs for SSD and DETR
|
| 52 |
-
tabs = st.tabs(["SSD", "DETR"])
|
| 53 |
-
|
| 54 |
-
# SSD tab content
|
| 55 |
-
if tabs[0]:
|
| 56 |
-
st.subheader("SSD")
|
| 57 |
-
|
| 58 |
-
# Create sub-tabs for Transferability and Pruning
|
| 59 |
-
sub_tabs = st.tabs(["Transferability", "Pruning"])
|
| 60 |
-
|
| 61 |
-
# SSD Transferability tab content
|
| 62 |
-
if sub_tabs[0]:
|
| 63 |
-
st.subheader("Transferability")
|
| 64 |
-
|
| 65 |
-
# Filters for Transferability
|
| 66 |
-
model = st.selectbox("Select Model", ["SSD300", "SSD512"])
|
| 67 |
-
|
| 68 |
-
# Generate example data for SSD Transferability
|
| 69 |
-
transfer_data = generate_example_data_ssd(model)
|
| 70 |
-
|
| 71 |
-
# Display table for SSD Transferability
|
| 72 |
-
st.write("Table for SSD Transferability:")
|
| 73 |
-
st.table(transfer_data)
|
| 74 |
-
|
| 75 |
-
# Plot graphs for SSD Transferability
|
| 76 |
-
st.write("Graphs for SSD Transferability:")
|
| 77 |
-
fig_flops = px.scatter(transfer_data, x='FLOPS', y='mAP', hover_name='Model', title='SSD Transferability: FLOPS vs mAP')
|
| 78 |
-
fig_params = px.scatter(transfer_data, x='Params', y='mAP', hover_name='Model', title='SSD Transferability: Params vs mAP')
|
| 79 |
-
st.plotly_chart(fig_flops)
|
| 80 |
-
st.plotly_chart(fig_params)
|
| 81 |
-
|
| 82 |
-
# SSD Pruning tab content
|
| 83 |
-
else:
|
| 84 |
-
st.subheader("Pruning")
|
| 85 |
-
|
| 86 |
-
# Filters for Pruning
|
| 87 |
-
model = st.selectbox("Select Model", ["SSD300", "SSD512"])
|
| 88 |
-
|
| 89 |
-
# Generate example data for SSD Pruning
|
| 90 |
-
pruning_data = generate_example_data_ssd(model)
|
| 91 |
-
|
| 92 |
-
# Display table for SSD Pruning
|
| 93 |
-
st.write("Table for SSD Pruning:")
|
| 94 |
-
st.table(pruning_data)
|
| 95 |
-
|
| 96 |
-
# Plot graphs for SSD Pruning
|
| 97 |
-
st.write("Graphs for SSD Pruning:")
|
| 98 |
-
fig_flops = px.scatter(pruning_data, x='FLOPS', y='mAP', hover_name='Model', title='SSD Pruning: FLOPS vs mAP')
|
| 99 |
-
fig_params = px.scatter(pruning_data, x='Params', y='mAP', hover_name='Model', title='SSD Pruning: Params vs mAP')
|
| 100 |
-
st.plotly_chart(fig_flops)
|
| 101 |
-
st.plotly_chart(fig_params)
|
| 102 |
-
|
| 103 |
-
# DETR tab content
|
| 104 |
-
else:
|
| 105 |
-
st.subheader("DETR")
|
| 106 |
-
|
| 107 |
-
# Generate example data for DETR
|
| 108 |
-
detr_data = generate_example_data_detr()
|
| 109 |
-
|
| 110 |
-
# Display table for DETR
|
| 111 |
-
st.write("Table for DETR:")
|
| 112 |
-
st.table(detr_data)
|
| 113 |
-
|
| 114 |
-
# Plot graphs for DETR
|
| 115 |
-
st.write("Graphs for DETR:")
|
| 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
|
|
@@ -209,4 +99,3 @@ else:
|
|
| 209 |
st.plotly_chart(fig_flops)
|
| 210 |
st.plotly_chart(fig_params)
|
| 211 |
|
| 212 |
-
|
|
|
|
| 6 |
st.set_page_config(layout="wide")
|
| 7 |
|
| 8 |
|
| 9 |
+
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
import pandas as pd
|
| 11 |
import numpy as np
|
| 12 |
import plotly.express as px
|
|
|
|
| 99 |
st.plotly_chart(fig_flops)
|
| 100 |
st.plotly_chart(fig_params)
|
| 101 |
|
|
|