How to Get Face Landmarks Using 68-Point vs 5-Point Models in face_recognition

The face_recognition library provides a single face_landmarks() function that returns facial landmarks using either a 68-point "large" model for detailed geometry or a 5-point "small" model for rapid processing, controlled by the model parameter.

The ageitgey/face_recognition library simplifies facial landmark detection by wrapping dlib's shape predictors in a Pythonic API. Whether you need comprehensive facial geometry for animation or minimal reference points for blink detection, understanding how to toggle between the 68-point and 5-point models is essential for optimizing your computer vision pipeline.

Understanding the 68-Point and 5-Point Landmark Models

68-Point Model (Large)

The default 68-point model provides comprehensive facial mapping. When you call face_landmarks() without specifying a model, the library loads pose_predictor_68_point internally and returns 68 distinct coordinates organized into semantic facial regions.

These regions include:

  • chin
  • left_eyebrow
  • right_eyebrow
  • nose_bridge
  • nose_tip
  • left_eye
  • right_eye
  • top_lip
  • bottom_lip

This model is ideal for applications requiring detailed facial analysis, makeup rendering, or precise face morphing.

5-Point Model (Small)

For performance-critical applications, the 5-point model offers a lightweight alternative. When model="small" is specified, the library uses pose_predictor_5_point to return only five coordinates grouped into three regions:

  • nose_tip
  • left_eye
  • right_eye

This reduced set provides sufficient reference for coarse face alignment, blink detection, or scenarios where processing speed outweighs geometric detail.

Internal Implementation and Source Code

According to the face_recognition source code, both models are instantiated at module import time in face_recognition/api.py (lines 19-23):

predictor_68_point_model = face_recognition_models.pose_predictor_model_location()
pose_predictor_68_point = dlib.shape_predictor(predictor_68_point_model)

predictor_5_point_model = face_recognition_models.pose_predictor_five_point_model_location()
pose_predictor_5_point = dlib.shape_predictor(predictor_5_point_model)

The private helper _raw_face_landmarks() (lines 60-65) handles model selection based on the model parameter passed by the user:

pose_predictor = pose_predictor_68_point
if model == "small":
    pose_predictor = pose_predictor_5_point
return [pose_predictor(face_image, face_location) for face_location in face_locations]

Finally, the public face_landmarks() function (lines 68-99) processes these raw dlib points into Python dictionaries. The function maps the 68-point output to nine facial feature groups, while the 5-point output is structured into the three groups mentioned above. If an unsupported model string is provided, the function raises a ValueError.

Practical Code Examples

Retrieving 68-Point Landmarks (Default)

To extract the full 68-point facial geometry, load your image and call face_landmarks() without specifying a model, or explicitly pass model="large":

import face_recognition

image = face_recognition.load_image_file("examples/test_images/obama.jpg")

# Default behavior uses the 68-point model

landmarks = face_recognition.face_landmarks(image)

# Or explicitly: face_recognition.face_landmarks(image, model="large")

# Access the chin contour of the first detected face

print("Chin points:", landmarks[0]["chin"])

Retrieving 5-Point Landmarks

For faster processing when you only need eye and nose references, specify model="small":

import face_recognition

image = face_recognition.load_image_file("examples/test_images/obama.jpg")

# Use the lightweight 5-point model

landmarks_small = face_recognition.face_landmarks(image, model="small")

# The small model returns only three feature groups

print("Nose tip:", landmarks_small[0]["nose_tip"])
print("Left eye:", landmarks_small[0]["left_eye"])
print("Right eye:", landmarks_small[0]["right_eye"])

Model Selection Guidelines

Choose the 68-point model when your application requires:

  • Detailed lip tracking for speech analysis
  • Precise eyebrow movement detection
  • Full face mesh reconstruction

Choose the 5-point model when your application requires:

  • Real-time blink detection (see examples/blink_detection.py)
  • Rapid face alignment for preprocessing
  • Minimal computational overhead on resource-constrained devices

Summary

  • The face_recognition.face_landmarks() function supports two dlib shape predictor models selectable via the model parameter.
  • "large" (default): Returns 68 points across nine facial regions (chin, left_eyebrow, right_eyebrow, nose_bridge, nose_tip, left_eye, right_eye, top_lip, bottom_lip).
  • "small": Returns 5 points across three regions (nose_tip, left_eye, right_eye) using pose_predictor_5_point.
  • Model loading occurs at import time in face_recognition/api.py, with selection logic handled by _raw_face_landmarks().
  • The 5-point model offers faster processing for real-time applications, while the 68-point model provides comprehensive geometry for detailed analysis.

Frequently Asked Questions

What is the difference between 68-point and 5-point face landmarks?

The 68-point model maps the entire face including chin contour, eyebrows, nose bridge, eyes, and lips, while the 5-point model returns only the nose tip and two points per eye. According to the source code in face_recognition/api.py, the 68-point model uses pose_predictor_68_point and returns nine feature groups, whereas the small model uses pose_predictor_5_point and returns only nose_tip, left_eye, and right_eye.

How do I switch between models in the face_recognition library?

Pass the model parameter to face_landmarks() with either "large" for 68 points or "small" for 5 points. The default is "large". Internally, this parameter determines whether _raw_face_landmarks() uses pose_predictor_68_point or pose_predictor_5_point as implemented in lines 60-65 of face_recognition/api.py.

Which model should I use for real-time face detection applications?

Use the 5-point model (model="small") for real-time applications. As demonstrated in examples/blink_detection.py, the reduced point count significantly decreases processing time while providing sufficient data for blink detection and coarse alignment. The 68-point model is better suited for offline analysis or applications requiring detailed facial geometry.

Where are the landmark model files stored in face_recognition?

The model files are managed by the separate face_recognition_models package. At runtime, face_recognition/api.py (lines 19-23) loads the predictors by calling face_recognition_models.pose_predictor_model_location() for the 68-point model and face_recognition_models.pose_predictor_five_point_model_location() for the 5-point model, then instantiates them using dlib.shape_predictor().

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →