Skip to content

Commit

Permalink
Multiple download tries
Browse files Browse the repository at this point in the history
  • Loading branch information
deadman2000 committed Aug 15, 2023
1 parent e77f5aa commit 85ff5c4
Show file tree
Hide file tree
Showing 6 changed files with 307 additions and 188 deletions.
275 changes: 123 additions & 152 deletions work/analysis.ipynb

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions work/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ def download_video(video_id):
'outtmpl': '%(id)s.%(ext)s',
'paths': {'home': video_dir},
}
with YoutubeDL(ydl_opts) as ydl:
ydl.download('https://www.youtube.com/watch?v=%s' % video_id)

return path
while True:
try:
with YoutubeDL(ydl_opts) as ydl:
ydl.download('https://www.youtube.com/watch?v=%s' % video_id)
return path
except:
pass


def get_frame(video_id, time):
Expand Down
155 changes: 146 additions & 9 deletions work/estimator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -25,7 +25,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -44,19 +44,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"filters = ['h_600', 'h_800', '*2', '*3', '*4', '*5', '*6', 'gray', 'unsharp', 'thresh', 'blur', '']\n",
"filters = ['h_600', 'h_800', '*1', '*2', '*3', '*4', '*5', '*6', 'gray', 'unsharp', 'thresh', 'blur', '']\n",
"filters = [f if len(f) == 0 else f+':' for f in filters]\n",
"def is_scale(p):\n",
" return p.startswith('h_') or p.startswith('*')"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -78,16 +78,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"400"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(params)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -123,7 +134,133 @@
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"h_600:gray:unsharp: 16 0 40\n",
"h_600:gray:thresh: 58 0 90\n",
"h_600:gray:blur: 14 0 56\n",
"h_600:gray: 10 0 31\n",
"h_600:unsharp:gray: 13 0 60\n",
"h_600:unsharp:thresh: 53 0 75\n",
"h_600:unsharp:blur: 0 0 0\n",
"h_600:unsharp: 18 0 82\n",
"h_600:thresh:gray: 55 0 85\n",
"h_600:thresh:unsharp: 64 36 92\n",
"h_600:thresh:blur: 65 40 85\n",
"h_600:thresh: 64 36 92\n",
"h_600:blur:gray: 14 0 51\n",
"h_600:blur:unsharp: 9 0 53\n",
"h_600:blur:thresh: 65 40 85\n",
"h_600:blur: 12 0 66\n",
"h_800:gray:unsharp: 8 0 29\n",
"h_800:gray:thresh: 68 39 94\n",
"h_800:gray:blur: 20 0 51\n",
"h_800:gray: 15 0 32\n",
"h_800:unsharp:gray: 23 0 58\n",
"h_800:unsharp:thresh: 53 0 91\n",
"h_800:unsharp:blur: 40 0 74\n",
"h_800:unsharp: 14 0 50\n",
"h_800:thresh:gray: 53 26 83\n",
"h_800:thresh:unsharp: 60 34 88\n",
"h_800:thresh:blur: 55 25 73\n",
"h_800:thresh: 60 34 88\n",
"h_800:blur:gray: 8 0 51\n",
"h_800:blur:unsharp: 9 0 32\n",
"h_800:blur:thresh: 55 25 73\n",
"h_800:blur: 36 0 66\n",
"*1:gray:unsharp: 14 0 33\n",
"*1:gray:thresh: 41 0 90\n",
"*1:gray:blur: 16 0 62\n",
"*1:gray: 16 0 31\n",
"*1:unsharp:gray: 16 0 37\n",
"*1:unsharp:thresh: 68 25 95\n",
"*1:unsharp:blur: 19 0 58\n",
"*1:unsharp: 17 0 82\n",
"*1:thresh:gray: 52 0 88\n",
"*1:thresh:unsharp: 60 0 89\n",
"*1:thresh:blur: 64 31 98\n",
"*1:thresh: 60 0 89\n",
"*1:blur:gray: 1 0 8\n",
"*1:blur:unsharp: 16 0 48\n",
"*1:blur:thresh: 64 31 98\n",
"*1:blur: 23 0 71\n",
"*2:gray:unsharp: 5 0 32\n",
"*2:gray:thresh: 59 27 89\n",
"*2:gray:blur: 15 0 32\n",
"*2:gray: 28 0 57\n",
"*2:unsharp:gray: 13 0 52\n",
"*2:unsharp:thresh: 56 21 97\n",
"*2:unsharp:blur: 37 0 67\n",
"*2:unsharp: 22 0 42\n",
"*2:thresh:gray: 48 0 92\n",
"*2:thresh:unsharp: 50 0 91\n",
"*2:thresh:blur: 52 18 69\n",
"*2:thresh: 50 0 91\n",
"*2:blur:gray: 16 0 53\n",
"*2:blur:unsharp: 28 0 41\n",
"*2:blur:thresh: 52 18 69\n",
"*2:blur: 40 5 73\n",
"*3:gray:unsharp: 23 0 39\n",
"*3:gray:thresh: 50 21 65\n",
"*3:gray:blur: 18 0 32\n",
"*3:gray: 31 17 52\n",
"*3:unsharp:gray: 14 0 32\n",
"*3:unsharp:thresh: 51 22 78\n",
"*3:unsharp:blur: 47 27 84\n",
"*3:unsharp: 28 0 60\n",
"*3:thresh:gray: 43 0 85\n",
"*3:thresh:unsharp: 39 10 81\n",
"*3:thresh:blur: 54 30 89\n",
"*3:thresh: 39 10 81\n",
"*3:blur:gray: 19 0 33\n",
"*3:blur:unsharp: 42 20 68\n",
"*3:blur:thresh: 54 30 89\n",
"*3:blur: 36 24 57\n",
"*4:gray:unsharp: 27 0 42\n",
"*4:gray:thresh: 49 0 74\n",
"*4:gray:blur: 23 0 51\n",
"*4:gray: 21 0 41\n",
"*4:unsharp:gray: 22 0 42\n",
"*4:unsharp:thresh: 51 17 93\n",
"*4:unsharp:blur: 60 37 100\n",
"*4:unsharp: 50 34 91\n",
"*4:thresh:gray: 56 27 90\n",
"*4:thresh:unsharp: 55 18 91\n",
"*4:thresh:blur: 53 32 80\n",
"*4:thresh: 55 18 91\n",
"*4:blur:gray: 22 0 39\n",
"*4:blur:unsharp: 50 28 99\n",
"*4:blur:thresh: 53 32 80\n",
"*4:blur: 20 0 58\n",
"*5:gray:unsharp: 19 0 37\n",
"*5:gray:thresh: 53 21 72\n",
"*5:gray:blur: 18 0 32\n",
"*5:gray: 22 0 38\n",
"*5:unsharp:gray: 13 0 33\n",
"*5:unsharp:thresh: 47 12 76\n",
"*5:unsharp:blur: 28 0 55\n",
"*5:unsharp: 32 0 60\n",
"*5:thresh:gray: 52 26 90\n",
"*5:thresh:unsharp: 44 19 84\n",
"*5:thresh:blur: 46 20 89\n",
"*5:thresh: 44 19 84\n",
"*5:blur:gray: 18 0 38\n",
"*5:blur:unsharp: 39 28 69\n",
"*5:blur:thresh: 46 20 89\n",
"*5:blur: 29 0 56\n",
"*6:gray:unsharp: 31 0 45\n",
"*6:gray:thresh: 53 22 83\n",
"*6:gray:blur: 19 0 39\n",
"*6:gray: 21 0 52\n",
"*6:unsharp:gray: 12 0 34\n",
"*6:unsharp:thresh: 57 16 91\n",
"*6:unsharp:blur: 45 25 62\n"
]
}
],
"source": [
"best = None\n",
"best_score = 0\n",
Expand Down
27 changes: 20 additions & 7 deletions work/show_frame.ipynb

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions work/test.ipynb

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions work/validations.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
def rec(video_id, frame, text):
return {'video_id': video_id, 'frame': frame, 'text': text}



data = [
rec('NwaUHJko9Ns', 2774, 'After removing the brittle old Bible from the opening in the floorboards, you carefully open it. Written inside the front cover you see...'),
rec('yY0t8Wp28c8', 1569, 'Francois Pierre Crouton Born - 1787 Passed away - 1832\n Married Claudette Marie Tourte - 1815\nClaudette Marie Crouton Born - 1796 Passed away - 1856\nThomas Simon Crouton Born - 1816\nClaude Francois Crouton Born - 1819\n Thomas wed Mary Frances O\'Neil - 1848\nMary Frances Crouton Born - 1827\nWilliam Thomas Crouton Born - 1851 Passed away - 1851\nSarah Marie Crouton Born - 1854'),
rec('BV6EZyasaVk', 3662, 'Francois Pierre Crouton Born - 1787 Passed away - 1832\n Married Claudette Marie Tourte - 1815\nClaudette Marie Crouton Born - 1796 Passed away - 1856\nThomas Simon Crouton Born - 1816\nClaude Francois Crouton Born - 1819\n Thomas wed Mary Frances O\'Neil - 1848\nMary Frances Crouton Born - 1827\nWilliam Thomas Crouton Born - 1851 Passed away - 1851\nSarah Marie Crouton Born - 1854'),
rec('NwaUHJko9Ns', 4271, '"My necklace! I wuz wunderin\' where it got to! "Well, Missy Laura, thank you!"'),
rec('yY0t8Wp28c8', 3543, '"You ain\'t good enough to kiss the ground she walks on! You\'re nothing but a low-class jerk!"'),
rec('BV6EZyasaVk', 1295, '"Oh, mon ami, I find it difficult to refuse you. I am so attracted to you."'),
rec('XMPUmo6Bl1U', 136, 'Say, Ignatius, why are you working in my park now?'),
rec('DpVOjGTT7QE', 1182, 'Quite freaky, first thing in the morning.'),
rec('Ep74spxrKNw', 2852, 'Okay, I\'m looking for straw strands, to draw lots.'),
rec('6PyWjgBpSq4', 421, 'Look, I even have sprouts growing all over me!'),
rec('6PyWjgBpSq4', 689, 'Thank you Asgard! High five!'),
rec('oKXl7jWlCwY', 869, 'I have a little gift for you, my friend.'),
]

0 comments on commit 85ff5c4

Please sign in to comment.