Search code examples
pythonmediapipe

is possible to face recognition with mediapipe in python


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?


Solution

  • 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)