ercanburak commited on
Commit
24aac30
1 Parent(s): 902a216

display model names above top row

Browse files
Files changed (2) hide show
  1. app.py +13 -2
  2. utils.py +4 -2
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_video_height
7
 
8
  # st.header("EVREAL - Event-based Video Reconstruction Evaluation and Analysis Library")
9
  #
@@ -99,12 +99,14 @@ if len(gt_viz) > 0:
99
  selected_models.append(ground_truth)
100
 
101
  padding = 2
 
102
  num_cols = len(selected_models)
103
  crop_str = "crop=trunc(iw/2)*2:trunc(ih/2)*2"
104
  pad_str = "pad=ceil(iw/2)*2+{}:ceil(ih/2)*2+{}:{}:{}".format(padding*2, padding*2, padding, padding)
105
  num_elements = num_rows * num_cols
106
 
107
  w = selected_dataset["width"]
 
108
  input_filter_parts = []
109
  xstack_input_parts = []
110
  layout_parts = []
@@ -133,7 +135,16 @@ for row_idx in range(num_rows):
133
 
134
  if row_heights[row_idx] == "":
135
  row_heights[row_idx] = "h{}".format(vid_idx)
136
- input_filter_part = "[{}:v]scale={}:-1,{}[v{}]".format(vid_idx, w, pad_str, vid_idx)
 
 
 
 
 
 
 
 
 
137
  input_filter_parts.append(input_filter_part)
138
  xstack_input_part = "[v{}]".format(vid_idx)
139
  xstack_input_parts.append(xstack_input_part)
 
3
 
4
  import streamlit as st
5
 
6
+ from utils import get_configs, get_display_names, get_path_for_viz, get_video_height, get_text_str
7
 
8
  # st.header("EVREAL - Event-based Video Reconstruction Evaluation and Analysis Library")
9
  #
 
99
  selected_models.append(ground_truth)
100
 
101
  padding = 2
102
+ font_size = 20
103
  num_cols = len(selected_models)
104
  crop_str = "crop=trunc(iw/2)*2:trunc(ih/2)*2"
105
  pad_str = "pad=ceil(iw/2)*2+{}:ceil(ih/2)*2+{}:{}:{}".format(padding*2, padding*2, padding, padding)
106
  num_elements = num_rows * num_cols
107
 
108
  w = selected_dataset["width"]
109
+ h = selected_dataset["height"]
110
  input_filter_parts = []
111
  xstack_input_parts = []
112
  layout_parts = []
 
135
 
136
  if row_heights[row_idx] == "":
137
  row_heights[row_idx] = "h{}".format(vid_idx)
138
+ if row_idx == 0:
139
+ # font_size
140
+ # pad=240:180+23:0:180:white
141
+ pad_height = font_size+padding*2
142
+ pad_txt_str = ",pad={}:{}:0:{}:white".format(w+padding*2, h+font_size+padding*4, pad_height)
143
+ text_str = get_text_str(pad_height, w, cur_model['display_name'], font_path, font_size)
144
+ pad_txt_str = pad_txt_str + "," + text_str
145
+ else:
146
+ pad_txt_str = ""
147
+ input_filter_part = "[{}:v]scale={}:-1,{}{}[v{}]".format(vid_idx, w, pad_str, pad_txt_str, vid_idx)
148
  input_filter_parts.append(input_filter_part)
149
  xstack_input_part = "[v{}]".format(vid_idx)
150
  xstack_input_parts.append(xstack_input_part)
utils.py CHANGED
@@ -37,8 +37,10 @@ def get_path_for_viz(base_path, dataset, sequence, model, viz):
37
  return video_path
38
 
39
 
40
- def get_text_video(video_h, video_w, text, font, fontsize, fontcolor="black"):
41
- pass
 
 
42
 
43
 
44
  def get_video_height(video_path):
 
37
  return video_path
38
 
39
 
40
+ def get_text_str(height, width, text, font, fontsize, fontcolor="black"):
41
+ return "drawtext=fontfile='{}':text='{}':" \
42
+ "fontsize={}:fontcolor={}:" \
43
+ "x=({}-text_w)/2:y=({}-text_h)/2".format(font, text, fontsize, fontcolor, width, height)
44
 
45
 
46
  def get_video_height(video_path):