Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: Failed to open youtube link #3016

Closed
PhilPark-geosr opened this issue May 3, 2021 · 5 comments · Fixed by #3018
Closed

AssertionError: Failed to open youtube link #3016

PhilPark-geosr opened this issue May 3, 2021 · 5 comments · Fixed by #3018
Labels
bug Something isn't working

Comments

@PhilPark-geosr
Copy link

Before submitting a bug report, please be aware that your issue must be reproducible with all of the following, otherwise it is non-actionable, and we can not help you:

If this is a custom dataset/training question you must include your train*.jpg, test*.jpg and results.png figures, or we can not help you. You can generate these with utils.plot_results().

🐛 Bug

A clear and concise description of what the bug is.

To Reproduce (REQUIRED)

Input:
python detect.py --source 'http://youtu.be/gmklhuYYL1k'

Output:

Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', project='runs/detect', save_conf=False, save_txt=False, source='https://youtu.be/gmklhuYYL1k', update=False, view_img=False, weights='yolov5s.pt')
YOLOv5 v4.0-16-g777032e torch 1.8.1+cu102 CUDA:0 (GeForce RTX 2080 Ti, 11019.4375MB)
                                          CUDA:1 (GeForce RTX 2080 Ti, 11019.4375MB)

Fusing layers... 
Model Summary: 224 layers, 7266973 parameters, 0 gradients, 17.0 GFLOPS
Traceback (most recent call last):
  File "detect.py", line 173, in <module>
    detect()
  File "detect.py", line 52, in detect
    dataset = LoadImages(source, img_size=imgsz)
  File "/home/ppark/yolo/yolov5/utils/datasets.py", line 132, in __init__
    raise Exception(f'ERROR: {p} does not exist')
Exception: ERROR: /home/ppark/yolo/yolov5/https:/youtu.be/gmklhuYYL1k does not exist
(yolov5) ppark@geosr:~/yolo/yolov5$ python detect.py --source 'http://youtu.be/gmklhuYYL1k'
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', project='runs/detect', save_conf=False, save_txt=False, source='http://youtu.be/gmklhuYYL1k', update=False, view_img=False, weights='yolov5s.pt')
YOLOv5 v4.0-16-g777032e torch 1.8.1+cu102 CUDA:0 (GeForce RTX 2080 Ti, 11019.4375MB)
                                          CUDA:1 (GeForce RTX 2080 Ti, 11019.4375MB)

Fusing layers... 
Model Summary: 224 layers, 7266973 parameters, 0 gradients, 17.0 GFLOPS
1/1: http://youtu.be/gmklhuYYL1k... Traceback (most recent call last):
  File "detect.py", line 173, in <module>
    detect()
  File "detect.py", line 49, in detect
    dataset = LoadStreams(source, img_size=imgsz)
  File "/home/ppark/yolo/yolov5/utils/datasets.py", line 276, in __init__
    assert cap.isOpened(), f'Failed to open {s}'
AssertionError: Failed to open http://youtu.be/gmklhuYYL1k

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

  • OS: [e.g. Ubuntu]
  • GPU [e.g. 2080 Ti]

Additional context

Add any other context about the problem here.

@PhilPark-geosr PhilPark-geosr added the bug Something isn't working label May 3, 2021
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2021

👋 Hello @PhilPark-geosr, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

@iceisfun
Copy link

iceisfun commented May 3, 2021

Have you tried something like youtube-dl to download the video then process it with detect?

the detect.py script does not integrate with things like youtube to download content.

Try something like this

root@21dc4c9707f0:/usr/src/app# pip3 install youtube-dl
Collecting youtube-dl
  Downloading youtube_dl-2021.4.26-py2.py3-none-any.whl (1.9 MB)
     |████████████████████████████████| 1.9 MB 2.7 MB/s 
Installing collected packages: youtube-dl
Successfully installed youtube-dl-2021.4.26
root@21dc4c9707f0:/usr/src/app# youtube-dl https://www.youtube.com/watch?v=gmklhuYYL1k
[youtube] gmklhuYYL1k: Downloading webpage
[youtube] gmklhuYYL1k: Downloading MPD manifest
[download] Destination: 유하영&옥성결-gmklhuYYL1k.mp4
[download] 100% of 103.71MiB in 00:16
root@21dc4c9707f0:/usr/src/app# python detect.py --source ./유하영\&옥성결-gmklhuYYL1k.mp4 
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, line_thickness=3, name='exp', nosave=False, project='runs/detect', save_conf=False, save_crop=False, save_txt=False, source='./유하영&옥성결-gmklhuYYL1k.mp4', update=False, view_img=False, weights='yolov5s.pt')
YOLOv5 🚀 v5.0-59-g31ee54c torch 1.8.0a0+52ea372 CUDA:0 (TITAN RTX, 24220.3125MB)
                                                CUDA:1 (TITAN RTX, 24220.3125MB)
                                                CUDA:2 (TITAN RTX, 24220.3125MB)

Fusing layers... 
Model Summary: 224 layers, 7266973 parameters, 0 gradients
video 1/1 (1/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 5 persons, 3 chairs, 2 potted plants, 1 tv, 2 laptops, Done. (0.017s)
video 1/1 (2/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 5 persons, 3 chairs, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (3/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 5 persons, 3 chairs, 1 couch, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (4/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 7 persons, 3 chairs, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (5/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 5 persons, 3 chairs, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (6/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 5 persons, 3 chairs, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (7/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 5 persons, 3 chairs, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (8/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 6 persons, 4 chairs, 1 couch, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (9/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 6 persons, 3 chairs, 2 potted plants, 1 tv, 3 laptops, Done. (0.009s)
video 1/1 (10/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 6 persons, 3 chairs, 2 potted plants, 1 tv, 2 laptops, Done. (0.009s)
video 1/1 (11/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 7 persons, 5 chairs, 2 potted plants, 2 laptops, Done. (0.009s)
video 1/1 (12/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 8 persons, 5 chairs, 1 couch, 2 potted plants, 2 laptops, Done. (0.009s)
video 1/1 (13/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 6 persons, 5 chairs, 3 potted plants, 2 laptops, Done. (0.009s)
video 1/1 (14/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 7 persons, 5 chairs, 3 potted plants, 2 laptops, Done. (0.009s)
video 1/1 (15/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 6 persons, 4 chairs, 3 potted plants, 2 laptops, Done. (0.009s)
video 1/1 (16/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 5 persons, 4 chairs, 3 potted plants, 1 laptop, Done. (0.009s)
video 1/1 (17/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 4 persons, 3 chairs, 3 potted plants, 3 laptops, Done. (0.009s)
video 1/1 (18/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 3 persons, 3 chairs, 3 potted plants, 3 laptops, Done. (0.009s)
video 1/1 (19/11987) /usr/src/app/유하영&옥성결-gmklhuYYL1k.mp4: 384x640 2 persons, 3 chairs, 3 potted plants, 1 laptop, Done. (0.009s)

@pravastacaraka
Copy link

@PhilPark-geosr update the yolov5 repo with git pull to get the latest version which is v5.0. There is a new feature added in PR #2752, inference using the youtube link.

@glenn-jocher
Copy link
Member

glenn-jocher commented May 3, 2021

@PhilPark-geosr YouTube inference is working correctly. If I run your command in a local PyCharm terminal:

(venv) (base) glennjocher@Glenns-iMac yolov5 % python detect.py --source 'http://youtu.be/gmklhuYYL1k' 
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, line_thickness=3, name='exp', nosave=False, project='runs/detect', save_conf=False, save_crop=False, save_txt=False, source='http://youtu.be/gmklhuYYL1k', update=False, view_img=False, weights='yolov5s.pt')
YOLOv5 🚀 v5.0-60-ge2a80c6 torch 1.8.1 CPU

Fusing layers... 
Model Summary: 224 layers, 7266973 parameters, 0 gradients
1/1: http://youtu.be/gmklhuYYL1k...  success (1280x720 at 29.97 FPS).

0: 384x640 5 persons, 3 chairs, 2 potted plants, 1 tv, 1 laptop, Done. (0.224s)
0: 384x640 6 persons, 3 chairs, 2 potted plants, 1 tv, 3 laptops, Done. (0.204s)
0: 384x640 6 persons, 5 chairs, 3 potted plants, 2 laptops, Done. (0.210s)
0: 384x640 3 persons, 3 chairs, 3 potted plants, 1 laptop, Done. (0.202s)
0: 384x640 3 persons, 4 chairs, 2 potted plants, 2 laptops, Done. (0.237s)

Screenshot 2021-05-03 at 12 06 27

@glenn-jocher glenn-jocher linked a pull request May 3, 2021 that will close this issue
@glenn-jocher
Copy link
Member

glenn-jocher commented May 3, 2021

@PhilPark-geosr good news 😃! A related issue to your original issue may now been fixed ✅ in #3018 allowing YouTube inference in Google Colab instances. To receive this update you can:

  • git pull from within your yolov5/ directory
  • git clone https://github.com/ultralytics/yolov5 again
  • Force-reload PyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • View our updated notebooks: Open In Colab Open In Kaggle

Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

Screenshot 2021-05-03 at 12 38 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants