merlot_reserve
merlot_reserve copied to clipboard
Relative Location of input for TVQA
Hi, I have a question about the relative location for TVQA. `t_start = midpoint - segment_size * 0.5 t_end = midpoint + segment_size * 0.5
# Try to extend by 3 segments in either direction of the middle
times_used0 = [{'start_time': t_start, 'end_time': t_end}]
for i in range(6):
for delta in [-segment_size, segment_size]:
t0 = t_start + delta * (i+1)
t1 = t_end + delta * (i+1)
t0 = round(t0 * 3) / 3
t1 = round(t1 * 3) / 3
if t1 < 0:
continue
if t0 > max_time:
continue
if len(times_used0) < 7:
times_used0.append({'start_time': t0, 'end_time': t1})
times_used0 = sorted(times_used0, key=lambda x: x['start_time'])
# Figure out the relative position of the annotation
my_duration = times_used0[-1]['end_time'] - times_used[0]['start_time']
rel_localized_tstart = (ts0 - times_used[0]['start_time']) / my_duration
rel_localized_tend = (ts1 - times_used[0]['start_time']) / my_duration
qa_item['rel_localization'] = (rel_localized_tstart, rel_localized_tend)`
For the above code, I suspect that the rel_localized_tstart could be greater than rel_localized_tend since the "midpoint - segment_size * 0.5" could less than zero?
Besides, does the rel_localized_tstart or rel_localized_tend can be a negative number?
oh interesting! we didn't run into that though -- I think that means that all TVQA clips are longer than segment_size
.