Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
import plotly.express as px
|
| 5 |
+
|
| 6 |
+
# Function to generate example data (replace with your data)
|
| 7 |
+
def generate_example_data():
|
| 8 |
+
data = {
|
| 9 |
+
'Model': [],
|
| 10 |
+
'Version': [],
|
| 11 |
+
'Dataset': [],
|
| 12 |
+
'Epoch': [],
|
| 13 |
+
'FLOPS': [],
|
| 14 |
+
'Params': [],
|
| 15 |
+
'mAP': []
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
# Define FLOPS, Params, and mAP for each model, version, dataset, and epoch
|
| 19 |
+
epochs = range(1, 6)
|
| 20 |
+
versions = ['v1', 'v2', 'v3']
|
| 21 |
+
for epoch in epochs:
|
| 22 |
+
for version in versions:
|
| 23 |
+
for model in ['SSD300', 'SSD512', 'DETR']:
|
| 24 |
+
for dataset in ['Dataset1', 'Dataset2']:
|
| 25 |
+
data['Model'].append(model)
|
| 26 |
+
data['Version'].append(version)
|
| 27 |
+
data['Dataset'].append(dataset)
|
| 28 |
+
data['Epoch'].append(epoch)
|
| 29 |
+
data['FLOPS'].append(np.random.randint(100, 300))
|
| 30 |
+
data['Params'].append(np.random.randint(10, 30))
|
| 31 |
+
data['mAP'].append(np.random.uniform(0.7, 0.9))
|
| 32 |
+
|
| 33 |
+
return pd.DataFrame(data)
|
| 34 |
+
|
| 35 |
+
# Function to get final FLOPS, Params, and mAP for each model version
|
| 36 |
+
def get_final_metrics(data):
|
| 37 |
+
final_metrics = data.groupby(['Model', 'Version']).agg({'FLOPS': 'last', 'Params': 'last', 'mAP': 'last'}).reset_index()
|
| 38 |
+
return final_metrics
|
| 39 |
+
|
| 40 |
+
# Streamlit app
|
| 41 |
+
st.title("VIB Compression Results")
|
| 42 |
+
|
| 43 |
+
# Generate example data (replace with your actual data)
|
| 44 |
+
data = generate_example_data()
|
| 45 |
+
|
| 46 |
+
# Sidebar menu
|
| 47 |
+
model = st.sidebar.selectbox("Select Model", ["SSD300", "SSD512", "DETR"])
|
| 48 |
+
dataset = st.sidebar.selectbox("Select Dataset", ["Dataset1", "Dataset2"])
|
| 49 |
+
|
| 50 |
+
# Display final FLOPS, Params, and mAP for each model version
|
| 51 |
+
st.subheader("Final Metrics for Each Model Version")
|
| 52 |
+
filtered_metrics = get_final_metrics(data[(data['Model'] == model) & (data['Dataset'] == dataset)])
|
| 53 |
+
st.table(filtered_metrics)
|
| 54 |
+
|
| 55 |
+
# Allow the user to view evolution graphs for FLOPS, Params, and mAP of all model versions
|
| 56 |
+
factor = st.radio("Select Factor to Display", ["FLOPS", "Params", "mAP"])
|
| 57 |
+
|
| 58 |
+
# Filter data based on user selection of factor
|
| 59 |
+
filtered_data = data[(data['Model'] == model) & (data['Dataset'] == dataset)]
|
| 60 |
+
|
| 61 |
+
# Plot evolution graphs for all model versions
|
| 62 |
+
if factor == "FLOPS":
|
| 63 |
+
fig = px.line(filtered_data, x='Epoch', y='FLOPS', color='Version', title='FLOPS Evolution')
|
| 64 |
+
elif factor == "Params":
|
| 65 |
+
fig = px.line(filtered_data, x='Epoch', y='Params', color='Version', title='Params Evolution')
|
| 66 |
+
else: # mAP
|
| 67 |
+
fig = px.line(filtered_data, x='Epoch', y='mAP', color='Version', title='mAP Evolution')
|
| 68 |
+
|
| 69 |
+
# Display plot
|
| 70 |
+
st.plotly_chart(fig)
|