ParametricAppearanceProjectOutNewton

class menpofit.sdm.ParametricAppearanceProjectOutNewton(patch_features=<function no_op>, patch_shape=(17, 17), n_iterations=3, appearance_model_cls=<class 'menpo.model.pca.PCAVectorModel'>, compute_error=<function euclidean_bb_normalised_error>, alpha=0, bias=True)[source]

Bases: ParametricAppearanceNewton

Class for training a cascaded-regression Newton algorithm that employs a parametric appearance model using Incremental Regularized Linear Regression (IRLRegression). The algorithm uses the projected-out appearance vectors as features in the regression.

increment(images, gt_shapes, current_shapes, prefix='', verbose=False)

Method to increment the model with the set of current shapes.

Parameters:
  • images (list of menpo.image.Image) – The list of training images.
  • gt_shapes (list of menpo.shape.PointCloud) – The list of ground truth shapes that correspond to the images.
  • current_shapes (list of menpo.shape.PointCloud) – The list of current shapes that correspond to the images.
  • prefix (str, optional) – The prefix to use when printing information.
  • verbose (bool, optional) – If True, then information is printed during training.
Returns:

current_shapes (list of menpo.shape.PointCloud) – The list of current shapes that correspond to the images.

run(image, initial_shape, gt_shape=None, return_costs=False, **kwargs)

Run the algorithm to an image given an initial shape.

Parameters:
  • image (menpo.image.Image or subclass) – The image to be fitted.
  • initial_shape (menpo.shape.PointCloud) – The initial shape from which the fitting procedure will start.
  • gt_shape (menpo.shape.PointCloud or None, optional) – The ground truth shape associated to the image.
  • return_costs (bool, optional) – If True, then the cost function values will be computed during the fitting procedure. Then these cost values will be assigned to the returned fitting_result. Note that this argument currently has no effect and will raise a warning if set to ``True``. This is because it is not possible to evaluate the cost function of this algorithm.
Returns:

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

train(images, gt_shapes, current_shapes, prefix='', verbose=False)

Method to train the model given a set of initial shapes.

Parameters:
  • images (list of menpo.image.Image) – The list of training images.
  • gt_shapes (list of menpo.shape.PointCloud) – The list of ground truth shapes that correspond to the images.
  • current_shapes (list of menpo.shape.PointCloud) – The list of current shapes that correspond to the images, which will be used as initial shapes.
  • prefix (str, optional) – The prefix to use when printing information.
  • verbose (bool, optional) – If True, then information is printed during training.
Returns:

current_shapes (list of menpo.shape.PointCloud) – The list of current shapes that correspond to the images.