遇到 OpenCV 边缘检测错误

问题描述

我正在尝试实现人脸边缘检测。但是,我不断遇到的错误如下:

File "/home/<username>/Documents/carm/stage1.py",line 68,in <module>
    net = cv2.dnn.readNetFromCaffe(protoPath,modelPath)
cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-ddpkm6fn/opencv/modules/dnn/src/caffe/caffe_io.cpp:1121: error: (-2:Unspecified error) Failed: fs.is_open(). Can't open "hed_model/deploy.prototxt" in function 'ReadProtoFromTextFile'

我不确定我哪里出错了。我使用的代码与我从该网站获得的代码基本相同:

https://www.pyimagesearch.com/2019/03/04/holistically-nested-edge-detection-with-opencv-and-deep-learning/

这是代码的一部分:

print("[INFO] loading edge dectector...")
protoPath = os.path.sep.join([args["edge_detector"],"deploy.prototxt"])
modelPath = os.path.sep.join([args["edge_detector"],"hed_pretrained_bsds.caffemodel"])
net = cv2.dnn.readNetFromCaffe(protoPath,modelPath)

我将不胜感激任何有助于解决此问题的意见。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)