Python Can';t打开prototxt
这是代码,但我尝试了一切,仍然无法打开它Python Can';t打开prototxt,python,opencv,deep-learning,face-detection,Python,Opencv,Deep Learning,Face Detection,这是代码,但我尝试了一切,仍然无法打开它 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
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)
我没有发现任何有用的东西我被困在这上面好几天了。 这终于对我起作用了
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
os:windows10文件
C:\Users\osama\Desktop\opencv face recognition\face\u detection\u model\deploy.prototxt.txt
是否确实存在?是的,我在没有.txt的情况下尝试过,但不起作用。你能在文本编辑器中打开此文件吗?这条路对吗?也许Windows并没有显示真正的扩展名,它的功能不仅仅是.txt
。您也可以检查print(os.listdir(r“C:\Users\osama\Desktop\opencv face recognition\face\u detection\u model\”)
no我无法在文本编辑器中打开它,但路径已更正我尝试了您的代码,但有一个错误FileNotFoundError:[WinError 3]系统找不到指定的路径:“C:\\Users\\osama\\Desktop\\opencv人脸识别\\人脸检测\\u model\\deploy.prototxt”
from os.path import dirname, join
protoPath = join(dirname(__file__), "deploy.prototxt")
modelPath = join(dirname(__file__), "openCVs_facedetector")