Hey,
I am trying to use EDSR pre-trained model with cv2 dnn_superres. Installed all NVIDIA, CUDA and cuDNN related drivers. The version I am using for this is the following:
AWS EC2: p3.2xlarge
Ubuntu: 22.04.2 LTS
GPU: nvidia tesla v100
NVIDIA-SMI: 520.61.05
Driver Version: 520.61.05
CUDA Version: 11.8
cuDNN: 8.8.1
OpenCV: 4.5.5
The example code I am using is
def pre_trained_model_enhancement(img):
model_path = "EDSR_x4.pb"
sr = cv2.dnn_superres.DnnSuperResImpl_create()
sr.readModel(model_path)
sr.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
sr.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
sr.setModel("edsr", 4)
image_height, image_width, channels = img.shape
if image_width > 600 or image_height > 600:
if image_width > image_height:
fac = 600 / image_width
else:
fac = 600 / image_height
img = cv2.resize(img, (int(image_width * fac), int(image_height * fac)))
return sr.upsample(img)
When I pass the cv2 imread image to the function, it works all fine until the last line where it tries to upsample the image.
It throws this particular error:
cv2.error: OpenCV(4.5.5) /home/ubuntu/opencv-4.5.5/modules/dnn/src/cuda4dnn/csl/cudnn/cudnn.hpp:74: error: (-217:Gpu API call) CUDNN_STATUS_NOT_INITIALIZED in function 'UniqueHandle'
Is this a bug or some kind of issue with the drivers or the OpenCV version?
I have not seen any topic related to this particular error making it difficult to understand. If anyone has experienced this or has any idea please suggest further steps to resolve this.