# Error Loading Super Resolution methods

**URL:** <https://forum.opencv.org/t/error-loading-super-resolution-methods/3893>\
**Category:** Python\
**Tags:** dnn\
**Created:** [June 17, 2021, 8:13am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893 "2021-06-17T08:13:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandraj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/chandraj/32/703_2.png) [@chandraj](https://forum.opencv.org/u/chandraj)\
**Post date:** [June 17, 2021, 8:13am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/1 "2021-06-17T08:13:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 17, 2021, 8:16am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/2 "2021-06-17T08:16:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chandraj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/chandraj/32/703_2.png) [@chandraj](https://forum.opencv.org/u/chandraj)\
**Post date:** [June 17, 2021, 8:26am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/3 "2021-06-17T08:26:42Z")

</div>

sr = cv2.dnn\_superres.DnnSuperResImpl\_create()  
path = “EDSR\_x4.pb”  
sr.readModel(path) # Getting error here  
sr.setModel(“edsr”,4)  
img = cv2.imread(‘xxxxx’) # image path  
result = sr.upsample(img)

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 17, 2021, 8:36am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/4 "2021-06-17T08:36:43Z")

</div>

silly question:  
does the network exist ? did you download it correctly ?  
([readme](https://github.com/opencv/opencv_contrib/blob/master/modules/dnn_superres/README.md) has instructions / locations)

---

<div class="post-metadata">

**Author:** ![chandraj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/chandraj/32/703_2.png) [@chandraj](https://forum.opencv.org/u/chandraj)\
**Post date:** [June 17, 2021, 8:42am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/5 "2021-06-17T08:42:52Z")

</div>

I was following this link

> **[Super Resolution in OpenCV](https://learnopencv.com/super-resolution-in-opencv/)**
>
> Super resolution is the process of upscaling or improving the details of the image. This blog is a quick comparison of algorithms on Super Resolution in OpenCV.

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

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 17, 2021, 8:43am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/6 "2021-06-17T08:43:38Z")

</div>

> [@chandraj](#):
>
> Do we need to separately download the weights

YESSS ! (again, see the readme)

---

<div class="post-metadata">

**Author:** ![chandraj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/chandraj/32/703_2.png) [@chandraj](https://forum.opencv.org/u/chandraj)\
**Post date:** [June 18, 2021, 8:46am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/7 "2021-06-18T08:46:06Z")

</div>

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

[https://docs.opencv.org/3.4/d4/d1f/tutorial\_pyramids.html](https://docs.opencv.org/3.4/d4/d1f/tutorial_pyramids.html)

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 18, 2021, 11:58am UTC](https://forum.opencv.org/t/error-loading-super-resolution-methods/3893/8 "2021-06-18T11:58:01Z")

</div>

> [@chandraj](#):
>
> 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
