'(-2:Unspecified error) Can't create layer "FeatureExtractor/MobilenetV3/Conv/hard_swish/add" of type "AddV2" in function 'getLayerInstance'
I am facing a problem in classIds, confs, bbox = net.detect(img,confThreshold=float0.5)
How to fix it?Please help.
I am trying to run a very simple OpenCV script:
import cv2
img = cv2.imread("index.jpeg")
classNames= []
classFile = 'coco.names'
with open(classFile,'rt') as f:
classNames = f.read().rstrip('\n').split('\n')
configPath = "ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt"
weightsPath = "frozen_inference_graph.pb"
net = cv2.dnn_DetectionModel(weightsPath,configPath)
net.setInputSize(320,320)
net.setInputScale(1.0/ 127.5)
net.setInputMean((127.5, 127.5, 127.5))
net.setInputSwapRB(True)
classIds, confs, bbox = net.detect(img,confThreshold=0.5) #line 19
print(classIds,bbox)
cv2.imshow("Output",img)
cv2.waitKey(0)
Thanks in advance!
Solution 1:[1]
I think upgrading your opencv version up to 4.5 and above, is needed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | gandalf0215 |