question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to execute object_detection

See original GitHub issue

As of rather recently I am unable to use object_detection, whereas everything else seems to work rather fine. It boils down to that error message:

Traceback (most recent call last):#################################################################################### |
  File "detector_mine.py", line 35, in <module>
    bbox, label, conf = cv.detect_common_objects(rect_img, confidence=0.75, enable_gpu=True')
  File "/home/user/.local/lib/python3.8/site-packages/cvlib/object_detection.py", line 135, in detect_common_objects
    outs = net.forward(get_output_layers(net))
  File "/home/user/.local/lib/python3.8/site-packages/cvlib/object_detection.py", line 29, in get_output_layers
    output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()]
  File "/home/user/.local/lib/python3.8/site-packages/cvlib/object_detection.py", line 29, in <listcomp>
    output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()]
IndexError: invalid index to scalar variable.

It runs fine on my old Win10/11 installation from a couple of months ago, however accessing the same script from a WSL machine on the exact same PC results in the error above. I’m also getting the same from a new macOS setup.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Greg-Kojadinovichcommented, Apr 7, 2022

Hello, this issue still exists, I ran into it today. I followed tomgit-com and mihaipanait’s comments and it worked. Thank you for the direction.

1reaction
arunponnusamycommented, Nov 21, 2021

I think there are some changes in the latest OpenCV version. Try using with older opencv version for now. Will fix this soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to execute the Detect Objects Using Deep Learning ...
When working with deep learning models in ArcGIS Pro, attempting to run the Detect Objects Using Deep Learning tool fails and returns the ......
Read more >
Unable to Use a Folder of Images to Execute Object Detection ...
Execute the following command to perform object detection with input of images in the folder: python object_detection_demo.py -at ssd -m <path_to_model> -i ...
Read more >
Unable to Run Object Detection Training · Issue #171 - GitHub
When I try to run object detection training, I get this error. I'm using Python 3.8.7 on a 16" MacBook Pro running macOS...
Read more >
Unable to run object detection code on Colab - Stack Overflow
You might want to double check if this is expected. WARNING [08/23 15:10:22 fvcore.common.checkpoint]: Skip loading parameter 'backbone.
Read more >
Unable to create YOLO detector for model yolov5m : r/BlueIris
Also, you may want to disable unused modules in Sense AI's dashboard - you only need Object Detection.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found