Skip to main content

FaceAlignment

Performs face alignment in preparation for face recognition.

This module provides a pipeline element to perform the necessary preprocessing to prepare the input image for input into the face recognition model. This is done by applying an affine transform to the image to align the image's landmarks with the reference landmarks. This module is configured for arcface. Other embedding models may require different preprocessing.

Examples:

REST API:

WIP

Configuration File:

short-from : face-alignment

pipeline:
- yolov5s-face:a:0.3:0.3
- demux
- face-alignment
- arcface
- mux
- arcface-identifier:redis
sources:
- address: videos/sample.mp4
- type: file

FaceAlignment Objects

class FaceAlignment(Element)

Performs face alignment in preparation for face recognition.

Attributes:

  • name str - Name of the element.

Examples:

ele = FaceAlignment()

process

@parallel
def process(meta)

Process each frame in the metadata and perform face alignment.

This is the main function for the element. This element functions after a demux which means the image has been partitioned into separate meta elements for re-id. This does face alignment before sending it to the re-id. If there is no detection send it on to the next element

Arguments:

  • meta dict - The metadata to process.

Returns:

  • meta dict - The processed metadata.

Examples:

ele = FaceAlignment()
meta = ele.process(meta)