yolov5中遇到这个'int' object has no attribute 'endswith'

img


yolov5中运行遇到这种错误,查找一些资料后仍然不知道怎么改动,还望各位指点。

endwith是用来判断字符串的,但是你传入的source确实int整数,也就是对应的opt.source就传错了
https://www.runoob.com/python/att-string-endswith.html

我刚刚也遇到了...
报错代码:parser.add_argument('--source', type=str, default=0, help='source') # file/folder, 0 for webcam
修改: parser.add_argument('--source', type=str, default='0', help='source') # file/folder, 0 for webcam

你的source是整型而不是字符串,你是不是哪个地方写错了