## 3 Methodology
### The Existing Loss Functions  
The loss function used in the field of facial identification based on deep neural networks has improved significantly over the past few years. In particular, metric learning [4; 5], has been proposed, and a representative loss function includes a triplet loss proposed in FaceNet [6]:  
\[\mid f(x_{a})-f(x_{p})\mid\mid^{2}+\alpha<\mid\mid f(x_{a})-f(x_{n})\mid\mid^{2} \tag{1}\]  
Training a deep neural network with triplet loss requires a triple dataset consisting of an anchor image (\(x_{a}\)), positive image (\(x_{p}\)), and negative image (\(x_{n}\)). The anchor image is an image of a randomly chosen class inside the dataset. The positive image is another image of the same class as the anchor. The negative image is an image of class other than the anchor. The purpose of triplet loss is to ensure that the Euclidean distance between the anchor embedding vector \(f(x_{a})\) and the positive embedding vector \(f(x_{p})\) is lower than the Euclidean distance between the anchor embedding vector \(f(x_{a})\) and the negative embedding vector \(f(x_{n})\). In Equations (1) and (2), \(f\) denotes a deep learning model. In addition, \(f\) generates an embedding vector for an image \(x\) and denotes it as \(f(x)\). An appropriate constant (\(\alpha\)) as a margin is added to increase the distance from other objects. The training of the model aims to minimize the following Equation (2), defined as the triplet loss in [6]. \[Max\ (\mid\mid f(x_{a})-f(x_{p})\mid\mid^{2}-\mid\mid f(x_{a})-f(x_{n})\mid\mid^{ 2}+\alpha,0) \tag{2}\]  
Figure 2: Architecture definition. The architecture takes as input a dog face image of size (224 \(\times\) 224 \(\times\) 3) and outputs a 32-dimensional embedding vector for the input image. The repeated block is sequentially repeated 5 times. Descriptions of ConvBlock and ResBlock are shown on the right side of the figure. Equation (2) shows that loss occurs when the sum of the margin and the Euclidean distance between the anchor embedding vector and the positive embedding vector is greater than the Euclidean distance between the anchor embedding vector and the negative embedding vector. Moreover, it is necessary to configure a dataset that is against the triplet condition for efficient learning. To this end, a hard triplet loss has been proposed. However, it may not be trained properly owing to the existence of several outliers if the entire training set is composed of a hard triplet dataset. To avoid this problem, an offline dataset reconfiguration method for each specific epoch and an online dataset configuration method for reconfiguring the dataset within a mini-batch have been proposed. Triplet loss is a Euclidean loss and is mapped to locate each class in an infinite vector space. However, the triplet loss is not conducted for training in an infinite vector space. FaceNet [6] adds an L2-norm layer to the end of the model to train the face recognition model with the triplet loss. Triplet loss was also used to train a model for dog face identification [31]. The L2-norm layer normalizes the length of the embedding vector to \(1\). The triplet loss here is the cosine similarity. The loss function related to the recently proposed face recognition model is ArcFace loss [9]. ArcFace loss compares the angles between embedding vectors, unlike triplet loss compares Euclidean distances. Therefore, in ArcFace [9], the triplet loss is transformed as shown in Equation (3):  
\[arccos\left(f(x_{a}),f(x_{p})\right)+\alpha<arccos\left(f(x_{a})-f(x_{n})\right) \tag{3}\]  
In Equation (3), arccos is the angle of the two input embedding vectors.