Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created November 17, 2020 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/4c17f9f890b375259c961f5524642571 to your computer and use it in GitHub Desktop.
Save amankharwal/4c17f9f890b375259c961f5524642571 to your computer and use it in GitHub Desktop.
cvNet = cv2.dnn.readNetFromCaffe('weights.caffemodel')
def getJSON(filePathandName):
with open(filePathandName,'r') as f:
return json.load(f)
def adjust_gamma(image, gamma=1.0):
invGamma = 1.0 / gamma
table = np.array([((i / 255.0) ** invGamma) * 255 for i in np.arange(0, 256)])
return cv2.LUT(image.astype(np.uint8), table.astype(np.uint8))
@Kamal111-code
Copy link

First line shows an error

error: OpenCV(4.1.2) /io/opencv/modules/dnn/src/caffe/caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "weights.caffemodel" in function 'ReadProtoFromTextFile'

@VinayakKhavanekar
Copy link

error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "weights.caffemodel" in function 'cv::dnn::ReadProtoFromTextFile'

@iamalaziz
Copy link

how to deal with this error

OpenCV(4.1.2) /io/opencv/modules/dnn/src/caffe/caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "weights.caffemodel" in function 'ReadProtoFromTextFile'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment