FaceMesh

Face landmark detection

RUN

The FaceMesh by MediaPipe model detects 468 key face landmarks in real time. The model can be configured to detect up to 20 faces.

The model outputs 468 normalized coordinates, each corresponding to some landmark, but the model only outputs 6 key-points

The following 6-keypoints are detected:

  1. Right Eye Inner
  2. Right Eye Outer
  3. Left Eye Inner
  4. Left Eye Outer
  5. Lip Right Corner
  6. Lip Left Corner

The data is exported as a CSV file structured as follows:

Frame right_eye_inner_x_pos right_eye_inner_y_pos right_eye_outer_x_pos right_eye_inner_x_pos left_eye_inner_x_pos left_eye_inner_y_pos left_eye_outer_x_pos left_eye_inner_x_pos lip_right_corner_x_pos lip_right_corner_y_pos lip_left_corner_x_pos lup_left_corner_y_pos
0 11 251.2331 239.0843 208.1723 238.9472 290.5730 240.7219 332.6023 242.9274 230.8592 318.2940 305.4467 320.0349
1 32 251.1341 239.4022 208.9237 237.7281 290.0012 241.3881 332.2391 241.1928 231.3710 318.2001 305.1028 320.7389

The frame column represents the frame number in the video, the timestamp column represents the time in milliseconds that have transpired since the model started running (upon recording data), and the other columns give the coordinates (x, y) of the detected features.

  1. maxNumberOfFaces - the maximum number of faces for the model to detect
  2. refineLandMarks - whether or not to track the pupils
  3. minDetectionConfidence - Minimum confidence value ([0.0, 1.0]) from the face detection model for the detection to be considered successful. Default to 0.5.
  4. minTrackingConfidence - Minimum confidence value ([0.0, 1.0]) from the landmark-tracking model for the face landmarks to be considered tracked successfully, or otherwise face detection will be invoked automatically on the next input image. Setting it to a higher value can increase robustness of the solution, at the expense of a higher latency.

Source Code