# Coupling RetinaFace and Depth Information to Filter False Positives
## 2 Materials and Methods
### Face Detectors: RetinaFace and YOLOv7  
RetinaFace [16] is a recent pixel-wise face detection method that, along with box classification and regression branches, applies extra-supervised and self-supervised techniques/learning tasks. The face detector system is able to perform multiple tasks, including predicting a face score, identifying the bounding box around a face, identifying five facial landmarks, and determining the 3D position and correspondence of each pixel on the face. The system's overall structure is depicted in Figure 3.  
RetinaFace is based on three main modules made by a feature pyramid network, the context head module, and the cascade multi-task loss. The first module is composed of a pyramid network that digests the input images by computing five different feature maps, each one at a different scale. These are then used by the context head modules to compute, for each of the feature maps, the multi-task loss described below. The first context head module makes a first bounding box for the anchor, which is fine-tuned by the second context head module to generate a more accurate bounding box.  
Feature pyramid levels are computed using ResNet residuals, while the multi-task loss is computed as follows:  
\[\mathcal{L}=\mathcal{L}_{cls}(p_{i},p_{i}^{*})+\lambda_{1}\;p_{i}^{*}\mathcal{ L}_{box}(t_{i},t_{i}^{*})+\lambda_{2}\;p_{i}^{*}\mathcal{L}_{pts}(l_{i},l_{i}^{*})+ \lambda_{3}\;p_{i}^{*}\mathcal{L}_{mesh}(v_{i},v_{i}^{*}) \tag{6}\]  
where \(p_{i}\) is the predicted probability that the i-th anchor is a face, while \(p_{i}^{*}\) is the ground-truth value (1 if it is a face, 0 otherwise); \(t_{i}\) is a vector with the predicted coordinates for the bounding box of the i-th anchor, and \(t_{i}^{*}\) is the vector with the coordinates of the real bounding box. The vector \(l_{i}\) contains the predicted coordinates of the five facial landmarks, while \(l_{i}^{*}\) is the vector with the coordinates for the five ground-truth facial landmarks. The vector, \(v_{i}\), has the 1068 vertices used for the mesh that represents the 3D face, and \(v_{i}^{*}\) is the corresponding ground-truth. The variables \(\lambda_{1}\), \(\lambda_{2}\), and \(\lambda_{3}\) are loss-balancing parameters. \(\mathcal{L}_{mesh}\) is a combination of a vertex loss and an edge loss used to compute a 2D projection of a 3D representation of the face; \(\mathcal{L}_{cls}\) is the classification loss for the binary classes of face/not face. \(\mathcal{L}_{box}\) is the regression loss for the bounding box, and \(\mathcal{L}_{pts}\) is the regression component used to compute the five facial landmarks.  
YOLOv7 is the latest and fastest single-stage real-time object detector in the YOLO family, introduced in July 2022 [26]. It is a fully convolutional neural network (FCNN)-based object detector with three components: Backbone, Neck, and Head. The Backbone extracts features, the Neck collects them, and the Head consists of output layers for final detection. YOLO models are trained to predict the locations and classes of objects with bounding boxes and use non-maximum suppression (NMS) for post-processing. We used YOLO as face detector according to following library ([[https://github.com/hpc203/yolov7](https://github.com/hpc203/yolov7)]([https://github.com/hpc203/yolov7](https://github.com/hpc203/yolov7)) -detect-face-onnxrun-cpp-py, accessed on 30 December 2022).  
Figure 3: RetinaFace detector.