ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.07k stars 13.46k forks source link

I:\dlib-19.17\dlib\cuda\cudnn_dlibapi.cpp:1007. code: 3, reason: CUDNN_STATUS_BAD_PARAM #867

Open michaeldengxyz opened 5 years ago

michaeldengxyz commented 5 years ago

Description

Try to get faces location:
faces_locations = face_recognition.face_locations(rgb_small_frame,number_of_times_to_upsample=1, model="cnn")
then get error:
RuntimeError: Error while calling cudnnConvolutionForward( ......) in file I:\dlib-19.17\dlib\cuda\cudnn_dlibapi.cpp:1007. code: 3, reason: CUDNN_STATUS_BAD_PARAM what's wrong? thanks a lot for your help in advance!

What I Did

Try to get faces location:
faces_locations = face_recognition.face_locations(rgb_small_frame,number_of_times_to_upsample=1, model="cnn")
then get error:

Traceback (most recent call last): File "MakeThumbs_LOCAL.py", line 1016, in FacesGet2 faces = face_recognition.face_locations(rgb_small_frame,number_of_times_to_upsample=1, model="cnn") #model: hog or cnn, return a list of (top, right, bottom, left) File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\face_recognition\api.py", line 116, 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 "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\face_recognition\api.py", line 100, in _raw_face_locations return cnn_face_detector(img, number_of_times_to_upsample) RuntimeError: Error while calling cudnnConvolutionForward( context(), &alpha, descriptor(data), data.device(), (const cudnnFilterDescriptor_t)filter_handle, filters.device(), (const cudnnConvolutionDescriptor_t)conv_handle, (cudnnConvolutionFwdAlgo_t)forward_algo, forward_workspace, forward_workspace_size_in_bytes, &beta, descriptor(output), output.device()) in file I:\dlib-19.17\dlib\cuda\cudnn_dlibapi.cpp:1007. code: 3, reason: CUDNN_STATUS_BAD_PARAM

michaeldengxyz commented 5 years ago

my codes: im = Image.open(filepath) ##read image by PILLOW img = cv2.cvtColor(numpy.array(im),cv2.COLOR_RGB2BGR) ##convert to openCV format img = cv2.flip(cv2.transpose(img), 1) ##rotate image to 90 degree im = Image.fromarray(cv2.cvtColor(img,cv2.COLOR_BGR2RGB)) ##convert image back to PILLOW format img_xx = cv2.cvtColor(numpy.array(im.convert('L')),cv2.COLOR_RGB2BGR) #convert to gray image and back to Opencv format rgb_small_frame = img_xx[:, :, ::-1] #convert to face_recognition format
faces_locations = face_recognition.face_locations(rgb_small_frame,number_of_times_to_upsample=1, model="cnn") #model: hog or cnn, return a list of (top, right, bottom, left) ##face_locations with CNN mode.