# UnifiedFace: A Uniform Margin Loss Function for Face Recognition
## 3 Our Method
### UnifiedFace  
To unify the additive and multiplicative margins, an additive margin is introduced in the target angle activation function \(\psi(\theta)\) and a multiplicative margin is added in the non-target angle activation function \(\eta(\theta)\). Following the conventional additive margin loss function [9], we first designed \(\psi(\theta)\), as follows:  
\[\psi(\theta)=cos(\theta+m) \tag{10}\]  
where \(m\) is usually an additive margin penalty. In addition, to design a reasonable loss function with multiplicative margin, we construct \(\psi(\theta)\) and \(\eta(\theta)\) satisfying the following relation:  
\[\psi(\theta)=\eta(M\theta),\theta\in[0,\pi] \tag{11}\]  
where \(M\) is usually the specified normal number. Therefore, we design a novel non-target activation function \(\eta(\theta)\):  
\[\eta(\theta)=cos(\frac{\theta+m}{M}) \tag{12}\]  
where \(M=e^{m}\). From Figure 4b, we can observe the change in the trend of UnifiedFace at different \(m\) in detail. The characteristic functions at different values of \(m\) all follow the angular margin minimum for simple samples and maximum for medium hard samples. Meanwhile, a sufficiently large angular margin is given for hard samples. Compared with other popular loss functions of characteristic functions, UnifiedFace can obtain the maximum angular margin for medium hardness samples. Furthermore, UnifiedFace does not give too much angular margin to hard samples leading to an excessive focus on these hard samples during training compare to SphereFaceR v2. To facilitate understanding, the binary case is considered to illustrate intuitively the uniform additive and multiplicative margins. Figure 5 intuitively compares the no angular margin, multiplicative angular margin, additive angular margin, and uniform angular margin. For a sample \(x\), if no margin is introduced, \(cos(\theta_{1})=cos(\theta_{2})\) becomes the decision boundary for class 1, i.e., the decision boundary is \(\theta_{1}=\theta_{2}\), as illustrated in Figure 5a. When both additive and multiplicative margins are introduced, it also means that \(\psi(\theta)=\psi_{1}(\theta)\) and \(\eta(\theta)=\eta_{1}(\theta)\). \(cos(\theta_{1}+m)=cos(\frac{\theta_{2}+m}{M})\) is the decision boundary for class 1. When the sample \(x\) belongs to class 1, it is required that \(cos(\theta_{1}+m)>cos(\frac{\theta_{2}+m}{M})\). Correctly classifying sample \(x\) into class 1 requires \(\theta_{1}+m<\frac{\theta_{2}+m}{M}\), while correctly classifying sample \(x\) into class 2 requires \(\theta_{2}+m<\frac{\theta_{1}+m}{M}\). As shown in Table 3, the decision boundary of UnifiedFace is more stringent. That is when the sample \(x\) belonging to class 1 is correctly classified, \(\theta_{1}\) is smaller than the other loss functions of both additive margin and multiplicative margin. The process of UnifiedFace supervise face recognition network is illustrated in Figure 6. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Method** & **Non-Target Function** & **Target Function** & **Characteristic Function** \\ \hline SphereFace & \(cos(\theta)\) & \((-1)^{k}cos(m\theta)-2k\) & \(cos(\theta)-(-1)^{k}cos(m\theta)+2k\) \\ SphereFaceR v1 & \(cos(\theta)\) & \(cos(min(m,\frac{\pi}{\theta})\cdot\theta)\) & \(cos(\theta)-cos(min(m,\frac{\pi}{\theta})\cdot\theta)\) \\ SphereFaceR v2 & \(cos(\frac{\theta}{m})\) & \(cos(\theta)\) & \(cos(\frac{\theta}{m})-cos(\theta)\) \\ CosFace & \(cos(\theta)\) & \(cos(\theta)-m\) & \(m\) \\ ArcFace & \(cos(\theta)\) & \(cos(\theta+m)\) & \(cos(\theta)-cos(\theta+m)\) \\ UnifiedFace & \(cos(\frac{\theta+m}{M})\) & \(cos(\theta+m)\) & \(cos(\frac{\theta_{1}+m}{M})-cos(\theta+m)\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Different margin\(-\)based loss functions for the characteristic functions. Figure 5: (**a**) No angular margin; (**b**) is the multiplicative margin; (**c**) is the additive margin; (**d**) is the uniform angular margin. Figure 6: Detailed supervision of DCNN by UnifiedFace loss function.