2

The facial recognition package has two samples: https://github.com/ageitgey/face_recognition/blob/master/examples/find_faces_in_picture.py and https://github.com/ageitgey/face_recognition/blob/master/examples/find_faces_in_picture_cnn.py

After following the tutorial from https://github.com/ageitgey/face_recognition#installation and installing dlib from https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf prior to the installation of face_recognition (import dlib works), the code sample in the first link provided works fine:

import face_recognition

image = face_recognition.load_image_file("obama.jpg")

face_locations = face_recognition.face_locations(image)

top, right, bottom, left = face_locations[0]
face_image = image[top:bottom, left:right]
pil_image = Image.fromarray(face_image)
pil_image

However if face_locations = face_recognition.face_locations(image) is changed to face_locations = face_recognition.face_locations(image, model='cnn'), a runtime error is raised:

RuntimeError: Error while calling cudnnSetConvolution2dDescriptor((cudnnConvolutionDescriptor_t)conv_handle, padding_y, padding_x, stride_y, stride_x, 1, 1, CUDNN_CROSS_CORRELATION) in file /tmp/pip-build-gl2dutj1/dlib/dlib/cuda/cudnn_dlibapi.cpp:826. code: 3, reason: CUDNN_STATUS_BAD_PARAM

This https://github.com/ageitgey/face_recognition/issues/867 github issue describes a similar problem but has no solution. Similarly this https://github.com/natanielruiz/deep-head-pose/issues/7 issue describes a similar problem but it says to just build from the source which I did.

dlib is using cuda as

import dlib

dlib.DLIB_USE_CUDA

Returns True. Unlike Dlib (GPU supported) is not working properly, not sure?, it always raises this runtime error, even after restarting the jupyter kernel (64gb of RAM on my system, highly doubt a memory issue).

talonmies
  • 70,661
  • 34
  • 192
  • 269
bbd108
  • 958
  • 2
  • 10
  • 26

0 Answers0