Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #1

Open
Abdullah-144 opened this issue Jan 7, 2022 · 5 comments
Open

Error #1

Abdullah-144 opened this issue Jan 7, 2022 · 5 comments

Comments

@Abdullah-144
Copy link

Great work you did there :)

I am getting an error while running this code, can you please help me.

Opening videos/fire1.mp4 ....
Traceback (most recent call last):
File "yolo.py", line 143, in
start_video(video_path)
File "yolo.py", line 116, in start_video
model, classes, colors, output_layers = load_yolo()
File "yolo.py", line 24, in load_yolo
output_layers = [layers_names[i[0]-1] for i in net.getUnconnectedOutLayers()]
File "yolo.py", line 24, in
output_layers = [layers_names[i[0]-1] for i in net.getUnconnectedOutLayers()]
IndexError: invalid index to scalar variable.

I would be really glad if you could help me in this.
Thank you :)

@peoplecure
Copy link

peoplecure commented Feb 22, 2022

@atulyakumar97 I could not reproduce the results for the same reason.

python3 yolo.py --play_video True --video_path videos/fire1.mp4
Opening videos/fire1.mp4 .... 
Traceback (most recent call last):
  File "yolo.py", line 143, in <module>
    start_video(video_path)
  File "yolo.py", line 116, in start_video
    model, classes, colors, output_layers = load_yolo()
  File "yolo.py", line 24, in load_yolo
    output_layers = [layers_names[i[0]-1] for i in net.getUnconnectedOutLayers()]
  File "yolo.py", line 24, in <listcomp>
    output_layers = [layers_names[i[0]-1] for i in net.getUnconnectedOutLayers()]
IndexError: invalid index to scalar variable.

@djhanove
Copy link

There is an issue with the recent version of OpenCV. I fixed this by downgrading to version 4.5.3.56
pip3 install opencv-python==4.5.3.56

@amolkhade17
Copy link

There is an issue with the recent version of OpenCV. I fixed this by downgrading to version 4.5.3.56 pip3 install opencv-python==4.5.3.56

Not able to downgrade opencv-python. Which version of python need to install

errorDesc.txt

@amolkhade17
Copy link

This worked for me

YOLO Object Detection

python <= 3.7

ln = net.getLayerNames()
ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]
python >3.7

ln = net.getLayerNames()
ln = [ln[i - 1] for i in net.getUnconnectedOutLayers()]

@Ayadh-sukri
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants