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

Process does not run on GPU and errors are generated. #834

Open rihjeo opened 5 years ago

rihjeo commented 5 years ago

Description

Hello, I ran find_faces_in_pictures_cnn.py in the example file and there was an error.

This is the error

Traceback (most recent call last): File "find_faces_in_picture_cnn.py", line 12, in face_locations = face_recognition.face_locations(image, number_of_times_to_upsample=0, model="cnn") File "/home/miruware/pyn2/lib/python3.5/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 "/home/miruware/pyn2/lib/python3.5/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 /home/miruware/pyn2/dlib/dlib/cuda/cudnn_dlibapi.cpp:1007. code: 8, reason: CUDNN_STATUS_EXECUTION_FAILED

Dilb installation

$ git clone https://github.com/davisking/dlib.git $ cd dlib $ mkdir build $ cd build $ cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1 $ cmake --build . $ cd .. $ python3 setup.py install --set DLIB_USE_CUDA=1 --set USE_AVX_INSTRUCTIONS=1

face_recognition, opencv etc. have been installed nomally

I can't understand why such an error is coming up. Please help me.

rihjeo commented 5 years ago

i solve it!

Dentrax commented 5 years ago

@rihjeo Would you share with us how you solved it? Ty.

rihjeo commented 5 years ago

The reason was because the version of the cuda version and the cuddn version did not match.

Darren-2018 commented 5 years ago

I solved the problem, my version of cuda is cuda 9.0 and cudnn is 7.0. you can have a try

YingXiuHe commented 5 years ago

@Darren-2018 i faced the same problem, and i try to install the cuda and cudnn version as you mentioned, this problem still exited. how can i solve this problem ......... thks !