【发布时间】:2020-09-17 03:41:55
【问题描述】:
当我尝试运行此代码时,为什么会收到错误 `AttributeError: module 'cv2' has no attribute 'dnn_DetectionModel':
# get the weight configurations
configPath =
'/Users/Rodne/MyComputerVision/Folder3/ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt'
weightsPath = '/Users/Rodne/MyComputerVision/Folder3/frozen_inference_graph.pb'
# setting the bounding box
net = cv2.dnn_DetectionModel(weightsPath, configPath)
net.setInputSize(320, 320)
错误
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-355122b5b70e> in <module>()
1 # setting the bounding box
----> 2 net = cv2.dnn_DetectionModel(weightsPath, configPath)
3 net.setInputSize(320, 320)
AttributeError: module 'cv2' has no attribute 'dnn_DetectionModel'
我已经通过在终端中输入以下内容升级了我的开放式简历:pip install opencv-python --upgrade
这就是结果
Collecting opencv-python
Downloading opencv_python-4.4.0.42-cp37-cp37m-win_amd64.whl (33.5 MB)
|████████████████████████████████| 33.5 MB 54 kB/s
Requirement already satisfied, skipping upgrade: numpy>=1.14.5 in d:\anaconda\lib\site-packages (from opencv-python) (1.18.5)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.4.0.42
【问题讨论】: