Face landmark detection finds key points on a face, like eyes, nose, and mouth corners. The main metric is Mean Squared Error (MSE) or Normalized Mean Error (NME). These measure how close the predicted points are to the true points. Lower error means better accuracy. We use these because this is a regression task, not classification.
Face landmark detection in Computer Vision - Model Metrics & Evaluation
Face landmark detection does not use a confusion matrix because it predicts coordinates, not classes. Instead, we visualize errors as distances between predicted and true points.
True points: (x1, y1), (x2, y2), ..., (xN, yN)
Predicted points: (x1', y1'), (x2', y2'), ..., (xN', yN')
Error per point = sqrt((x - x')^2 + (y - y')^2)
Mean Error = average of all point errors
In face landmark detection, the tradeoff is between accuracy (how close points are) and robustness (working well on different faces and conditions). Improving accuracy might make the model sensitive to small changes, reducing robustness. Balancing these ensures landmarks are precise and reliable.
Good models have low mean error, often below 5% of the inter-ocular distance (distance between eyes). For example, an NME of 0.03 means average error is 3% of eye distance, which is good. Bad models have high errors, like 0.1 or more, meaning points are far from true locations.
- Ignoring scale: Measuring error in pixels without normalization can mislead if face sizes vary.
- Overfitting: Very low training error but high test error means model memorizes training faces.
- Data leakage: Using same faces in training and testing inflates accuracy.
- Not considering robustness: Good error on clear images but poor on occluded or rotated faces.
Your face landmark model has a mean error of 0.02 on training data but 0.08 on new faces. Is it good for real use? Why or why not?
Answer: No, it is not good. The model fits training faces well but performs poorly on new faces, showing overfitting and poor generalization. You need to improve robustness and test on diverse data.
Practice
Solution
Step 1: Understand face landmark detection
Face landmark detection identifies specific points on a face like eyes, nose, and mouth corners.Step 2: Differentiate from other tasks
Other tasks like age classification or face detection do not focus on key facial points.Final Answer:
To find key points on a face that represent facial features -> Option CQuick Check:
Face landmark detection = key facial points [OK]
- Confusing face detection with landmark detection
- Thinking it classifies face attributes like age or emotion
- Assuming it changes image colors
Solution
Step 1: Recall MediaPipe face mesh syntax
The correct class to load face landmark detection is FaceMesh under mp.solutions.face_mesh.Step 2: Check each option
Only mp_face_mesh = mp.solutions.face_mesh.FaceMesh() uses the correct full path and class name.Final Answer:
mp_face_mesh = mp.solutions.face_mesh.FaceMesh() -> Option AQuick Check:
Correct MediaPipe class = FaceMesh [OK]
- Using incorrect method names like load_face_mesh()
- Omitting the full module path
- Using non-existent classes like face_landmark()
results.multi_face_landmarks if a face is detected?Solution
Step 1: Understand MediaPipe output for face landmarks
When a face is detected, results.multi_face_landmarks returns a list of landmark objects, one per face.Step 2: Analyze the options
Only A list of face landmark objects correctly describes this as a list of face landmark objects.Final Answer:
A list of face landmark objects -> Option AQuick Check:
Detected faces landmarks = list of objects [OK]
- Thinking it returns a count (integer)
- Assuming it returns a dictionary
- Confusing None with detected results
mp_drawing.draw_landmarks(image, results.face_landmarks, mp_face_mesh.FACEMESH_TESSELATION). What is the likely cause?Solution
Step 1: Check results object structure
MediaPipe stores landmarks in results.multi_face_landmarks as a list, not results.face_landmarks.Step 2: Correct usage for drawing
To draw landmarks for the first face, use results.multi_face_landmarks[0].Final Answer:
results.face_landmarks should be results.multi_face_landmarks[0] -> Option DQuick Check:
Use multi_face_landmarks list for drawing [OK]
- Using a non-existent attribute results.face_landmarks
- Forgetting to import mp_drawing
- Assuming image must be grayscale
Solution
Step 1: Identify glasses placement on face
Glasses rest on the nose bridge and cover the eyes area.Step 2: Choose landmarks matching these areas
Landmarks around eyes and nose bridge provide accurate positioning points.Final Answer:
Landmarks around the eyes and nose bridge -> Option BQuick Check:
Glasses position = eyes + nose bridge landmarks [OK]
- Using lip or chin landmarks which are too low
- Choosing forehead or cheeks which don't fit glasses
- Selecting ears which are not detected by standard landmarks
Ready to prove it?
Pass the test and this pattern moves unknown
