Python API for bob.ip.dlib

class bob.ip.dlib.FaceDetector[source]

Bases: object

Detects face using the dlib Face Detector (http://dlib.net/face_detector.py.html)

detect_all_faces(image)[source]

Find all face bounding boxes in an image.

Parameters

image (2D or 3D numpy.ndarray) – GRAY scaled or RGB image in the format (CxWxH)

detect_single_face(image)[source]

Detect the biggest detected face in an image

Parameters

image (2D or 3D numpy.ndarray) – GRAY scaled or RGB image in the format (CxWxH)

class bob.ip.dlib.DlibLandmarkExtraction(model=None, bob_landmark_format=False)[source]

Bases: object

Binds to the DLib landmark detection using the shape_predictor_68_face_landmarks,

This facial landmark detector is an implementation of [Kazemi2014]

Parameters
  • model (str) – Path to the dlib pretrained model, if None, the model will be downloaded.

  • bob_landmark_format (bool) – If True, __call__ will return the landmarks with Bob dictionary keys (‘leye’, ‘reye’, nose, …..). If False, __call__ will return a list with the detected landmarks

static get_modelpath()[source]
static download_dlib_model()[source]

Download and extract the dlib model face detection model from

class bob.ip.dlib.AlignDLib[source]

Bases: object

Use dlib’s landmark estimation to align faces.

The alignment preprocess faces for input into a neural network. Faces are resized to the same size (such as 96x96) and transformed to make landmarks (such as the eyes and nose) appear at the same location on every image.

Code copied from here https://raw.githubusercontent.com/cmusatyalab/openface/master/openface/align_dlib.py

bob.ip.dlib.get_config()[source]

Returns a string containing the configuration information.