ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
51.17k stars 16.43k forks source link

A bug about process youtube video #2806

Closed josenxx closed 3 years ago

josenxx commented 3 years ago

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. I try to do object detection on a youtube video

To Reproduce (REQUIRED)

Input:

Install pytorch nightly version
and run
python detect.py --source https://www.youtube.com/watch?v=1HmGLV46L60&t=6s&ab_channel=EconomicsExplained

any youtube video should work. I just use one from recommendation.

Output:

(base) xiaorui@xiaorui-X570-GAMING-X:~/yolov5$ python detect.py --source https://www.youtube.com/watch?v=1HmGLV46L60&t=6s&ab_channel=EconomicsExplained
[1] 7778
[2] 7779
(base) xiaorui@xiaorui-X570-GAMING-X:~/yolov5$ WARNING: CPU random generator seem to be failing, disabling hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff
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', nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='https://www.youtube.com/watch?v=1HmGLV46L60', update=False, view_img=False, weights='yolov5s.pt')
YOLOv5 🚀 v5.0-9-ge5d7122 torch 1.9.0.dev20210415+cu111 CUDA:0 (GeForce RTX 3090, 24265.1875MB)

Fusing layers... 
/home/xiaorui/miniconda3/lib/python3.8/site-packages/thop/vision/basic_hooks.py:31: UserWarning: Legacy tensor constructor is deprecated. Use: torch.tensor(...) for creating tensors from tensor-like objects; or torch.empty(...) for creating an uninitialized tensor with specific sizes. (Triggered internally at  /pytorch/torch/csrc/utils/tensor_new.cpp:478.)
  m.total_ops += torch.DoubleTensor([int(total_ops)])
Model Summary: 224 layers, 7266973 parameters, 0 gradients, 17.0 GFLOPS
1/1: https://www.youtube.com/watch?v=1HmGLV46L60...  success (1280x720 at 25.00 FPS).

^C
[1]-  Segmentation fault      (core dumped) python detect.py --source https://www.youtube.com/watch?v=1HmGLV46L60
[2]+  Done                    t=6s

Expected behavior

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

Should print out outputs but it just stuck there forever.

Environment

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here. I have a working installation.

(base) xiaorui@xiaorui-X570-GAMING-X:~/yolov5$ python detect.py WARNING: CPU random generator seem to be failing, disabling hardware random number generation WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff 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', nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='data/images', update=False, view_img=False, weights='yolov5s.pt') YOLOv5 🚀 v5.0-9-ge5d7122 torch 1.9.0.dev20210415+cu111 CUDA:0 (GeForce RTX 3090, 24265.1875MB)

Fusing layers... /home/xiaorui/miniconda3/lib/python3.8/site-packages/thop/vision/basic_hooks.py:31: UserWarning: Legacy tensor constructor is deprecated. Use: torch.tensor(...) for creating tensors from tensor-like objects; or torch.empty(...) for creating an uninitialized tensor with specific sizes. (Triggered internally at /pytorch/torch/csrc/utils/tensor_new.cpp:478.) m.total_ops += torch.DoubleTensor([int(total_ops)]) Model Summary: 224 layers, 7266973 parameters, 0 gradients, 17.0 GFLOPS image 1/2 /home/xiaorui/yolov5/data/images/bus.jpg: 640x480 4 persons, 1 bus, 1 fire hydrant, Done. (0.011s) image 2/2 /home/xiaorui/yolov5/data/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.010s) Results saved to runs/detect/exp14 Done. (0.069s) I also can process video if I download it.

github-actions[bot] commented 3 years ago

👋 Hello @josenxx, 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.

glenn-jocher commented 3 years ago

@josenxx I'm not sure about nightly, but I'm able to run your command correctly with mac-os and pytorch 1.8.1, though I need to add a colon to each side of the url in my command:

python detect.py --source 'https://www.youtube.com/watch?v=1HmGLV46L60'
Screen Shot 2021-04-16 at 5 55 58 PM
josenxx commented 3 years ago

It should be a problem becasue I can download the video and process it. You can close the issue