# Face Spoofing Detection with Stacking Ensembles in Work Time Registration System
## 3 The Proposed Method  
This work addresses a specific problem of developing a passive face spoofing detection system that does not require user interaction. The system is tailored for integration with an employee work time registration platform, using photos provided by that system, which were usually taken with a single front smartphone camera without infrared sensors. The proposed method receives photos from the \"Identification of the person in the photo\" module, as shown in Figure 1, and detects whether the face visible in the photo is a face of a live person standing in front of a camera or the face was shown to the camera on a photo, video, or in another way. Our contributions and core innovations comprise:
* Development of a heterogeneous ensemble combining statistical and deep learning models. * Design and implementation of several new models that are used together with already existing models within the ensemble. * Designing the CNN architecture presented in Figure 3 and in Table 1, which outperforms both domain-specific and state-of-the-art general-purpose deep learning models. It should be noted that a vital component of this architecture is the pre-processing step. * Creation of a smartphone bezel-detection algorithm, which was consistently included in the highest-performing model combinations (see the detailed tables in the Appendix A). * Development of a CNN-based smartphone detection model presented in Figure 4 and Table 2.
* Implementation of a novel face context analysis algorithm. * Identification of optimal combinations of models for the ensembles. * Integration of the proposed solution into a work time registration system to detect face spoofing attempts. Figure 3: Proposed architecture of the neural network for detecting images of spoofed faces. The proposed method is structured as a two-tiered stacking ensemble, as presented in Figure 5.  
The first level of the model consists of the following modules:  
* Smartphone bezel-detection algorithm
* Smartphone detection using a CNN
* Face context analysis
* Image analysis using a CNN
* (optionally) Image analysis using the second deep neural network
* (optionally) Image analysis using the third deep neural network  
First, each of the modules predicts whether the face visible in the photo is real or spoofed. Then, the predictions of the modules are fed into a neural network that acts as a meta-classifier, producing the final authenticity decision. The individual modules are presented in detail in the following sections. Explanation why a cascade of models is used for recognition: The experiments showed that the convolutional neural network that we proposed was the best-performing model of the 10 models we tested. However, using a cascade committee of various models in the  
Figure 4: Proposed CNN architecture to detect smartphones in images. form of a stacking ensemble yielded further accuracy improvements, justifying our choice of a committee-based approach. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer (Type: Depth-Idx)** & **Output Shape** & **Param \#** \\ \hline SpooffDetectionNet & [32; 2] & – \\ \hline Conv2d: 1-1 & [32; 16; 64; 64] & 448 \\ \hline BatchNorm2d: 1-2 & [32; 16; 64; 64] & 32 \\ \hline Conv2d: 1-3 & [32; 16; 64; 64] & 2320 \\ \hline BatchNorm2d: 1-4 & [32; 16; 64; 64] & 32 \\ \hline MaxPool2d: 1-5 & [32; 16; 32; 32] & – \\ \hline Dropout: 1-6 & [32; 16; 32; 32] & – \\ \hline Conv2d: 1-7 & [32; 32; 32; 32] & 4640 \\ \hline BatchNorm2d: 1-8 & [32; 32; 32; 32] & 64 \\ \hline Conv2d: 1-9 & [32; 32; 32; 32] & 9248 \\ \hline BatchNorm2d: 1-10 & [32; 32; 32; 32] & 64 \\ \hline MaxPool2d: 1-11 & [32; 32; 16; 16] & – \\ \hline Dropout: 1-12 & [32; 32; 16; 16] & – \\ \hline Flatten: 1-13 & [32; 8192] & – \\ \hline Linear: 1-14 & [32; 64] & 524,352 \\ \hline BatchNorm1d: 1-15 & [32; 64] & 128 \\ \hline Dropout: 1-16 & [32; 64] & – \\ \hline Linear: 1-17 & [32; 2] & 130 \\ \hline Total params: & & 541,458 \\ \hline Trainable params: & & 541,458 \\ \hline Non-trainable params: & & 0 \\ \hline \hline \end{tabular}
\end{table}