Not able to run face recognition on GPU of Jetson nano

Installed dlib and face_recognition as per solution of Installing dlib with python3.6 in Jetson Nano .
I’m able to run face_recognition on cpu. but when I try to offload to GPU it gives error.
import face_recognition
image = face_recognition.load_image_file(“/home/batsy/Downloads/my_face.jpg”)
face_locations = face_recognition.face_locations(image)
the above code works. The following code fails:-
import face_recognition
image = face_recognition.load_image_file(“/home/batsy/Downloads/my_face.jpg”)
face_locations = face_recognition.face_locations(image, model=“cnn”)

Following is the error:-
File “trial_0.py”, line 3, in
face_locations = face_recognition.face_locations(image, model=“cnn”)
File “/home/batsy/.local/lib/python3.6/site-packages/face_recognition/api.py”, line 119, in face_locations
return [_trim_css_to_bounds(_rect_to_css(face.rect), img.shape) for face in _raw_face_locations(img, number_of_times_to_upsample, “cnn”)]
File “/home/batsy/.local/lib/python3.6/site-packages/face_recognition/api.py”, line 103, in _raw_face_locations
return cnn_face_detector(img, number_of_times_to_upsample)
RuntimeError: Error while calling cudnnFindConvolutionBackwardDataAlgorithm( context(), (const cudnnFilterDescriptor_t)filter_handle, descriptor(dest_desc), (const cudnnConvolutionDescriptor_t)conv_handle, descriptor(data), num_possible_algorithms, &num_algorithms, perf_results.data()) in file /tmp/pip-build-yrtsvnza/dlib/dlib/cuda/cudnn_dlibapi.cpp:856. code: 4, reason: A call to cuDNN failed
cudaStreamDestroy() failed. Reason: the launch timed out and was terminated
cudaFree() failed. Reason: the launch timed out and was terminated

Make sure to use the latest version 19.21 of Dlib, older versions are incompatible with JetPack 4.5.

Hi,

It seems that you are facing a similar issue as below topic:
https://github.com/ageitgey/face_recognition/issues/992#issuecomment-650533909

The user fixes the error by switching the library import order.
Could you also give it a try?

Thanks.

Hi @AastaLLL ,
Thanks for the reply. this solution worked.

Getting the below error while training the images ,

Traceback (most recent call last):
File “generate_training_data.py”, line 86, in
dets = face_detector(image, 1)
RuntimeError: Error while calling cudnnFindConvolutionBackwardDataAlgorithm( context(),

import order tried not working
import os
import numpy as np
import os
import dlib
import shutil
import argparse
import random
import sys
import face_recognition_models
import cv2

any idea why ?

using jetson-nano 4gb
dlib-19.22 (cuda enables)
opencv 4.5.1 (cuda enabled)

Hi gopurajesh,

Please help to open a new topic. Thanks