Ask Your Question

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

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

I was just starting working on this OpenCV tutorial, and can't even get past the first part :<

Downloaded all the files. Opened 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


believe the error msg. it never found that file.

berak gravatar imageberak ( 2018-12-05 16:32:36 -0500 )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 -0500 )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 -0500 )edit

there won't be no pycharm either ;)

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

1 answer

Sort by ยป oldest newest most voted

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

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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


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

Seen: 37 times

Last updated: Dec 07