ProjectOutNewton¶

class
menpofit.aam.
ProjectOutNewton
(aam_interface, n_iterations=3, compute_error=<function euclidean_bb_normalised_error>, alpha=0, bias=True)[source]¶ Bases:
ProjectOut
Class for training a cascadedregression Newton algorithm using Incremental Regularized Linear Regression (
IRLRegression
) given a trained AAM model. The algorithm uses the projectedout appearance vectors as features in the regression. Parameters
aam_interface (The AAM interface class from menpofit.aam.algorithm.lk.) –
Existing interfaces include:
Class
AAM
’LucasKanadeStandardInterface’
Suitable for holistic AAMs
’LucasKanadeLinearInterface’
Suitable for linear AAMs
’LucasKanadePatchInterface’
Suitable for patchbased AAMs
n_iterations (int, optional) – The number of iterations (cascades).
compute_error (callable, optional) – The function to be used for computing the fitting error when training each cascade.
alpha (float, optional) – The regularization parameter.
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.

project_out
(J)¶ Projectsout the appearance subspace from a given vector or matrix.
 Type
ndarray

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 (
AAMAlgorithmResult
) – The parametric iterative fitting result.

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.

property
appearance_model
¶ Returns the appearance model of the AAM.
 Type
menpo.model.PCAModel

property
transform
¶ Returns the model driven differential transform object of the AAM, e.g.
DifferentiablePiecewiseAffine
orDifferentiableThinPlateSplines
.