-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Face Detection Problems
Question: Why doesn't face_locations()
detect people that are farther away from the camera? It's only detecting people close to the camera.
The problem is that there is a minimum size face that the face_locations()
tries to detect. If the face area is smaller than that size, won't be detected.
On this line of the standard webcam demo, you can change this line:
face_locations = face_recognition.face_locations(rgb_frame)
to this:
face_locations = face_recognition.face_locations(rgb_frame, number_of_times_to_upsample=2)
That will make it look for smaller/further away faces at the expense of running slower by upsampling the original image more. With that setting, it can easily find tiny faces across the room with a webcam.
Note that this squares the size of the input image. So going to 3
or 4
will cause the performance to get much, much slower and possibly run out of memory depending on the size of your input image.
Also note that if you are running the "faster" version of webcam demo, it is down-scaling the image to 1/4 size to speed things up. That will make it a lot worse at finding far away faces. So that particular demo isn't the best if you care about finding all possible faces in the image.