MTCNNModel

class plugins.extract.detect.mtcnn.MTCNNModel(weights_path: list[str], device: device, input_size: int = 640, min_size: int = 20, threshold: list[float] | None = None, factor: float = 0.709)

Bases: object

MTCNN Detector for face alignment

Parameters:
  • weights_path (list[str]) – List of paths to the 3 MTCNN subnet weights

  • device (torch.device) – The device to run inference on

  • input_size (int) – The height, width input size to the model. Default: 640

  • min_size (int) – The minimum size of a face to accept as a detection. Default: 20

  • threshold (list[float] | None) – List of floats for the three steps, Default: [0.6, 0.7, 0.7]

  • factor (float) – The factor used to create a scaling pyramid of face sizes to detect in the image. Default: 0.709

Methods Summary

detect_faces(batch)

Detects faces in an image, and returns bounding boxes and points for them.

Methods Documentation

detect_faces(batch: ndarray) tuple[ndarray, tuple[ndarray]]

Detects faces in an image, and returns bounding boxes and points for them.

Parameters:

batch (ndarray) – The input batch of images to detect face in

Return type:

List of numpy arrays containing the bounding box and 5 point landmarks of detected faces

detect_faces(batch: ndarray) tuple[ndarray, tuple[ndarray]]

Detects faces in an image, and returns bounding boxes and points for them.

Parameters:

batch (ndarray) – The input batch of images to detect face in

Return type:

List of numpy arrays containing the bounding box and 5 point landmarks of detected faces