## 4 Implementation
### Dataset and Model Definition  
The dog face dataset collected in [31] was used for the training set. The dog face dataset has 1393 classes of dogs, 8363 images. In [31], the author selected 485 dogs with  
Figure 5: Stage 2 L2-normalization (L2-norm) removal and triplet loss learning model.  
Figure 6: Results of the modified national institute of standards and technology (MNIST) values for changes in the distribution of embedding vectors of each learning method. (**a**) initial state; (**b**) triplet loss; (**c**) stage 1; (**d**) stage 2.  
more than 5 photos that are easy to learn from the dataset for training and testing. In addition, to prevent overfitting, the training set is augmented by zooming into the images (zoom range = 0.1), by rotating them (rotation range = 8\({}^{\circ}\)), and by shifting their channels (channel shift range = 0.1). In this paper, 1001 dogs, including all dogs with 5 or more images, were trained and tested as a class to verify the robustness even with low normality. A total of 7040 images of 1001 dogs were used. A total of 6460 images of 901 dogs, which was 90% of the selected dataset, were used as the training set, and the remaining 580 images of 100 dogs were used for the testing set. In addition, both the training set and the testing set are augmented by zooming, rotating, and shifting channels for data augmentation. Figure 7 shows an example of the dog face dataset.  
For the model, the ResNet-like model proposed in [31] was used by changing its input image size to (224 \(\times\) 224 \(\times\) 3), as shown in Figure 2. Online adaptive hard triplet was used as a triplet dataset configuration method to sufficiently train the increased number of dogs. Unlike the existing hard triplet configuration, the adaptive hard triplet configuration method adjusted the ratio of the hard dataset according to the loss value of the model:  
\[G\ (Loss)\ =\ exp\ (-Loss\times\ \frac{C}{BS}) \tag{13}\]  
Equation (13) calculates the hard triplet ratio to the loss and has a value between 0 and 1. \(BS\) indicates the batch size, and \(C\) indicates a constant. The sensitivity of the hard triplet ratio to loss is adjusted by the constant \(C\). A batch size of 30 and \(C\) of 10 was used. Equation (13) was multiplied by 10 so that the maximum number of hard triplets was 10, which is 1/3 of the batch size. The number of hard triplets increased as the loss decreased and reached 10 when the loss was zero. The value in Equation (13) is rounded to an integer and used as the number of hard triplets. The same model was trained on both the base method and the proposed method for a performance evaluation and comparison. The online adaptive hard triplet was used as the dataset configuration method. The alpha of the triplet loss was 0.3. The model's compiler used Adam optimizer, and the learning rate was \(1\times 10^{-4}\) in the entire epoch.  
In this paper, the dataset and the ResNet-like model of [31] were used. In dog face identification based on deep learning, [31] achieved the state of the art. Therefore, based on the learning method presented in [31], the state-of-the-art (SOTA) model was trained and tested for the same dataset. In [31], offline hard triplet was used as a triplet dataset  
Figure 7: An example of the dog face dataset.  
configuration method. The offline triplet dataset is regenerated every 3 epochs. The alpha of the triplet loss was 0.3. The model's compiler used Adam optimizer. The learning rate is scheduled as shown in Table 1. In this paper, a total of 3 models were compared.  
For comparison, models were implemented by applying various learning methodologies to the architecture illustrated in Figure 2. We trained the model with SOTA, the existing triplet loss and the ArcFace, including the L2-norm layer as shown in Figure 1. In addition, we trained the model by combining the proposed loss function and learning method with triplet loss and the ArcFace.