SystemError: <class 'cv2.dnn_DetectionModel'> returned a result with an error set

Viewed 6592

This is the code used.

configpath = 'ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt'
weigthpath = 'frozen_inference_graph.pb'

net = cv2.dnn_DetectionModel(weigthpath, configpath)

Picture of error

1 Answers

There's wrong with your files. I also have the same error. I solved it.

I solved it by replacing the ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt and frozen_inference_graph.pb files with the files that are downloaded from OpenCV documentation. If you fail to found them in OpenCV documentation, I can provide them for you.

i also got this problem during my project work(in eclipse IDE). i found work around that,

Both files must be in your project folder

if both files in project folder and still not solve than try open with any editor you are using in my case it is sublime and notepad, means you have to set default file opener for *.pb and *.pbtxt.

it solved error: <class 'cv2.dnn_DetectionModel'> returned a result with an error set.

after solving this error, if(and only if) you get this,

error: (-2:Unspecified error) Can't create layer "FeatureExtractor/MobilenetV3/Conv/hard_swish/add" of type "AddV2" in function 'cv::dnn::dnn4_v20191202::LayerData::getLayerInstance'

Than upgrade your opencv,

pip install --upgrade opencv-python

in case you want to Download Files.

Related