How to fix OpenCV error FAILED: fs.is_open()

asked 2019-06-03 09:18:58 -0500

katmcg gravatar image

updated 2019-06-03 10:07:07 -0500

I am working on a jetson nano using pycharm and realsense2 library, trying to compile a code that uses numpy, pyrealsense2, cv2 and matplotlib and cv2 keeps causing errors.

The compiler says that there is no module for cv2 in the import line, but when the code is run no error is thrown there, the error occurs much later in the code:

net = cv2.dnn.readNetFromCAFFE("MobileNetSSD_deploy.prototxt", "MobileNetSSD_deploy.caffemodel") AttributeError: module 'cv2.dnn' has no attribute 'readNetFromCAFFE'

what is wrong? how i downloaded the library? is it out of date? please help

UPDATE: fixed capitalisation and now this error is thrown:

OpenCV Error: Unspecified error (FAILED: fs.is_open(). Can't open "MobileNetSSD_deploy.prototxt") in ReadProtoFromTextFile, file /home/nvidia/build_opencv/opencv/modules/dnn/src/caffe/caffe_io.cpp, line 1113 Traceback (most recent call last): File "/home/ihub/documents/projects_pycharm/", line 81, in <module> net = cv2.dnn.readNetFromCaffe("MobileNetSSD_deploy.prototxt", "MobileNetSSD_deploy.caffemodel") cv2.error: /home/nvidia/build_opencv/opencv/modules/dnn/src/caffe/caffe_io.cpp:1113: error: (-2) FAILED: fs.is_open(). Can't open "MobileNetSSD_deploy.prototxt" in function ReadProtoFromTextFile

edit retag flag offensive close merge delete



doc is here There is function cv2.dnn.readNetFromCAFFE

give full path in parameters

LBerger gravatar imageLBerger ( 2019-06-03 09:55:46 -0500 )edit

@LBerger thanks for the response! the parameters were not the issue- it was not recongized properly due to capitals, I've updated my question with the new error

katmcg gravatar imagekatmcg ( 2019-06-03 10:02:45 -0500 )edit