Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Can';t打开prototxt_Python_Opencv_Deep Learning_Face Detection - Fatal编程技术网

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")