DlibWrapper

class menpofit.dlib.DlibWrapper(model)[source]

Bases: object

Wrapper class for fitting a pre-trained ERT model. Pre-trained models are provided by the official DLib package (http://dlib.net/).

Parameters

model (Path or str) – Path to the pre-trained model.

fit_from_bb(image, bounding_box, gt_shape=None)[source]

Fits the model to an image given an initial bounding box.

Parameters
  • image (menpo.image.Image or subclass) – The image to be fitted.

  • bounding_box (menpo.shape.PointDirectedGraph) – The initial bounding box.

  • gt_shape (menpo.shape.PointCloud) – The ground truth shape associated to the image.

Returns

fitting_result (Result) – The result of the fitting procedure.

fit_from_shape(image, initial_shape, gt_shape=None)[source]

Fits the model to an image. Note that it is not possible to initialise the fitting process from a shape. Thus, this method raises a warning and calls fit_from_bb with the bounding box of the provided initial_shape.

Parameters
  • image (menpo.image.Image or subclass) – The image to be fitted.

  • initial_shape (menpo.shape.PointCloud) – The initial shape estimate from which the fitting procedure will start. Note that the shape won’t actually be used, only its bounding box.

  • gt_shape (menpo.shape.PointCloud) – The ground truth shape associated to the image.

Returns

fitting_result (Result) – The result of the fitting procedure.