title: Error loading YOLOv5 in opencv python, how to solve?
body: <p>I am trying to run people detection from above in opencv with YOLOv5, and I have problems with loading the model. My version of opencv is 4.6.0, and following the tutorial at <a href="https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/#Object-Detection-using" rel="nofollow noreferrer">this link</a> I wrote this code</p>
  <pre><code># hyper parameters
  INPUT_WIDTH = 640  # width of the input for the YOLOv5 network
  INPUT_HEIGHT = 640  # height of the  input for the YOLOv5 network
  SCORE_THRESHOLD = 0.5  # filter low probability classes
  NMS_THRESHOLD = 0.45  # remove overlapping bounding boxes (?)
  CONFIDENCE_THRESHOLD = 0.45  # filter low probability detection
  BLACK = (0, 0, 0)
  BLUE = (255, 178, 50)
  YELLOW = (0, 255, 255)
  classes = []
  person_found = False
  # taking classes names
  class_files = 'yolo/coco.names'
  with open(class_files, 'r') as source:
  classes = source.read().rstrip('\n').split('\n')
  # weights path
  weights = 'yolo/models/yolov5s.onnx'
  net = cv2.dnn.readNet(weights)
  # parameters: image, scale factor, size in form of tuple, mean subtraction, swapRB
  blob = cv2.dnn.blobFromImage(frame, scalefactor=1/255, size=(INPUT_WIDTH, INPUT_HEIGHT), mean=[0, 0, 0], swapRB=True, crop=False)
  net.setInput(blob)
  outputs = net.forward(net.getUnconnectedOutLayersNames())
  </code></pre>
  <p>but when I try to load the model I get this error:</p>
  <pre><code>[ERROR:0@1.622] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp (1021) cv::dnn::dnn4_v20220524::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [Identity]:(onnx_node!Identity_0) from domain='ai.onnx'
  Traceback (most recent call last):
    File &quot;D:\Unitn\Corsi\Computer vision\project\synopsis\main.py&quot;, line 25, in &lt;module&gt;
      bg_frames = find_bg_frames(video, duration, fps)
    File &quot;D:\Unitn\Corsi\Computer vision\project\synopsis\utils.py&quot;, line 152, in find_bg_frames
      people_found = find_people_with_yolo(frame)
    File &quot;D:\Unitn\Corsi\Computer vision\project\synopsis\utils.py&quot;, line 102, in find_people_with_yolo
      net = cv2.dnn.readNetFromONNX(weights)
  cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1040: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20220524::ONNXImporter::handleNode'
  &gt; Node [Identity@ai.onnx]:(onnx_node!Identity_0) parse error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layer.cpp:246: error: (-215:Assertion failed) inputs.size() in function 'cv::dnn::dnn4_v20220524::Layer::getMemoryShapes'
  &gt; 
  </code></pre>
  <p>Can anyone help me in finding the problem?</p>