File size: 2,631 Bytes
4fd5d51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import streamlit as st
import pandas as pd
import numpy as np
import plotly.express as px

# Function to generate example data (replace with your data)
def generate_example_data():
    data = {
        'Model': [],
        'Version': [],
        'Dataset': [],
        'Epoch': [],
        'FLOPS': [],
        'Params': [],
        'mAP': []
    }
    
    # Define FLOPS, Params, and mAP for each model, version, dataset, and epoch
    epochs = range(1, 6)
    versions = ['v1', 'v2', 'v3']
    for epoch in epochs:
        for version in versions:
            for model in ['SSD300', 'SSD512', 'DETR']:
                for dataset in ['Dataset1', 'Dataset2']:
                    data['Model'].append(model)
                    data['Version'].append(version)
                    data['Dataset'].append(dataset)
                    data['Epoch'].append(epoch)
                    data['FLOPS'].append(np.random.randint(100, 300))
                    data['Params'].append(np.random.randint(10, 30))
                    data['mAP'].append(np.random.uniform(0.7, 0.9))
    
    return pd.DataFrame(data)

# Function to get final FLOPS, Params, and mAP for each model version
def get_final_metrics(data):
    final_metrics = data.groupby(['Model', 'Version']).agg({'FLOPS': 'last', 'Params': 'last', 'mAP': 'last'}).reset_index()
    return final_metrics

# Streamlit app
st.title("VIB Compression Results")

# Generate example data (replace with your actual data)
data = generate_example_data()

# Sidebar menu
model = st.sidebar.selectbox("Select Model", ["SSD300", "SSD512", "DETR"])
dataset = st.sidebar.selectbox("Select Dataset", ["Dataset1", "Dataset2"])

# Display final FLOPS, Params, and mAP for each model version
st.subheader("Final Metrics for Each Model Version")
filtered_metrics = get_final_metrics(data[(data['Model'] == model) & (data['Dataset'] == dataset)])
st.table(filtered_metrics)

# Allow the user to view evolution graphs for FLOPS, Params, and mAP of all model versions
factor = st.radio("Select Factor to Display", ["FLOPS", "Params", "mAP"])

# Filter data based on user selection of factor
filtered_data = data[(data['Model'] == model) & (data['Dataset'] == dataset)]

# Plot evolution graphs for all model versions
if factor == "FLOPS":
    fig = px.line(filtered_data, x='Epoch', y='FLOPS', color='Version', title='FLOPS Evolution')
elif factor == "Params":
    fig = px.line(filtered_data, x='Epoch', y='Params', color='Version', title='Params Evolution')
else:  # mAP
    fig = px.line(filtered_data, x='Epoch', y='mAP', color='Version', title='mAP Evolution')

# Display plot
st.plotly_chart(fig)