Spaces:
Runtime error
Runtime error
ercanburak
commited on
Commit
•
db457c7
1
Parent(s):
99fd4f2
add meta code, disabled for now
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import subprocess
|
|
3 |
|
4 |
import streamlit as st
|
5 |
|
6 |
-
from utils import get_configs, get_display_names, get_path_for_viz, get_text_str
|
7 |
|
8 |
# st.header("EVREAL - Event-based Video Reconstruction Evaluation and Analysis Library")
|
9 |
#
|
@@ -20,6 +20,12 @@ from utils import get_configs, get_display_names, get_path_for_viz, get_text_str
|
|
20 |
|
21 |
@st.cache_data(show_spinner="Retrieving results...")
|
22 |
def retrieve_results(selected_dataset, selected_sequence, selected_models, selected_metrics, selected_visualizations):
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
gt_only_viz = [viz for viz in selected_visualizations if viz['viz_type'] == 'gt_only']
|
24 |
model_only_viz = [viz for viz in selected_visualizations if viz['viz_type'] == 'model_only']
|
25 |
both_viz = [viz for viz in selected_visualizations if viz['viz_type'] == 'both']
|
@@ -47,6 +53,8 @@ def retrieve_results(selected_dataset, selected_sequence, selected_models, selec
|
|
47 |
|
48 |
padding = 2
|
49 |
font_size = 20
|
|
|
|
|
50 |
num_cols = len(selected_models)
|
51 |
crop_str = "crop=trunc(iw/2)*2-2:trunc(ih/2)*2,"
|
52 |
pad_str = "pad=ceil(iw/2)*2+{}:ceil(ih/2)*2+{}:{}:{}:white".format(padding*2, padding*2, padding, padding)
|
@@ -63,6 +71,15 @@ def retrieve_results(selected_dataset, selected_sequence, selected_models, selec
|
|
63 |
left_pad = (font_size*0.7)*max([len(viz['display_name']) for viz in model_viz[1:]]) + padding*2
|
64 |
else:
|
65 |
left_pad = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
for row_idx in range(num_rows):
|
67 |
for col_idx in range(num_cols):
|
68 |
vid_idx = len(video_paths)
|
|
|
3 |
|
4 |
import streamlit as st
|
5 |
|
6 |
+
from utils import get_configs, get_display_names, get_path_for_viz, get_text_str, get_meta_path
|
7 |
|
8 |
# st.header("EVREAL - Event-based Video Reconstruction Evaluation and Analysis Library")
|
9 |
#
|
|
|
20 |
|
21 |
@st.cache_data(show_spinner="Retrieving results...")
|
22 |
def retrieve_results(selected_dataset, selected_sequence, selected_models, selected_metrics, selected_visualizations):
|
23 |
+
|
24 |
+
meta_enabled = False
|
25 |
+
meta_path = get_meta_path(base_data_dir, selected_dataset, selected_sequence)
|
26 |
+
if not os.path.isfile(meta_path):
|
27 |
+
raise ValueError("Meta file not found: {}".format(meta_path))
|
28 |
+
|
29 |
gt_only_viz = [viz for viz in selected_visualizations if viz['viz_type'] == 'gt_only']
|
30 |
model_only_viz = [viz for viz in selected_visualizations if viz['viz_type'] == 'model_only']
|
31 |
both_viz = [viz for viz in selected_visualizations if viz['viz_type'] == 'both']
|
|
|
53 |
|
54 |
padding = 2
|
55 |
font_size = 20
|
56 |
+
meta_width = 250
|
57 |
+
meta_height = 70
|
58 |
num_cols = len(selected_models)
|
59 |
crop_str = "crop=trunc(iw/2)*2-2:trunc(ih/2)*2,"
|
60 |
pad_str = "pad=ceil(iw/2)*2+{}:ceil(ih/2)*2+{}:{}:{}:white".format(padding*2, padding*2, padding, padding)
|
|
|
71 |
left_pad = (font_size*0.7)*max([len(viz['display_name']) for viz in model_viz[1:]]) + padding*2
|
72 |
else:
|
73 |
left_pad = 0
|
74 |
+
|
75 |
+
if meta_enabled: # add meta video
|
76 |
+
if left_pad < meta_width:
|
77 |
+
left_pad = meta_width
|
78 |
+
video_paths.append(meta_path)
|
79 |
+
xstack_input_parts.append("[0:v]")
|
80 |
+
meta_h_offset = (h - meta_height) / 2
|
81 |
+
layout_parts.append("0_{}".format(meta_h_offset))
|
82 |
+
|
83 |
for row_idx in range(num_rows):
|
84 |
for col_idx in range(num_cols):
|
85 |
vid_idx = len(video_paths)
|
utils.py
CHANGED
@@ -37,6 +37,12 @@ def get_path_for_viz(basedir, dataset, sequence, model, viz):
|
|
37 |
return video_path
|
38 |
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
def get_text_str(height, width, text, fontsize, fontcolor="black"):
|
41 |
return "drawtext=text='{}':" \
|
42 |
"fontsize={}:fontcolor={}:" \
|
|
|
37 |
return video_path
|
38 |
|
39 |
|
40 |
+
def get_meta_path(basedir, dataset, sequence):
|
41 |
+
dat_seq = "_".join([dataset["name"], sequence])
|
42 |
+
meta_path = os.path.join(basedir, "meta", dat_seq, "videos", "meta.mp4")
|
43 |
+
return meta_path
|
44 |
+
|
45 |
+
|
46 |
def get_text_str(height, width, text, fontsize, fontcolor="black"):
|
47 |
return "drawtext=text='{}':" \
|
48 |
"fontsize={}:fontcolor={}:" \
|