YOLOV5 打开摄像头错误:TypeError: argument of type ‘int‘ is not iterable

问题描述

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

发现打开摄像头出错

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

解决方案:

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

修改为字符串型:

  if 'youtube.com/' in str(url) or 'youtu.be/' in str(url):  # if source is YouTube video

你可能感兴趣的:(YOLOv5,python)