DlibDetector

class menpodetect.dlib.DlibDetector(model)[source]

Bases: object

A generic dlib detector.

Wraps a dlib object detector inside the menpodetect framework and provides a clean interface to expose the dlib arguments.

__call__(image, greyscale=False, image_diagonal=None, group_prefix='dlib', n_upscales=0)[source]

Perform a detection using the cached dlib detector.

The detections will also be attached to the image as landmarks.

Parameters:
  • image (menpo.image.Image) – A Menpo image to detect. The bounding boxes of the detected objects will be attached to this image.
  • greyscale (bool, optional) – Convert the image to greyscale or not.
  • image_diagonal (int, optional) – The total size of the diagonal of the image that should be used for detection. This is useful for scaling images up and down for detection.
  • group_prefix (str, optional) – The prefix string to be appended to each each landmark group that is stored on the image. Each detection will be stored as group_prefix_# where # is a count starting from 0.
  • n_upscales (int, optional) – Number of times to upscale the image when performing the detection, may increase the chances of detecting smaller objects.
Returns:

bounding_boxes (list of menpo.shape.PointDirectedGraph) – The detected objects.