Can't open "deploy.prototxt.txt," in function 'cv::dnn::ReadProtoFromTextFile'
I was just starting working on this OpenCV tutorial, and can't even get past the first part :<
Downloaded all the files. Opened detect_faces.py in PyCharm, followed the instructions here for using arguments in PyCharm. Inserted "-i rooster.jpg, -p deploy.prototxt.txt, -m res10_300x300_ssd_iter_140000.caffemodel" into Parameters field and tried running it, but it threw an error:
net = cv2.dnn.readNetFromCaffe(args["prototxt"], args["model"])
cv2.error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "deploy.prototxt.txt," in function 'cv::dnn::ReadProtoFromTextFile'
this is the first part of the py file:
import numpy as np
import argparse
import cv2
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to input image")
ap.add_argument("-p", "--prototxt", required=True,
help="path to Caffe 'deploy' prototxt file")
ap.add_argument("-m", "--model", required=True,
help="path to Caffe pre-trained model")
ap.add_argument("-c", "--confidence", type=float, default=0.5,
help="minimum probability to filter weak detections")
args = vars(ap.parse_args())
not sure what the issue is... Any help is appreciated.
believe the error msg. it never found that file.
try to do without pycharm (from a plain cmdline), as you have to supply cmdline args, and you're probably dealing with relative paths
@berak but everything's in one folder, why wouldn't it be finding it? I actually wanted to make this so it can be run from GitHub or somewhere, so I would need to do something about the arguments anyways, right? Since there won't be a cmd for them to run from.
there won't be no pycharm either ;)
Running the same model and .prototxt, found that if you're running from Windows, the OS appends .txt to the file name. When running with --model=deploy.prototxt.txt, it worked
^^ well, probably
--prototxt
, not--model
, right ?and no, i cannot side your findings.
--prototxt=deploy.prototxt, indeed. Thanks for pointing out the mistake!
you must add path likeeeee d:/deploy.prototxt.txt behind the (--prototxt)