detect() File "H:\Pych_yolov5推理打不开">
当前位置:   article > 正文

YOLOV5 打开摄像头错误:TypeError: argument of type ‘int‘ is not iterable_yolov5推理打不开摄像头

yolov5推理打不开摄像头

问题描述

 parser.add_argument('--source', type=str, default='0', help='source')  # file/folder, 0 for webcam
  • 1

发现打开摄像头出错

Traceback (most recent call last):
  File "H:\PycharmProject\yolov5-5.0\detect.py", line 198, in <module>
    detect()
  File "H:\PycharmProject\yolov5-5.0\detect.py", line 51, in detect
    dataset = LoadStreams(source, img_size=imgsz, stride=stride)
  File "H:\PycharmProject\yolov5-5.0\utils\datasets.py", line 279, in __init__
    if 'youtube.com/' in url or 'youtu.be/' in url:  # if source is YouTube video
TypeError: argument of type 'int' is not iterable

Process finished with exit code 1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

解决方案:

if 'youtube.com/' in url or 'youtu.be/' in url:  # if source is YouTube video
  • 1

修改为字符串型:

  if 'youtube.com/' in str(url) or 'youtu.be/' in str(url):  # if source is YouTube video
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/888918
推荐阅读
相关标签
  

闽ICP备14008679号