yolobench / utils.py
Ivan Lazarevich
release app
796b62e
import urllib.parse
import pandas as pd
from gradio.themes.utils.colors import Color
DATA_URL = 'https://raw.githubusercontent.com/Deeplite/deeplite-torch-zoo/develop/results/yolobench/'
DEEPLITE_DARK_BLUE_RGB = (0, 66, 107)
DEEPLITE_DARK_BLUE_HEX = '#00426B'
DEEPLITE_LIGHT_BLUE_RGB = (0, 148, 206)
DEEPLITE_LIGHT_BLUE_HEX = '#0094CE'
DEEPLITE_DARK_BLUE_GRADIO = Color(
name='deeplite_dark_blue',
c50=DEEPLITE_DARK_BLUE_HEX,
c100=DEEPLITE_DARK_BLUE_HEX,
c200=DEEPLITE_DARK_BLUE_HEX,
c300=DEEPLITE_DARK_BLUE_HEX,
c400=DEEPLITE_DARK_BLUE_HEX,
c500=DEEPLITE_DARK_BLUE_HEX,
c600=DEEPLITE_DARK_BLUE_HEX,
c700=DEEPLITE_DARK_BLUE_HEX,
c800=DEEPLITE_DARK_BLUE_HEX,
c900=DEEPLITE_DARK_BLUE_HEX,
c950=DEEPLITE_DARK_BLUE_HEX,
)
DEEPLITE_LIGHT_BLUE_GRADIO = Color(
name='deeplite_dark_blue',
c50=DEEPLITE_LIGHT_BLUE_HEX,
c100=DEEPLITE_LIGHT_BLUE_HEX,
c200=DEEPLITE_LIGHT_BLUE_HEX,
c300=DEEPLITE_LIGHT_BLUE_HEX,
c400=DEEPLITE_LIGHT_BLUE_HEX,
c500=DEEPLITE_LIGHT_BLUE_HEX,
c600=DEEPLITE_LIGHT_BLUE_HEX,
c700=DEEPLITE_LIGHT_BLUE_HEX,
c800=DEEPLITE_LIGHT_BLUE_HEX,
c900=DEEPLITE_LIGHT_BLUE_HEX,
c950=DEEPLITE_LIGHT_BLUE_HEX,
)
def load_yolobench_data():
df = pd.read_csv(urllib.parse.urljoin(DATA_URL, 'merged_results.csv'))
pareto_indices_df = pd.read_csv(urllib.parse.urljoin(DATA_URL, 'pareto_indices.csv'))
pareto_indices = {}
for row_idx in range(pareto_indices_df.shape[0]):
data_key = pareto_indices_df.iloc[row_idx, :]['data']
if data_key not in pareto_indices:
pareto_indices[data_key] = {}
hw_key = pareto_indices_df.iloc[row_idx, :]['hardware']
indices = pareto_indices_df.iloc[row_idx, :]['pareto_indices']
indices = [int(val) for val in indices.split(',')]
pareto_indices[data_key][hw_key] = indices
return df, pareto_indices