Cv2.dnn.readnetfromcaffe error

I’m doing this code for person detection and using python 3.7 version

protopath = "model_files/MobileNetSSD_deploy.prototxt"
modelpath = "model_files/MobileNetSSD_deploy.caffemodel"
detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)

recommendation showing is:

You need configured Python 2 SDK to render <a 
href='http://epydoc.sourceforge.net/'>Epydoc</a> docstrings

error showing is:

 detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
 cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build- 
 oduouqig\opencv\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) 
 FAILED: fs.is_open(). Can't open "model_files/MobileNetSSD_deploy.prototxt" in function 
 'cv::dnn::ReadProtoFromTextFile'

what is it exactly, you don’t understand about the error msg ?

it did not find the file. full stop.

find out where your python script starts (esp, if using some fancy IDE, it might do something unexpected there !), and see, if the relative path from there to the data is correct
(use an absolute path, if nessecary).

that’s admittedly confusing, but not from opencv, unrelated here (where would such a recommendation even come from ?).
(seems to be a pycharm problem, we cannot help)

1 Like