Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't open prototxt

   protoPath = os.path.sep.join([r"C:\Users\osama\Desktop\opencv-face recognitio\face_detection_model", 
    "deploy.prototxt.txt"])
    modelPath = os.path.sep.join([r"C:\Users\osama\Desktop\opencv-face-recognitio\face_detection_model",
        "res10_300x300_ssd_iter_140000.caffemodel"])
    detector = cv2.dnn.readNetFromCaffe(protoPath, modelPath)

this is the code but i tried everything and is still can't open it

detector = cv2.dnn.readNetFromCaffe(protoPath, modelPath)

error: OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "C:\Users\osama\Desktop\opencv-face-recognitio\face_detection_model\deploy.prototxt.txt" in function 'cv::dnn::ReadProtoFromTextFile

i did't find anything useful

like image 956
Ahmad Cok Avatar asked Oct 23 '25 17:10

Ahmad Cok


1 Answers

I was stuck on this for days. This solution on github worked for me finally.

from os.path import dirname, join

protoPath = join(dirname(__file__), "deploy.prototxt")
modelPath = join(dirname(__file__), "openCVs_facedetector")

os: windows10

like image 197
Saurabh Singh Avatar answered Oct 26 '25 07:10

Saurabh Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!