AAMMultilevelFittingResult

class menpo.fitmultilevel.fittingresult.AAMMultilevelFittingResult(image, multiple_fitter, fitting_results, affine_correction, gt_shape=None, error_type='me_norm')[source]

Bases: MultilevelFittingResult

Object let us recover the state of an AAM Fitter after the latter has fitted a particular image.

Parameters:

image: :class:`pybug.image.masked.MaskedImage` :

The fitted image.

aam_fitter: :class:`pybug.aam.fitter.AAMFitter` :

The aam_fitter object used to fitter the image.

basic_fittings: :class:`pybug.aam.fitting.BasicFitting` list :

A list of basic fitting objects.

_affine_correction: :class: `pybug.transforms.affine.Affine` :

An affine transform that maps the result of the top resolution fitting level to the space scale of the original image.

gt_shape: class:`pybug.shape.PointCloud`, optional :

The ground truth shape associated to the image.

Default: None

error_type: ‘me_norm’, ‘me’ or ‘rmse’, optional. :

Specifies the way in which the error between the fitted and ground truth shapes is to be computed.

Default: ‘me_norm’

appearance_reconstructions(as_pixels=False)[source]

Generates a list containing the appearance reconstruction obtained at each fitting iteration.

Parameters:

as_pixels : boolean, optional

Whether the result is returned as a list of Image or ndarray.

Returns:

appearance_reconstructions : MaskedImage or ndarray list

A list containing the appearance reconstructions obtained at each fitting iteration.

plot_cost(figure_id=None, new_figure=False, **kwargs)[source]

Plots the cost evolution throughout the fitting.

plot_error(figure_id=None, new_figure=False, **kwargs)

Plots the error evolution throughout the fitting.

shapes(as_points=False)

Generates a list containing the shapes obtained at each fitting iteration.

Parameters:

as_points: boolean, optional :

Whether the results is returned as a list of PointClouds or ndarrays.

Default: False

Returns:

shapes: :class:`menpo.shape.PointCoulds or ndarray list :

A list containing the shapes obtained at each fitting iteration.

view(**kwargs)

View the object using the default rendering engine figure handling. For example, the default behaviour for Matplotlib is that all draw commands are applied to the same figure object.

Parameters:

kwargs : dict

Passed through to specific rendering engine.

Returns:

viewer : Renderer

The renderer instantiated.

view_appearance_reconstructions(figure_id=None, new_figure=False, channels=None, **kwargs)[source]

Displays the appearance reconstructions.

view_error_images(figure_id=None, new_figure=False, channels=None, **kwargs)[source]

Displays the error images.

view_final_fitting(figure_id=None, new_figure=False, **kwargs)

Displays the final fitting result.

view_ground_truth(figure_id=None, new_figure=False, **kwargs)

Displays the ground truth annotation.

view_initialization(figure_id=None, new_figure=False, **kwargs)

Displays the initialization from which the fitting started.

view_new(**kwargs)

View the object on a new figure.

Parameters:

kwargs : dict

Passed through to specific rendering engine.

Returns:

viewer : Renderer

The renderer instantiated.

view_on(figure_id, **kwargs)

View the object on a a specific figure specified by the given id.

Parameters:

figure_id : object

A unique identifier for a figure.

kwargs : dict

Passed through to specific rendering engine.

Returns:

viewer : Renderer

The renderer instantiated.

view_warped_images(figure_id=None, new_figure=False, channels=None, from_basic_fittings=False, **kwargs)[source]

Displays the warped images.

warped_images(from_basic_fittings=False, as_pixels=False)[source]

Generates a list containing the warped images obtained at each fitting iteration.

Parameters:

from_basic_fittings : boolean, optional

If True, the returned transform per iteration is used to warp the internal image representation used by each basic fitter. If False, the transforms are used to warp original image.

as_pixels : boolean, optional

Whether the result is returned as a list of Image or ndarray.

Returns:

warped_images : MaskedImage or ndarray list

A list containing the warped images obtained at each fitting iteration.

algorithm

Returns the name of the algorithm used by the Fitter.

costs[source]

Returns a list containing the cost at each fitting iteration.

downscale

Returns the downscale factor used by the multiple fitter.

error_type

Return the type of error.

errors

Returns a list containing the error at each fitting iteration.

final_cost[source]

Returns the final fitting cost.

final_error

Returns the final fitting error.

Type:float
final_shape

Returns the final fitted shape.

fitted

Returns the fitted state of each fitting object.

gt_shape

Returns the original ground truth shape associated to the image.

initial_cost[source]

Returns the initial fitting cost.

initial_error

Returns the initial fitting error.

Type:float
initial_shape

Returns the initial shape from which the fitting started.

n_iters

Returns the total number of iterations used to fitter the image.

n_levels

Returns the number of levels of the fitter object.

residual[source]

Returns the type of residual used by the basic fitter associated to each basic fitting.

scaled_levels

Returns True if the shape results returned by the basic fitting_results must be scaled.