Ask Your Question
0

Can't open "deploy.prototxt.txt," in function 'cv::dnn::ReadProtoFromTextFile'

asked 2018-12-05 14:57:37 -0600

Solarmew gravatar image

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.

edit retag flag offensive close merge delete

Comments

believe the error msg. it never found that file.

berak gravatar imageberak ( 2018-12-05 16:32:36 -0600 )edit

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 gravatar imageberak ( 2018-12-05 16:39:50 -0600 )edit

@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.

Solarmew gravatar imageSolarmew ( 2018-12-05 16:56:13 -0600 )edit

there won't be no pycharm either ;)

berak gravatar imageberak ( 2018-12-05 21:19:51 -0600 )edit

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

DanBrezeanu gravatar imageDanBrezeanu ( 2019-01-14 04:00:07 -0600 )edit

^^ well, probably --prototxt , not --model , right ?

and no, i cannot side your findings.

berak gravatar imageberak ( 2019-01-14 04:12:52 -0600 )edit
1

--prototxt=deploy.prototxt, indeed. Thanks for pointing out the mistake!

DanBrezeanu gravatar imageDanBrezeanu ( 2019-01-14 04:46:16 -0600 )edit
1

you must add path likeeeee d:/deploy.prototxt.txt behind the (--prototxt)

CV_Jay gravatar imageCV_Jay ( 2019-02-03 02:05:53 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-12-07 20:51:18 -0600

Solarmew gravatar image

Turns out I just put commas between the parameters -__________-

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-12-05 14:57:37 -0600

Seen: 16,645 times

Last updated: Dec 07 '18