Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

dnn, python3.6, cv3.4.1 object_detection error

System information (version)
  • OpenCV => 3.4.1
  • Operating System / Platform => Windows 64 Bit
  • Python=>3.6
Detailed description

I have Opencv 3.4.1 installed using pip by downloading a wheel file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

pip install opencv_python-3.4.1-cp36-cp36m-win_amd64.whl

pip install opencv_python-3.4.1+contrib-cp36-cp36m-win_amd64.whl

When I print the the version of the cv2 inside the script I got 3.4.1, but I can't rund the code of object_detection because of the following errors:

print(cv.__version__)

1.

Traceback (most recent call last):
File "object_detection.py", line 52, in <module>
net = cv.dnn.readNet(args.model, args.config, args.framework)
AttributeError: module 'cv2.dnn' has no attribute 'readNet'

I can solve this by replacing readNet with readNetFromCaffe while I use Caffe model . The moest weird thing is, when I go to the source of cv2/dnn.py I can't see the readNet() function!

2.

Traceback (most recent call last):
File "object_detection.py", line 155, in <module>
if net.getLayer(0).outputNameToIndex('im_info') != -1:  # Faster-RCNN or R-FCN
AttributeError: 'cv2.dnn_Layer' object has no attribute 'outputNameToIndex'

But I couldn't fix this one!

Anyone an idea why I can't find readNet()? while I have the latest version of opencv.

I have also built Opencv3.4.1 from source on Ubuntu and I still can't find the readNet() function!

click to hide/show revision 2
retagged

updated 2018-04-06 02:11:03 -0600

berak gravatar image

dnn, python3.6, cv3.4.1 object_detection error

System information (version)
  • OpenCV => 3.4.1
  • Operating System / Platform => Windows 64 Bit
  • Python=>3.6
Detailed description

I have Opencv 3.4.1 installed using pip by downloading a wheel file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

pip install opencv_python-3.4.1-cp36-cp36m-win_amd64.whl

pip install opencv_python-3.4.1+contrib-cp36-cp36m-win_amd64.whl

When I print the the version of the cv2 inside the script I got 3.4.1, but I can't rund the code of object_detection because of the following errors:

print(cv.__version__)

1.

Traceback (most recent call last):
File "object_detection.py", line 52, in <module>
net = cv.dnn.readNet(args.model, args.config, args.framework)
AttributeError: module 'cv2.dnn' has no attribute 'readNet'

I can solve this by replacing readNet with readNetFromCaffe while I use Caffe model . The moest weird thing is, when I go to the source of cv2/dnn.py I can't see the readNet() function!

2.

Traceback (most recent call last):
File "object_detection.py", line 155, in <module>
if net.getLayer(0).outputNameToIndex('im_info') != -1:  # Faster-RCNN or R-FCN
AttributeError: 'cv2.dnn_Layer' object has no attribute 'outputNameToIndex'

But I couldn't fix this one!

Anyone an idea why I can't find readNet()? while I have the latest version of opencv.

I have also built Opencv3.4.1 from source on Ubuntu and I still can't find the readNet() function!