Stage¶
DeepAlignmentStage¶
-
class
DeepAlignmentStage
(mean_shape, input_size=112, p_dropout=0.5, is_first=True, patch_size=16, norm_type='batch')[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
A single Deep Alignment Stage
Parameters: - mean_shape (
numpy.ndarray
ortorch.Tensor
) – the mean shape - input_size (int or tuple, optional) – the size of the input images (the default is 112)
- p_dropout (float, optional) – the dropout probability (the default is 0.5)
- is_first (bool) – whether the current stage is the first one or not
- patch_size (int, optional) – the patch size for heatmap generation (the default is 16)
- norm_type (str, optional) – which kind of normalization to apply (the default is “instance”)
-
forward
(input_tensor, prev_lmk=None, prev_hidden=None)[source]¶ Feeds an input image (and the landmarks and hidden activations if given) through the actual stage
Parameters: - input_tensor (
torch.Tensor
) – the input image - prev_lmk (
torch.Tensor
or None) – the landmarks of the previous stage, if the current stage is not the first one - prev_hidden (
torch.Tensor
or None) – the activations of the previous stage’s hidden layer, if the current stage is not the first one
Raises: ValueError
– If the current stage is not the first one, but noprev_lmk
or noprev_hidden
are passedReturns: torch.Tensor
– the predicted landmarkstorch.Tensor
– the activations of the hidden layer to be used in the next stage
- input_tensor (
- mean_shape (