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是整型而不是字符串,你是不是哪个地方写错了