【发布时间】:2020-04-22 03:18:29
【问题描述】:
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
我没有找到任何有用的东西
【问题讨论】:
-
文件
C:\Users\osama\Desktop\opencv-face-recognitio\face_detection_model\deploy.prototxt.txt真的存在吗? -
是的,我在没有 .txt 的情况下尝试过,但不起作用
-
你能在文本编辑器中打开这个文件吗?这条路正确吗?也许 Windows 没有显示真正的扩展名,它不仅仅是
.txt。您也可以查看print( os.listdir(r"C:\Users\osama\Desktop\opencv-face-recognitio\face_detection_model\") ) -
不,我无法在文本编辑器中打开它,但路径正确
-
我试过你的代码但是我有一个错误 FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\osama\\Desktop\\opencv-face-recognitio \\face_detection_model\\deploy.prototxt'
标签: python opencv deep-learning face-detection