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 #2

Open
talzich opened this issue Mar 21, 2022 · 1 comment
Open

Invalid index to scalar variable #2

talzich opened this issue Mar 21, 2022 · 1 comment

Comments

@talzich
Copy link

talzich commented Mar 21, 2022

Hello!
Thank you for these elaborate and clear notebooks and resources.

When running the code I get the following error:

IndexError: invalid index to scalar variable

After examination, the error originates at convert_to_blob function in line:
outputLayers = [(yoloLayers[i[0]-1]) for i in network.getUnconnectedOutLayers()]

Debugging the code using Pycharm leads me to believe variable i is simply a scalar (int32).
The function getUnconnectedOutLayers, according to __doc__ "Returns indexes of layers with unconnected outputs".

After converting i[0] to simply i I get recognition, but a very poor one.
It is not the first time I come across this issue in a yolo project and I am not sure I am doing everything right.
Is there something I'm missing?

@semanurbilada
Copy link

semanurbilada commented May 30, 2022

I have the same problem for a project about yolov3, on the internet I found some solutions for this like, removing the [0] index in the next to i, but it's not working, and there are no other solutions or debug for this one...
I'm really curious about the solution, too!
So if you ever find anything, let me know, please.

Edit: I fixed the problem. But, my solution depends on your OS. Which one you're trying to run with this project. For example, I was using MacBook, but then I tried to run with windows and it worked.
Delete the [0] index and try to run with Windows if you're using a Mac.
I hope, this could be helpful.

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