ParametricFittingResult

class menpo.fit.fittingresult.ParametricFittingResult(image, lk, parameters=None, weights=None, costs=None, gt_shape=None, error_type='me_norm')[source]

Bases: SemiParametricFittingResult

Object that holds the state of a lucas-kanade object before, during and after it has fitted a particular image.

Parameters:

image: :class:`menpo.image.masked.MaskedImage` :

The fitted image.

lk: :class:`menpo.aam.fitter.BasicFitter` :

The fitter object used to fitter the image.

weights: ndarray list :

A list containing the weights of the lk object transform per fitting iteration.

Default: None

weights: ndarray list :

A list containing the weights of the lk appearance model per fitting iteration. Note that, some lk objects do not explicitly recover the weights of the appearance model; in this cases weights is None.

Default: None

costs: ndarray list :

A list containing the values of the cost function optimized by the lk object per fitting iteration.

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 Images or ndarrays.

Default: False

Returns:

appearance_reconstructions: :class:`menpo.image.masked.MaskedImage` :

or ndarray list

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

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

Plots the cost evolution throughout the fitting.

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

Plots the error evolution throughout the fitting.

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

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, **kwargs)[source]

Displays the warped images.

warped_images(as_pixels=False)[source]

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

Parameters:

as_pixels: boolean, optional :

Whether the result is returned as a list of Images or ndarrays.

Default: False

Returns:

warped_images: :class:`menpo.image.masked.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.

error_type

Return the type of error.

errors

Returns a list containing the error at each fitting iteration.

final_cost

Returns the value of the cost function at the final iteration.

final_error

Returns the final fitting error.

Type:float
final_transform

Returns the final transform.

fitted[source]

True iff the fitting procedure has been completed.

gt_shape

Returns the original ground truth shape associated to the image.

initial_cost

Returns the value of the cost function at the first iteration.

initial_error

Returns the initial fitting error.

Type:float
initial_transform

Returns the initial transform from which the fitting started.

residual

Returns the type of residual used by the basic fitter.

transforms

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