YoloV5 with LI-AR0820-GMSL2-XAVIER gmsl2 camera

Hello.
I was trying to use LI-AR0820-GMSL2-XAVIER gmsl2 camera on YOLO V5.
I installed the driver correctly and I can see the output:

zacharyzhang@tegra-ubuntu:~$ ls /dev/video0
/dev/video0

and:

zacharyzhang@tegra-ubuntu:~$ v4l2-ctl --list-devices
vi-output, ar0820 30-0010 (platform:15c10000.vi:0):
/dev/video0

vi-output, ar0820 31-0010 (platform:15c10000.vi:2):
/dev/video1

vi-output, ar0820 32-0010 (platform:15c10000.vi:4):
/dev/video2

vi-output, ar0820 33-0010 (platform:15c10000.vi:5):
/dev/video3

However, when I try to run yolov5, it gives me the error:

zacharyzhang@tegra-ubuntu:~/apexy-project$ python3 detect.py --source 0

detect: weights=best.pt, source=0, data=data/dagm.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=0, 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 🚀 5e23b2b torch 1.10.0 CUDA:0 (Xavier, 31921MiB)

Fusing layers... 
Model Summary: 213 layers, 1772695 parameters, 0 gradients, 4.2 GFLOPs
[ WARN:0@15.570] global /io/opencv/modules/videoio/src/cap_v4l.cpp (1910) getProperty VIDEOIO(V4L2:/dev/video0): Unable to get camera FPS
[ WARN:0@28.849] global /io/opencv/modules/videoio/src/cap_v4l.cpp (1000) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
1/1: 0...  Success (inf frames 3840x2160 at 99.00 FPS)

Traceback (most recent call last):
  File "detect.py", line 257, in <module>
    main(opt)
  File "detect.py", line 252, in main
    run(**vars(opt))
  File "/home/zacharyzhang/.local/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 105, in run
    dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt)
  File "/home/zacharyzhang/apexy-project/utils/datasets.py", line 323, 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/zacharyzhang/apexy-project/utils/datasets.py", line 323, 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/zacharyzhang/apexy-project/utils/augmentations.py", line 93, in letterbox
    shape = im.shape[:2]  # current shape [height, width]
AttributeError: 'NoneType' object has no attribute 'shape'

Any help would be really appreciated!

Hi,

Is it a CSI camera?
It seems that the python script tries to open the camera with the v4l2 interface, which is used for USB cameras.

Thanks.

Hello, This is the GMSL2 camera.

Hi,

Have you tried to open the camera with gst-launch-1.0?
If yes, could you share the command with us?

Thanks.

Yes. NVM I got it solved. Seems like the windows size problem