This is a great repo!
Installed face_recognition and tried all examples (except webcam). So far works great.
While trying to do this on 10 unknown images and one known images:
face_recognition ./known_people/ ./unknown_pictures/
it takes around 15-20 seconds. Is there a way to do image comparison of one unknown image to large number of known images in ~2-3 seconds. Also, will this code run on GPU instance and will it reduce latency?
If you compile dlib manually with CUDA support (after having installed CUDA and cuDNN), it will use the GPU for generating the face embeddings. So that's a bit faster. However the part that still isn't GPU-accelerated is finding the locations of the faces in each image.
Also the face_recognition script isn't caching anything, so it's rescanning all the known_images each time you run the program which is slower than it needs to be.
One way to speed things up a little bit would be to change the script to pre-cache the face embeddings for each known image and save them somewhere:
face_recognition.face_encodings(unknown_image)[0] on each known image. You only need to do that once.cached_known_faces or something and pass that to face_recognition.compare_faces([cached_known_faces], unknown_face_encoding).I want to work on improving performance in general, but I haven't had a chance yet.
Thanks @ageitgey for the clarification.
Most helpful comment
If you compile
dlibmanually with CUDA support (after having installed CUDA and cuDNN), it will use the GPU for generating the face embeddings. So that's a bit faster. However the part that still isn't GPU-accelerated is finding the locations of the faces in each image.Also the face_recognition script isn't caching anything, so it's rescanning all the known_images each time you run the program which is slower than it needs to be.
One way to speed things up a little bit would be to change the script to pre-cache the face embeddings for each known image and save them somewhere:
face_recognition.face_encodings(unknown_image)[0]on each known image. You only need to do that once.cached_known_facesor something and pass that toface_recognition.compare_faces([cached_known_faces], unknown_face_encoding).I want to work on improving performance in general, but I haven't had a chance yet.