-1

I ran detect.py in YOLOv5-5.0 and it shown me this. How can I fix it?

Here is the problem:

Traceback (most recent call last):
  File "F:\python_yolov5\yolov5-5.0\detect.py", line 178, in <module>
    detect()
  File "F:\python_yolov5\yolov5-5.0\detect.py", line 61, in detect
    model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters())))  # run once
  File "F:\anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "F:\python_yolov5\yolov5-5.0\models\yolo.py", line 123, in forward
    return self.forward_once(x, profile)  # single-scale inference, train
  File "F:\python_yolov5\yolov5-5.0\models\yolo.py", line 139, in forward_once
    x = m(x)  # run
  File "F:\anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "F:\python_yolov5\yolov5-5.0\models\yolo.py", line 55, in forward
    y[..., 2:4] = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i]  # wh
RuntimeError: The size of tensor a (80) must match the size of tensor b (56) at non-singleton dimension 3
GOINOG
  • 11
  • 1
  • 1
  • I’m voting to close this question because it's not a programming question. Rather, it's a question about details about a specific deep network (YOLOv5). First understand that network, then come back with specific *programming questions* if you still have trouble implementing the network. Good luck. – gspr Mar 14 '22 at 21:03
  • Please keep in mind to provide your code and enough details so others can better help you. – Shayan Mar 14 '22 at 21:48

1 Answers1

0

Download the file at this link: https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt

replace default downloaded file(v6.1)---yolov5s.pt

then run detect.py. and it will be OK!