# Boosting Iris Recognition by Margin-Based Loss Functions
## 3 Proposed Approach
### Combined Loss of ArcFace and Triplet  
The selected loss function to combine, ArcFace, is based on changes in the SoftMax with a triplet loss function. Softmax loss can be expressed as follows:  
\[L_{Softmax}=-\frac{1}{N}\sum_{i=1}^{N}log\frac{e^{W_{y_{i}}^{T}x_{i}+y_{i}}}{ \sum_{j=1}^{n}e^{W_{y_{i}}^{T}x_{i}+y_{i}}}, \tag{1}\]  
where \(x_{i}\in\mathbb{R}^{d}\) represents the deep feature vector or output from the last CNN layer to the fully connected layer of the \(i\)-th sample belonging to the \(y_{i}\)-th class. \(W_{j}\in\mathbb{R}^{d}\) is the \(j\)-th column of the weight matrix \(W_{j}\in\mathbb{R}^{d\times n}\) and \(b_{j}\in\mathbb{R}^{n}\) is the bias term. \(n\) is the class number,  
Figure 1: Overview of the proposed framework. and \(N\) is the batch size. The SoftMax loss function cannot optimize deep feature vectors to achieve better intra-class similarity and the scattered distribution of samples can cause problems for clustering. Large Margin Cosine Loss [12] followed [11] initially set the bias value to zero. In \(W_{j}^{T}x_{i}=\parallel W_{j}\parallel\parallel x_{i}\parallel\cos\theta_{j}\), where \(\theta_{j}\) is the angle between feature vectors \(x_{i}\) and the ground truth weight \(W_{j}\), the authors fixed \(\parallel W_{j}\parallel=1\) and \(\parallel x_{i}\parallel\) by \(l_{2}\) normalization and re-scaled \(\parallel x_{i}\parallel\) to \(s\). Normalizing the weights and features yields predictions based on only the angle between them. Each embedding has a radius \(s\) and is distributed on the hypersphere. They named it \"CosFace\". \[L_{co}=-\frac{1}{N}\sum_{i=1}^{N}log\frac{e^{s(\cos(\theta_{y_{i}})-m)}}{e^{s( \cos(\theta_{y_{i}})-m)}+\sum_{j=1,j\
eq y_{i}}^{n}e^{s\cos\theta_{j}}} \tag{2}\]  
By taking advantage of the fact that the embedding features are distributed around each center on the hypersphere, the work in [13] added an additive angular margin penalty between \(x_{i}\) and \(W_{y_{i}}\) to enhance the intra-class compactness and inter-class dispersion simultaneously. The authors named their method \"ArcFace\". \[L_{aa}=-\frac{1}{N}\sum_{i=1}^{N}log\frac{e^{s(\cos(\theta_{y_{i}}+m))}}{e^{s( \cos(\theta_{y_{i}}+m))}+\sum_{j=1,j\
eq y_{i}}^{n}e^{s\cos\theta_{j}}}. \tag{3}\]  
Compared with CosFace and similar loss functions, ArcFace has a better geometric property because of the exact alignment of angular margin with geodesic distance. Table 1 provides us with geometric comparisons differences of different decision margins. In binary classification, ArcFace has a fixed linear margin across the decision boundaries, whereas CosFace creates only a nonlinear margin. ArcFace loss functions can classify more accurately, since \(\theta\in[0,\pi-m]\), \(\cos(\theta+m)<\cos(\theta)\). In addition, because of \(\sin(\theta)\) in \(cos(\theta+m)=\cos\theta\cos m-\sin\theta\sin m\), the new margin is more dynamic. Figure 2: Sample results for the iris bounding box detection and mask segmentation from the method that was proposed in [41] (**a**,**c**) and with the proposed method to remove reflections (**b**,**d**). FaceNet [36] first uses triplet loss to learn deep representations of faces. In the presence of triplet loss, the positive pairs tend to have smaller distances than the negative pairs. In terms of mathematics, the loss can be described as follows using the Euclidean distance function:  
\[L=\frac{1}{N}\sum_{i}^{N}\text{max}\Big{(}\parallel f(x_{i}^{a})-f\Big{(}x_{i}^ {p}\Big{)}\parallel_{2}^{2}-\parallel f(x_{i}^{a})-f(x_{i}^{n})\parallel_{2}^ {2}+\alpha,0\Big{)} \tag{4}\]  
\[\forall\Big{(}f\big{(}x_{i}^{a}\big{)},f\Big{(}x_{i}^{p}\Big{)},f\big{(}x_{i}^ {n}\big{)}\Big{)}\in\tau\]  
where \(\big{(}f\big{(}x_{i}^{a}\big{)},f\Big{(}x_{i}^{p}\Big{)}\big{)}\) and \(f\big{(}x_{i}^{n}\big{)}\) represent the feature vectors of the positive pairs \((x_{i}^{a},x_{i}^{p})\) and the negative pairs \((x_{i}^{a},x_{i}^{n})\) and \(\alpha\) is the distance margin. Training samples with too few samples limit the effectiveness of feature embedding.