'Error "face_detector\deploy.prototxt" in function 'cv::dnn::ReadProtoFromTextFile'

currently, I'm trying to learn python by applying mask detection, to detect someone used a mask or not.

when I run this code

maskNet = load_model("mask_detector.model")

print ("[INFO] starting video stream..")
vs = VideoStream(src=0).start()

while True:
    frame = vs.read()
    frame = imutils.resize(frame,width=400)
    
    (locs,preds) = detect_and_predict_mask(frame,faceNet,maskNet)
    
    for (box,pred) in zip (locs,preds):
        (startX,startY,endX,endY) = box
        (mask,withoutMask) = pred
        
        label = "Mask" if mask > withoutMask else "No Mask"
        color = (0,255,0) if label == "Mask" else (0,0,255)
        
        label = "{}: {:.2f}%".format(label,max(mask,withoutMask)*100)
        
        
        cv2.putText (frame,label,(startX,startY - 10),
                    cv2.FONT_HERSHEY_SIMPLEX,0.45,color,2)
        cv2.rectangle(frame,(startX,startY),(endX,endY),color,2)
        
    cv.imshow("Frame",frame)
    key = cv2.waitKey(1) & 0xFF
    
    if key == ord("q"):
        break
        
cv2.destroyAllWindows()
vs.stop() 

I'm getting

OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1126: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "face_detector\deploy.prototxt" in function 'cv::dnn::ReadProtoFromTextFile'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source