The code is as below:
def load_model():
modelFile = 'res10_300x300_ssd_iter_140000_fp16.caffemodel'
configFile = 'deploy.prototxt.txt'
#modelFile = " C:/Users/roys21/streamlit-face-detect/res10_300x300_ssd_iter_140000_fp16.caffemodel"
#configFile = " C:/Users/roys21/streamlit-face-detect/deploy.prototxt.txt"
net = cv2.dnn.readNetFromCaffe(configFile, modelFile)
return net
and it throws the below error:
error: OpenCV(4.5.2) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-_8k9tw8n\opencv\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open " C:/Users/roys21/streamlit-face-detect/deploy.prototxt.txt" in function 'cv::dnn::ReadProtoFromTextFile'
I have checked the path exists:
import os
assert os.path.exists("C:/Users/roys21/streamlit-face-detect/deploy.prototxt.txt")
assert os.path.exists("deploy.prototxt.txt")
Any help would be appreciated. Thanks.