ExtractBatchAligned

class lib.infer.objects.ExtractBatchAligned(landmarks: ndarray[tuple[Any, ...], dtype[float32]] | None = None, landmark_type: LandmarkType | None = None)

Bases: object

Dataclass for working with batches of aligned images

Parameters:
  • landmarks (numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float32]] | None) – The face landmarks found for this batch in frame space or None if not available. Default: None (to be populated later)

  • landmark_type (lib.align.constants.LandmarkType | None) – The type of landmarks that the batch holds or None if not available. Default: None (to be populated later)

Attributes Summary

landmark_type

The type of landmarks that the batch holds

landmarks

The face landmarks found for this batch in frame space or None if not populated

landmarks_68

The stored landmarks as 68 point landmarks if supported, or original landmarks if not ( 4 point ROI landmarks)

landmarks_normalized

The normalized, aligned 68 point landmarks

matrices

The face alignment matrices to transform from frame space to normalized (0, 1) space

matrices_face

The alignment matrices to transform from normalized legacy space (0, 1) to normalized face space

matrices_head

The alignment matrices to transform from normalized legacy space (0, 1) to normalized head space

offsets_face

The (N, x, y) offsets required to shift from normalized (legacy) centering to face centering

offsets_head

The (N, x, y) offsets required to shift from normalized (legacy) centering to head centering

offsets_legacy

The (N, x, y) offsets for normalized (legacy) centering.

rotation

The estimated (N, 3, 1) rotation vectors

translation

The estimated (N, 3, 1) translation vectors

Methods Summary

append(batch)

Append the data from the given batch object to this batch object

apply_mask(mask)

Apply a boolean mask to the batch object.

Attributes Documentation

landmark_type: LandmarkType | None = None

The type of landmarks that the batch holds

landmarks: ndarray[tuple[Any, ...], dtype[float32]] | None = None

The face landmarks found for this batch in frame space or None if not populated

landmarks_68

The stored landmarks as 68 point landmarks if supported, or original landmarks if not ( 4 point ROI landmarks)

landmarks_normalized

The normalized, aligned 68 point landmarks

matrices

The face alignment matrices to transform from frame space to normalized (0, 1) space

matrices_face

The alignment matrices to transform from normalized legacy space (0, 1) to normalized face space

matrices_head

The alignment matrices to transform from normalized legacy space (0, 1) to normalized head space

offsets_face

The (N, x, y) offsets required to shift from normalized (legacy) centering to face centering

offsets_head

The (N, x, y) offsets required to shift from normalized (legacy) centering to head centering

offsets_legacy

The (N, x, y) offsets for normalized (legacy) centering. This is always (0, 0) for all items in the batch

rotation

The estimated (N, 3, 1) rotation vectors

translation

The estimated (N, 3, 1) translation vectors

Methods Documentation

append(batch: ExtractBatchAligned) None

Append the data from the given batch object to this batch object

Parameters:

batch (ExtractBatchAligned) – The object containing data to be appended to this object

Return type:

None

apply_mask(mask: ndarray[tuple[Any, ...], dtype[bool]]) None

Apply a boolean mask to the batch object. True values are kept, False values are discarded

Parameters:

mask (ndarray[tuple[Any, ...], dtype[bool]]) – The boolean mask to apply to the object. Must be of size (landmarks, )

Return type:

None

append(batch: ExtractBatchAligned) None

Append the data from the given batch object to this batch object

Parameters:

batch (ExtractBatchAligned) – The object containing data to be appended to this object

Return type:

None

apply_mask(mask: ndarray[tuple[Any, ...], dtype[bool]]) None

Apply a boolean mask to the batch object. True values are kept, False values are discarded

Parameters:

mask (ndarray[tuple[Any, ...], dtype[bool]]) – The boolean mask to apply to the object. Must be of size (landmarks, )

Return type:

None

landmark_type: LandmarkType | None = None

The type of landmarks that the batch holds

landmarks: ndarray[tuple[Any, ...], dtype[float32]] | None = None

The face landmarks found for this batch in frame space or None if not populated

property landmarks_68: ndarray[tuple[Any, ...], dtype[float32]]

The stored landmarks as 68 point landmarks if supported, or original landmarks if not ( 4 point ROI landmarks)

property landmarks_normalized: ndarray[tuple[Any, ...], dtype[float32]]

The normalized, aligned 68 point landmarks

property matrices: ndarray[tuple[Any, ...], dtype[float32]]

The face alignment matrices to transform from frame space to normalized (0, 1) space

property matrices_face: ndarray[tuple[Any, ...], dtype[float32]]

The alignment matrices to transform from normalized legacy space (0, 1) to normalized face space

property matrices_head: ndarray[tuple[Any, ...], dtype[float32]]

The alignment matrices to transform from normalized legacy space (0, 1) to normalized head space

property offsets_face: ndarray[tuple[Any, ...], dtype[float32]]

The (N, x, y) offsets required to shift from normalized (legacy) centering to face centering

property offsets_head: ndarray[tuple[Any, ...], dtype[float32]]

The (N, x, y) offsets required to shift from normalized (legacy) centering to head centering

property offsets_legacy: ndarray[tuple[Any, ...], dtype[float32]]

The (N, x, y) offsets for normalized (legacy) centering. This is always (0, 0) for all items in the batch

property rotation: ndarray[tuple[Any, ...], dtype[float32]]

The estimated (N, 3, 1) rotation vectors

property translation: ndarray[tuple[Any, ...], dtype[float32]]

The estimated (N, 3, 1) translation vectors