ignores the distance between samples in the depth (RGB) embedding space. This is important in practice, as is common to obtain substantially more data to train RGB models than depth ones ($|\mathcal{B}_2| \gg |\mathcal{B}_3|$). This suggests that in good test conditions (e.g., good lighting) one may trust more RGB features over depth features ($\gamma<1/2$). As we will empirically show in the following section, when two facial candidates are compared, $d_{\alpha,\infty,\gamma}(x^a,x^b) =  (1-\gamma)\, \delta(x^a_{rgb},\,x^b_{rgb}) + \gamma\, \delta(x^a_{\nabla z},\,x^b_{\nabla z})$ is an effective distance choice. However, it does not handle robustly common cases of spoofing attacks. The most common deployments of spoofing attacks imitate the facial texture more accurately than the facial depth [@OULU_NPU_2017; @Liu2018spoofing; @Zhang2016], therefore, the global distance between two samples should be large when the distance of the depth features is large (i.e. above a certain threshold). To that end, we introduce an additional non-linear term controlled by parameters $\beta$ and $\alpha$, for $\delta(x^a_{\nabla z}, x^b_{\nabla z}) < \beta$ the standard cosine distance dominates while for large values the distance will be amplified in a non-linear fashion.

Experiments and Discussion {#sec:Experiments}
==========================

#### Data.

Three public dataset are used for experimental validation: FaceScrub [@FaceScrub], CASIA Anti-spoofing [@zhang2012face], and ND-2006 