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/pytho...
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!
you need the latest master branch for this, not the 3.4.1 release (this also means, you have to build from src, and can't rely on easy PIP install)
(yes, you can use readNetFromCaffe readNetFromTorch, etc, but other things, like certain layers might be still missing)
there is no
cv2/dnn.py
what do you mean ?Thanks for your answer! You would expect when the wheel file contains 3.4.1 as a version number, that it has the latest version!
I built yesterday opencv 3.4.1 from source on Ubuntu 16.04, I still can't find readNet().
I am using pycharm as editor. This is what I mean, check screenshot https://imgur.com/a/8ovVC
the PIP version numbers are frozen at the resp. opencv release (which is from febuary)
"I built yesterday opencv 3.4.1 from source" -- this might be the same problem.
It's unbelievable! I have just built it again from the source on Windows 10 using CMake, I still can't access readNet() !
maybe you should switch to git for downloading the src. (you'll also have to do that a few times in the future (bugfixes, updates), and you'd profit from incremental downloads)
What do you mean exactly? I have downloaded it from GitHub using this link https://github.com/opencv/opencv/arch...
@Peshmerge, Perhaps you're looking for 3.4.1-dev that means a state of library after 3.4.1 but before the future release: https://github.com/opencv/opencv/arch.... If you want to use scripts compatible with 3.4.1 you can find them in downloaded source code.