Hey all,
I’m trying to put yolov5 on the Jetson, but can’t get it to run. Specifically, I’m trying to use it with a CSI camera, which requires that the code be changed.
To install the yolov5 repo and dependencies, I entered commands from this guide:
git clone https://github.com/ultralytics/yolov5.git
cd yolov5
export OPENBLAS_CORETYPE=ARMV8
sudo apt install libfreetype6-dev python3-dev
sudo pip3 install numpy==1.19.4
sudo pip3 install --ignore-installed PyYAML>=5.3.1
sudo pip3 install -r requirements.txt
I updated the code according to these sources to try to get it to work:
Despite this, I’m getting an error. Here’s the stack trace:
MyProject@MyProject-desktop:~/Desktop/yolov5$ python3 detect.py --source=0
/usr/local/lib/python3.6/dist-packages/torchvision/io/image.py:11: UserWarning: Failed to load image Python extension:
warn(f"Failed to load image Python extension: {e}")
detect: weights=yolov5s.pt, source=0, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 🚀 v6.1-21-ge6e36aa torch 1.10.2 CPU
Fusing layers...
Model Summary: 213 layers, 7225885 parameters, 0 gradients, 16.5 GFLOPs
[ WARN:0@27.567] global /io/opencv/modules/videoio/src/cap_v4l.cpp (1910) getProperty VIDEOIO(V4L2:/dev/video0): Unable to get camera FPS
[ WARN:0@37.616] global /io/opencv/modules/videoio/src/cap_v4l.cpp (1000) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
1/1: 0... Success (inf frames 3264x2464 at 99.00 FPS)
Traceback (most recent call last):
File "detect.py", line 261, in <module>
main(opt)
File "detect.py", line 256, in main
run(**vars(opt))
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "detect.py", line 109, in run
dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt)
File "/home/MyProject/Desktop/yolov5/utils/datasets.py", line 328, in __init__
s = np.stack([letterbox(x, self.img_size, stride=self.stride, auto=self.auto)[0].shape for x in self.imgs])
File "/home/MyProject/Desktop/yolov5/utils/datasets.py", line 328, in <listcomp>
s = np.stack([letterbox(x, self.img_size, stride=self.stride, auto=self.auto)[0].shape for x in self.imgs])
File "/home/MyProject/Desktop/yolov5/utils/augmentations.py", line 93, in letterbox
shape = im.shape[:2] # current shape [height, width]
AttributeError: 'NoneType' object has no attribute 'shape'
Does anyone know why this might be happening/have any experience running yolo on a Jetson (with a CSI Camera)?