# Yolov5 detect.py camera issue

**URL:** <https://forum.opencv.org/t/yolov5-detect-py-camera-issue/15800>\
**Category:** Python\
**Tags:** raspberrypi, yolov5\
**Created:** [December 10, 2023, 5:21pm UTC](https://forum.opencv.org/t/yolov5-detect-py-camera-issue/15800 "2023-12-10T17:21:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Caglayan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/caglayan/32/9256_2.png) [@Caglayan](https://forum.opencv.org/u/Caglayan)\
**Post date:** [December 10, 2023, 5:21pm UTC](https://forum.opencv.org/t/yolov5-detect-py-camera-issue/15800/1 "2023-12-10T17:21:02Z")

</div>

When I type nvgstcapture-1.0 into the terminal, the camera opens. Jetson detects the raspberry pi HQ camera. But when I run detect.py I get the following error. How can this be solved ?

YOLOv5 🚀 v7.0-215-ga6659d0 Python-3.8.10 torch-2.1.1 CPU

Fusing layers…  
Model summary: 322 layers, 86180143 parameters, 0 gradients, 203.8 GFLOPs  
[WARN:0@9.055] global cap\_v4l.cpp:2060 getProperty VIDEOIO(V4L2:/dev/video0): Unable to get camera FPS  
[WARN:0@19.102] global cap\_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.  
1/1: 0… success (inf frames 3280x2464 at 99.00 FPS)

Traceback (most recent call last):  
File “detect.py”, line 387, in  
detect\_model.obj\_detection()  
File “detect.py”, line 177, in obj\_detection  
dataset = LoadStreams(source, img\_size=imgsz, stride=stride)  
File “/home/lagari/Desktop/YOLOV5/utils/datasets.py”, line 313, in **init**  
s = np.stack([letterbox(x, self.img\_size, stride=self.stride)[0].shape for x in self.imgs], 0) # shapes  
File “/home/lagari/Desktop/YOLOV5/utils/datasets.py”, line 313, in  
s = np.stack([letterbox(x, self.img\_size, stride=self.stride)[0].shape for x in self.imgs], 0) # shapes  
File “/home/lagari/Desktop/YOLOV5/utils/augmentations.py”, line 113, in letterbox  
shape = im.shape[:2] # current shape [height, width]  
AttributeError: ‘NoneType’ object has no attribute ‘shape’

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [December 10, 2023, 6:10pm UTC](https://forum.opencv.org/t/yolov5-detect-py-camera-issue/15800/2 "2023-12-10T18:10:25Z")

</div>

it’s not a V4L2 device or it’s broken?

not an OpenCV problem or a yolov5 problem **but a raspberry pi problem.**

investigate your issue to determine the root cause. [MRE](https://stackoverflow.com/help/minimal-reproducible-example) helps guide you.

replicate this with guvcview or straight up ffplay/ffmpeg.
