# Approach for Tattoo Detection and Identification Based on YOLOv5 and Similarity Distance
## 4 The Experimental Investigation
### The Experiments Performed on the Influence of Hyperparameters of YOLOv5  
To find out which size of the YOLOv5 model (n, s, m, l, x) and which hyperparameters allow to obtain the highest tattoo detection results, an additional experiment has been performed using the data augmentation options from previous experiment results. Related works have shown that, in various investigations, usually only three hyperparameters are changed to improve the results: learning rate, momentum, and weight decay. Therefore, in this investigation, the combination of five YOLOv5 models and three hyperparameters has been analyzed. The hyperparameters changed in this way:  
* learning rate: 0.01; 0.001; 0.0001;
* momentum: 0.9; 0.935; 0.95;
* weight decay: 0.0001; 0.0005; 0.0007.  
In this way, a total of 135 models were trained and tested (26 models for each size of the YOLOv5). The other parameters have been chosen considering the primary research performed and have not been changed during the training of all 135 models. This ensured the same condition during the experimental investigations in this research. The fixed parameters of YOLOv5 are as follows:  
* image size: 320 \(\times\) 320;
* batch size: 32;
* number of epochs: 300;
* optimizer: SGD.  
In Table 5, the average results for each size of the YOLOv5 model are presented. As we can see (Table 5), the highest averaged precision results are obtained by YOLOv5m (0.87). Slightly small results are obtained by YOLOv5l (0.86), YOLOv5s (0.85), and YOLOv5x (0.81). The smallest averaged precision is obtained by YOLOv5n, which is equal to 0.67. All estimation measures are significantly smaller using YOLOv5n compared to other sizes of the models. The highest average recall value is obtained by the YOLOv5l model (0.70). In the case of mAP values, slightly better results are also obtained using the YOLOv5l model, where [EMAIL_ADDRESS] is equal to 0.79 and [EMAIL_ADDRESS]:0.95 is equal to 0.60. In Table 6, the standard deviation for each size of the YOLOv5 model is presented. As we can see, the deviation is not high, so it means that there is no very high influence on which hyperparameters will be used to train the tattoo detection model.  
Summarizing the results of the experimental investigation on the influence of hyperparameters, the YOLOv5l model has been chosen as the basis for tattoo detection. The  
\begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Estimation** & **YOLOv5 Model** & **YOLOv5n** & **YOLOv5s** & **YOLOv5m** & **YOLOv5l** & **YOLOv5x** \\ \hline Precision & 0.16 & 0.06 & 0.04 & 0.06 & 0.07 \\ \hline Recall & 0.17 & 0.02 & 0.03 & 0.05 & 0.03 \\ \hline [EMAIL_ADDRESS] & 0.19 & 0.02 & 0.02 & 0.03 & 0.02 \\ \hline [EMAIL_ADDRESS]:0.95 & 0.13 & 0.02 & 0.03 & 0.02 & 0.01 \\ \hline \hline \end{tabular}
\end{table}
Table 6: The standard deviation results of 26 model estimations for each size of the YOLOv5 model.  
\begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Estimation** & **YOLOv5 Model** & **YOLOv5n** & **YOLOv5s** & **YOLOv5m** & **YOLOv5l** & **YOLOv5x** \\ \hline Precision & 0.67 & 0.84 & 0.87 & 0.86 & 0.81 \\ \hline Recall & 0.46 & 0.67 & 0.68 & 0.70 & 0.67 \\ \hline [EMAIL_ADDRESS] & 0.52 & 0.75 & 0.78 & 0.79 & 0.76 \\ \hline [EMAIL_ADDRESS]:0.95 & 0.31 & 0.51 & 0.58 & 0.60 & 0.59 \\ \hline \hline \end{tabular}
\end{table}
Table 5: The average results of 26 model estimations for each size of the YOLOv5 model.  
highest values of [EMAIL_ADDRESS] (0.82) and mAP0.5:0.95 (0.63) have been obtained using such hyperparameters of YOLOv5l: the learning rate is set at 0.001; momentum is set at 0.95; the weight decay is set at 0.0001. In this case, the precision is equal to 0.87, and the recall is 0.75. In addition, in Figure 3, the graphs of precision, recall, [EMAIL_ADDRESS], and [EMAIL_ADDRESS]:0.95 are presented.