Spaces:
Running
Running
Joshua Lochner
commited on
Commit
•
183ba5e
1
Parent(s):
11be1bd
Output auto-submission link for missing segments
Browse files- src/evaluate.py +14 -2
src/evaluate.py
CHANGED
@@ -18,6 +18,7 @@ import json
|
|
18 |
import os
|
19 |
import random
|
20 |
from shared import seconds_to_time
|
|
|
21 |
|
22 |
|
23 |
@dataclass
|
@@ -225,11 +226,12 @@ def main():
|
|
225 |
seg for seg in labelled_predicted_segments if seg['best_prediction'] is None]
|
226 |
|
227 |
if missed_segments or incorrect_segments:
|
228 |
-
print(
|
229 |
-
|
230 |
# Potentially missed segments (model predicted, but not in database)
|
231 |
if missed_segments:
|
232 |
print(' - Missed segments:')
|
|
|
233 |
for i, missed_segment in enumerate(missed_segments, start=1):
|
234 |
print(f'\t#{i}:', seconds_to_time(
|
235 |
missed_segment['start']), '-->', seconds_to_time(missed_segment['end']))
|
@@ -240,6 +242,16 @@ def main():
|
|
240 |
print('\t\tProbability:',
|
241 |
missed_segment.get('probability'))
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
# Potentially incorrect segments (model didn't predict, but in database)
|
244 |
if incorrect_segments:
|
245 |
print(' - Incorrect segments:')
|
|
|
18 |
import os
|
19 |
import random
|
20 |
from shared import seconds_to_time
|
21 |
+
from urllib.parse import quote
|
22 |
|
23 |
|
24 |
@dataclass
|
|
|
226 |
seg for seg in labelled_predicted_segments if seg['best_prediction'] is None]
|
227 |
|
228 |
if missed_segments or incorrect_segments:
|
229 |
+
print(
|
230 |
+
f'Issues identified for https://youtu.be/{video_id} (#{video_index})')
|
231 |
# Potentially missed segments (model predicted, but not in database)
|
232 |
if missed_segments:
|
233 |
print(' - Missed segments:')
|
234 |
+
segments_to_submit = []
|
235 |
for i, missed_segment in enumerate(missed_segments, start=1):
|
236 |
print(f'\t#{i}:', seconds_to_time(
|
237 |
missed_segment['start']), '-->', seconds_to_time(missed_segment['end']))
|
|
|
242 |
print('\t\tProbability:',
|
243 |
missed_segment.get('probability'))
|
244 |
|
245 |
+
segments_to_submit.append({
|
246 |
+
'segment': [missed_segment['start'], missed_segment['end']],
|
247 |
+
'category': missed_segment['category'].lower(),
|
248 |
+
'actionType': 'skip'
|
249 |
+
})
|
250 |
+
|
251 |
+
json_data = quote(json.dumps(segments_to_submit))
|
252 |
+
print(
|
253 |
+
f'\tSubmit: https://www.youtube.com/watch?v={video_id}#segments={json_data}')
|
254 |
+
|
255 |
# Potentially incorrect segments (model didn't predict, but in database)
|
256 |
if incorrect_segments:
|
257 |
print(' - Incorrect segments:')
|