解决yolov7/detect.py中调用摄像头进行识别时报错“ TypeError: argument of type ‘int‘ is not iterable”

1.报错位置
Traceback (most recent call last):
File “D:/yolo/yolov7/detect.py”, line 184, in
detect()
File “D:/yolo/yolov7/detect.py”, line 55, in detect
dataset = LoadStreams(source, img_size=imgsz, stride=stride)
File “D:\yolo\yolov7\utils\datasets.py”, line 285, 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
解决yolov7/detect.py中调用摄像头进行识别时报错“ TypeError: argument of type ‘int‘ is not iterable”_第1张图片
2.意思是说这个参数数据类型不是可迭代对象,代码中可看出是一个str的数据类型,所以应该将变量url转化为一个字符串类型,更改如下:

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

解决yolov7/detect.py中调用摄像头进行识别时报错“ TypeError: argument of type ‘int‘ is not iterable”_第2张图片
3.完美运行
解决yolov7/detect.py中调用摄像头进行识别时报错“ TypeError: argument of type ‘int‘ is not iterable”_第3张图片

你可能感兴趣的:(深度学习,目标检测,笔记,python)