ActiveShapeModel

class menpofit.clm.ActiveShapeModel(expert_ensemble, shape_model, gaussian_covariance=10, eps=1e-05)[source]

Bases: GradientDescentCLMAlgorithm

Active Shape Model (ASM) algorithm.

Parameters
  • expert_ensemble (subclass of ExpertEnsemble) – The ensemble of experts object, e.g. CorrelationFilterExpertEnsemble.

  • shape_model (subclass of PDM, optional) – The shape model object, e.g. OrthoPDM.

  • gaussian_covariance (int or float, optional) – The covariance of the Gaussian kernel.

  • eps (float, optional) – Value for checking the convergence of the optimization.

References

1

T. F. Cootes, and C. J. Taylor. “Active shape models-‘smart snakes’”, British Machine Vision Conference, pp. 266-275, 1992.

2

T. F. Cootes, C. J. Taylor, D. H. Cooper, and J. Graham. “Active Shape Models - their training and application”, Computer Vision and Image Understanding (CVIU), 61(1): 38-59, 1995.

3

A. Blake, and M. Isard. “Active Shape Models”, Active Contours, Springer, pp. 25-37, 1998.

run(image, initial_shape, gt_shape=None, max_iters=20, return_costs=False, map_inference=False)[source]

Execute the optimization algorithm.

Parameters
  • image (menpo.image.Image) – The input test image.

  • initial_shape (menpo.shape.PointCloud) – The initial shape from which the optimization will start.

  • gt_shape (menpo.shape.PointCloud or None, optional) – The ground truth shape of the image. It is only needed in order to get passed in the optimization result object, which has the ability to compute the fitting error.

  • max_iters (int, optional) – The maximum number of iterations. Note that the algorithm may converge, and thus stop, earlier.

  • 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.

  • map_inference (bool, optional) – If True, then the solution will be given after performing MAP inference.

Returns

fitting_result (ParametricIterativeResult) – The parametric iterative fitting result.