ageitgey / face_recognition

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

face_recognitions.face_locations is too slow #1105

Open muyustan opened 4 years ago

muyustan commented 4 years ago

Description

I have a code which works nice, so there should not be any mistakes, the only problem is, it is too slow. The processing of a frame(either an image in unknown_faces dir or video feed) takes like 20-30 seconds.

What I Did

I am getting the image from the video feed(my laptop webcam, nothing fancy).

I insterted some print()s to determine at where exactly the code slows down and I found that:

locations = face_recognition.face_locations(image, model=MODEL)

the delay occurs during the execution of this line.

Is this normal?

MODEL = "cnn", by the way.

sherlockchou86 commented 4 years ago

the process is quick on my 1080 gpu when model=cnn

muyustan commented 4 years ago

the process is quick on my 1080 gpu when model=cnn

Is it using GPU instead of CPU ?

sherlockchou86 commented 4 years ago

the process is quick on my 1080 gpu when model=cnn

Is it using GPU instead of CPU ?

yes, you need a GPU when set model=cnn

Latestion commented 4 years ago

I had the same problem. Change your model to hog which uses ur cpu instead. Its still not great for me but its only a 2 to 3 second delay.