FullyParametricProjectOutOPP

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

Bases: ParametricAppearanceProjectOut

Class for training a cascaded-regression algorithm that employs parametric shape and appearance models using Multivariate Linear Regression with Orthogonal Procrustes Problem reconstructions (OPPRegression).

Parameters
  • patch_features (callable, optional) – The features to be extracted from the patches of an image.

  • patch_shape ((int, int), optional) – The shape of the extracted patches.

  • n_iterations (int, optional) – The number of iterations (cascades).

  • shape_model_cls (subclass of PDM, optional) – The class to be used for building the shape model. The most common choice is OrthoPDM.

  • appearance_model_cls (menpo.model.PCAVectorModel or subclass) – The class to be used for building the appearance model.

  • compute_error (callable, optional) – The function to be used for computing the fitting error when training each cascade.

  • bias (bool, optional) – Flag that controls whether to use a bias term.

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 (ParametricIterativeResult) – 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.