2

I try to make app with python to be able recognition face, recently use cv2+dlib and face_recognition module for recognition, but i have two problems:

  1. have 3 or 4 second delay
  2. low accuracy

That's why I decided to use another library, after so many search, find MediaPipe, this library is very fast (real time) and find this example for face detection, but I need face recognition! but not found any example for face recognition Is there a solution?

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
A.Motahari
  • 173
  • 5
  • 10

2 Answers2

7

Mediapipe doesn't provide a face recognition method, only face detector.

The face_recognition library has really good accuracy, It's claimed accuracy is 99%+. your dataset probably isn't good enough.

Solutions:

  1. For better speed performance, use the "hog" model instead of "cnn" model. you can modify it when you use the face_locations method like the following code line.

    locations = face_recognition.face_locations(frame, model="hog")
    
  2. For accuracy, use better dataset images (higher quality, a face looking straight at the camera, more pictures for the same person but usually 1-3 pictures is enough)

Roy Amoyal
  • 717
  • 4
  • 14
2

If you want to increase the accuracy of face recognization reduce the tolerance value to 0.4 or 0.5 and for face detection use the hog model.

face_recognition.api.compare_faces(known_face_encodings,face_encoding_to_check, tolerance=0.5)

https://face-recognition.readthedocs.io/en/latest/face_recognition.html

Paweł Szymczyk
  • 1,638
  • 15
  • 20