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

invalid index to scalar variable #104

Open
simin75simin opened this issue Nov 19, 2021 · 2 comments
Open

invalid index to scalar variable #104

simin75simin opened this issue Nov 19, 2021 · 2 comments

Comments

@simin75simin
Copy link

i tried running it and got the following error.

╰─$ py opencv_dnn_infer.py --img-path /home/<name>/Pictures/Webcam/2021-11-12-101657.jpg 
Traceback (most recent call last):
  File "opencv_dnn_infer.py", line 117, in <module>
    run_on_video(Net, video_path, conf_thresh=0.5)
  File "opencv_dnn_infer.py", line 89, in run_on_video
    img_raw = inference(Net, img_raw, target_shape=(260, 260), conf_thresh=conf_thresh)
  File "opencv_dnn_infer.py", line 47, in inference
    y_bboxes_output, y_cls_output = net.forward(getOutputsNames(net))
  File "opencv_dnn_infer.py", line 41, in getOutputsNames
    return [layersNames[i[0] - 1] for i in net.getUnconnectedOutLayers()]
  File "opencv_dnn_infer.py", line 41, in <listcomp>
    return [layersNames[i[0] - 1] for i in net.getUnconnectedOutLayers()]
IndexError: invalid index to scalar variable.

help plz.

@simin75simin
Copy link
Author

nvm somehow i is a scalar now so just remove the [0]

@aa389393
Copy link

Why I need to remove [0] in windows 10, but in Jetson TX2 some devices need to remove some don't need remove.

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

2 participants