# DNN\_superres does not work even on OpenCV version 4.7.0

**URL:** <https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883>\
**Category:** Python\
**Tags:** dnn, build, contrib\
**Created:** [April 20, 2023, 10:20am UTC](https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883 "2023-04-20T10:20:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anish\_Nethi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/anish_nethi/32/7293_2.png) [@Anish\_Nethi](https://forum.opencv.org/u/Anish_Nethi)\
**Post date:** [April 20, 2023, 10:20am UTC](https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883/1 "2023-04-20T10:20:58Z")

</div>

> import cv2  
> from cv2 import dnn\_superres  
> sr = dnn\_superres.DnnSuperResImpl\_create()  
> path = ‘LapSRN\_x8.pb’  
> sr.readModel(path)  
> sr.setModel(‘lapsrn’, 8)  
> image = cv2.imread(‘1\_output\_face\_0.jpg’)  
> upscaled = sr.upsample(image)  
> cv2.imwrite(‘1\_output\_face\_0\_output.jpg’, upscaled)

The code is as mentioned above and the error is as follows

> ImportError Traceback (most recent call last)  
> Cell In [9], line 2  
> 1 import cv2  
> ----\> 2 from cv2 import dnn\_superres  
> 4 sr = dnn\_superres.DnnSuperResImpl\_create()  
> 6 path = ‘LapSRN\_x8.pb’  
> ImportError: cannot import name ‘dnn\_superres’ from ‘cv2’ (/usr/local/lib/python3.8/dist-packages/cv2/ **init**.py)

The version of OpenCV is 4.7.0 and I tried various methods to fix this error but it still does not work.

I would appreciate it if someone could help me out with this. Thanks in advance.

---

<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:** [April 20, 2023, 10:32am UTC](https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883/2 "2023-04-20T10:32:40Z")

</div>

please, remove the useless screenshot and replace with TEXT, thank you.

---

<div class="post-metadata">

**Author:** ![Anish\_Nethi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/anish_nethi/32/7293_2.png) [@Anish\_Nethi](https://forum.opencv.org/u/Anish_Nethi)\
**Post date:** [April 20, 2023, 10:57am UTC](https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883/3 "2023-04-20T10:57:39Z")

</div>

Did that, hopefully it’s more useful now. Thanks for the reply!

---

<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:** [April 20, 2023, 11:02am UTC](https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883/4 "2023-04-20T11:02:12Z")

</div>

your cv2 does not have this module

please, if you installed via pip:

```
pip uninstall opencv-python
pip install opencv-contrib-python

```

---

<div class="post-metadata">

**Author:** ![Anish\_Nethi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/anish_nethi/32/7293_2.png) [@Anish\_Nethi](https://forum.opencv.org/u/Anish_Nethi)\
**Post date:** [April 20, 2023, 11:08am UTC](https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883/5 "2023-04-20T11:08:17Z")

</div>

I did try that, however, the issue still persists…

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 20, 2023, 10:09pm UTC](https://forum.opencv.org/t/dnn-superres-does-not-work-even-on-opencv-version-4-7-0/12883/6 "2023-04-20T22:09:08Z")

</div>

got any other opencv packages or other pythons? any virtualenvs? any dockering? any IDE that’s trying to be helpful but fails miserably? anything else one would need to know? any weird computer architecture?
