yash42828 / YOLO-object-detection-with-OpenCV

Object detection using YOLO object detector
105 stars 74 forks source link

Index error #4

Open pmarkesinis opened 8 months ago

pmarkesinis commented 8 months ago

When I run the yolo.py for image processing I get the following error:

Traceback (most recent call last):
  File "yolo1.py", line 43, in <module>
    ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]
IndexError: invalid index to scalar variable.

It is happening when doing this:

 # determine only the *output* layer names that we need from YOLO
ln = net.getLayerNames()
ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]

Any idea why?