DNN_superres does not work even on OpenCV version 4.7.0

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.

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

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

your cv2 does not have this module

please, if you installed via pip:

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

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

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?