if ‘youtube.com/‘ in url or ‘youtu.be/‘ in url:TypeError: argument of type ‘int‘ is not iterable

 使用jetson agx xavier测试训练yolo5.6,得到权重文件pt模型使用USB摄像头测试报错

python3 detect.py --weights runs/train/exp16/weights/best.pt --source 0
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-q3eugw7s because the default path (/home/nvidia/.cache/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='0', update=False, view_img=False, weights=['runs/train/exp16/weights/best.pt'])
YOLOv5 v5.0-0-gf5b8f7d5 torch 1.9.0 CUDA:0 (Xavier, 31928.53515625MB)

Fusing layers...
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  /media/nvidia/NVME/pytorch/pytorch-v1.9.0/c10/core/TensorImpl.h:1156.)
  return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
Model Summary: 392 layers, 47025981 parameters, 0 gradients, 115.3 GFLOPS
Xlib:  extension "RANDR" missing on display "localhost:10.0".
1/1: 0... Traceback (most recent call last):
  File "detect.py", line 178, in
    detect()
  File "detect.py", line 51, in detect
    dataset = LoadStreams(source, img_size=imgsz, stride=stride)
  File "/home/nvidia/yolov5/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

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

将219行改成如上即可

if ‘youtube.com/‘ in url or ‘youtu.be/‘ in url:TypeError: argument of type ‘int‘ is not iterable_第1张图片 

 

 参考过另外一个方法对我这个没生效,你不介意的话可以看下(2条消息) 【目标检测】YOLOv5 5.0调用摄像头报错的处理_Cul_accino的博客-CSDN博客_yolo检测调用摄像头fps

下一篇试下加速 

你可能感兴趣的:(torch,Jetson,nvidia,python)