Error Loading Super Resolution methods

I am trying on improving resolution of low resolution images using OpenCV methods(EDSR,ESPCN,FSRCNN,LapSRN) in DNN module.

But I am getting the following error when trying to load the weights

OpenCV(4.5.2) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-1hfhc_rd\opencv\modules\dnn\src\caffe\caffe_io.cpp:1133: error: (-2:Unspecified error) FAILED: fs.is_open(). Can’t open “EDSR_x4.pb” in function ‘cv::dnn::ReadProtoFromBinaryFile’

OpenCV python version - 4.5.2

please show code, and lookup the location of the resp. models

sr = cv2.dnn_superres.DnnSuperResImpl_create()
path = “EDSR_x4.pb”
sr.readModel(path) # Getting error here
img = cv2.imread(‘xxxxx’) # image path
result = sr.upsample(img)

silly question:
does the network exist ? did you download it correctly ?
(readme has instructions / locations)

1 Like

I was following this link

Installed the latest version of Opencv using
pip install opencv-contrib-python

Do we need to separately download the weights and move to the folder path

YESSS ! (again, see the readme)

Is pyrUp() function in opencv is in par with SuperResolution module

no, not at all.
pyrUp() is just a 5x5 gaussian,
while the dnn based super resolution synthesizes a whole, larger image from the pretrained network

1 Like