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.

'module' has no 'readNet'

See original GitHub issue

hi,

i’m trying to use yolo but when i use the command $ python yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt

i get the following error

Traceback (most recent call last):
  File "yolo_opencv.py", line 57, in <module>
    net = cv2.dnn.readNet(args.weights, args.config)
AttributeError: 'module' object has no attribute 'readNet'

i’m using python 2.7.12

if I use python 3 $ python3 yolo_opencv.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt i get this error

Traceback (most recent call last):
  File "yolo_opencv.py", line 8, in <module>
    import cv2
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type

how can i solve this error? (both would be nice, i would like to use python3 if it’s possible)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:33 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
trantuanvu1602commented, Apr 12, 2019

modify cv2.dnn.readNet to cv2.dnn.readNetFromDarknet

3reactions
hunaidkhan2000commented, Aug 14, 2019

Use pip install opencv-python==4.0.0.21 should resolve your issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

cv2.dnn' has no attribute 'readNet' using python 3.6 and ...
So, I tried pip uninstall opencv-python then pip install opencv-python and now I have the newest one (4.x) and cv2.dnn.readNet is now recognized ......
Read more >
dnn, python3.6, cv3.4.1 object_detection error edit
readNet (args.model, args.config, args.framework) AttributeError: module 'cv2.dnn' has no attribute 'readNet' I can solve this by replacing ...
Read more >
'module' object has no attribute 'readNet' Code Example
Answers related to “'module' object has no attribute 'readNet'”. AttributeError: module 'tensorflow' has no attribute 'GraphDef' ...
Read more >
openvivo 2022.1 (pip install) run cv.dnn.readNet error
Download and install this OpenCV: Win pack with dnn module accelerated by ... OpenVINO from pip does not include OpenCV built with OpenVINO...
Read more >
Sumolib - SUMO Documentation
sumolib is a set of python modules for working with sumo networks, ... The following named arguments may be given to the readNet...
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