model.yolo_face

Description

πŸ”² Fast face detection model that can distinguish between masked and unmasked faces.

class Node(config=None, **kwargs)[source]

Initializes and uses the YOLO face detection model to infer bboxes from image frame.

The YOLO face model is a two class model capable of differentiating human faces with and without face masks.

Inputs

img (numpy.ndarray): A NumPy array of shape \((height, width, channels)\) containing the image data in BGR format.

Outputs

bboxes (numpy.ndarray): A NumPy array of shape \((N, 4)\) containing normalized bounding box coordinates of \(N\) detected objects. Each bounding box is represented as \((x_1, y_1, x_2, y_2)\) where \((x_1, y_1)\) is the top-left corner and \((x_2, y_2)\) is the bottom-right corner. The order corresponds to bbox_labels and bbox_scores.

bbox_labels (numpy.ndarray): A NumPy array of shape \((N)\) containing strings representing the labels of detected objects. The order corresponds to bboxes and bbox_scores.

bbox_scores (numpy.ndarray): A NumPy array of shape \((N)\) containing confidence scores \([0, 1]\) of detected objects. The order corresponds to bboxes and bbox_labels.

Configs
  • model_type (str) – {β€œv4”, β€œv4tiny”}, default=”v4tiny”.
    Defines the type of YOLO model to be used.

  • weights_parent_dir (Optional[str]) – default = null.
    Change the parent directory where weights will be stored by replacing null with an absolute path to the desired directory.

  • detect (List[int]) – default = [0, 1].
    List of object class IDs to be detected where no_mask is 0 and mask is 1.

  • max_output_size_per_class (int) – default = 50.
    Maximum number of detected instances for each class in an image.

  • max_total_size (int) – default = 50.
    Maximum total number of detected instances in an image.

  • iou_threshold (float) – [0, 1], default = 0.1.
    Overlapping bounding boxes above the specified IoU (Intersection over Union) threshold are discarded.

  • score_threshold (float) – [0, 1], default = 0.7.
    Bounding box with confidence score less than the specified confidence score threshold is discarded.

References

YOLOv4: Optimal Speed and Accuracy of Object Detection: https://arxiv.org/pdf/2004.10934v1.pdf

Model weights trained using pretrained weights from Darknet: https://github.com/AlexeyAB/darknet

Changed in version 1.2.0:
yolo_iou_threshold is renamed to iou_threshold.
yolo_score_threshold is renamed to score_threshold.