Spaces:
Running
Running
Joshua Lochner
commited on
Commit
·
aa018be
1
Parent(s):
87b2dec
Do not allow predictions to miss start of video
Browse files- src/predict.py +4 -1
src/predict.py
CHANGED
|
@@ -166,6 +166,9 @@ SEGMENT_MATCH_RE = fr'{_SEGMENT_START}\s*(?P<text>.*?)\s*(?:{_SEGMENT_END}|$)'
|
|
| 166 |
MATCH_WINDOW = 25 # Increase for accuracy, but takes longer: O(n^3)
|
| 167 |
MERGE_TIME_WITHIN = 8 # Merge predictions if they are within x seconds
|
| 168 |
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
@dataclass(frozen=True, eq=True)
|
| 171 |
class ClassifierArguments:
|
|
@@ -367,7 +370,7 @@ def segments_to_predictions(segments, model, tokenizer):
|
|
| 367 |
|
| 368 |
final_predicted_time_ranges = []
|
| 369 |
for range in predicted_time_ranges:
|
| 370 |
-
start_time = range['start']
|
| 371 |
end_time = range['end']
|
| 372 |
|
| 373 |
if prev_prediction is not None and \
|
|
|
|
| 166 |
MATCH_WINDOW = 25 # Increase for accuracy, but takes longer: O(n^3)
|
| 167 |
MERGE_TIME_WITHIN = 8 # Merge predictions if they are within x seconds
|
| 168 |
|
| 169 |
+
# Any prediction whose start time is <= this will be set to start at 0
|
| 170 |
+
START_TIME_ZERO_THRESHOLD = 0.08
|
| 171 |
+
|
| 172 |
|
| 173 |
@dataclass(frozen=True, eq=True)
|
| 174 |
class ClassifierArguments:
|
|
|
|
| 370 |
|
| 371 |
final_predicted_time_ranges = []
|
| 372 |
for range in predicted_time_ranges:
|
| 373 |
+
start_time = range['start'] if range['start'] > START_TIME_ZERO_THRESHOLD else 0
|
| 374 |
end_time = range['end']
|
| 375 |
|
| 376 |
if prev_prediction is not None and \
|