# Approach for Tattoo Detection and Identification Based on YOLOv5 and Similarity Distance
## 4 The Experimental Investigation
### Estimation of the Similarity Threshold  
For further analysis, each photo was resized to a dimension of 224 \(\times\) 224 px and pre-processed for ResNet50 suitable feature extraction. Each photo is represented as a (7, 7, 2048) dimension output, where, after flattening, it contains 100,352 values for comparison. This vector was used to estimate the similarity between each suspect and each reference photo. For similarity estimation two most often used similarity methods were used: cosine and Euclidean similarity. Usually, F-score and accuracy metrics are used to define the best model. Using cosine similarity, the threshold value should be 0.45-0.5 to achieve a 48% F-score and 99% accuracy (Figure 4, left chart). For Euclidean distance, the F-score and accuracy optimal threshold value would be 525 and would allow us to achieve a 0.46% F-score and 99% accuracy (Figure 4, right chart). Figure 3: Evaluation of YOLOv5l with the highest [EMAIL_ADDRESS]:0.95. However, for suspect linking to reference photo task, accuracy and F-score are not the best measurements as the automation should work as decision support and workload reduction, but not a human replacement solution. The final results will have to be verified by a person in any case to ensure that no false results are provided. Therefore, False-positive (FP) and False-negative (FN) values are important. Table 7 presents the threshold values under which tattoo identification achieves 100% recall or precision. Accordingly, it provides numbers that indicate how much workload could be reduced in the case of suspect photos and comparisons. Suspect photos define the suspect photos, which do not require any revision, as all similarity scores to reference tattoos are below or above the threshold value and, therefore, will for sure not be linked to any of the reference photos. Meanwhile, comparison reduction indicates that some of the threshold values do not meet the interval; therefore, the suspect photo has to be compared not to all but just to some reference tattoos. The result indicates that cosine similarity is better for recall assurance situations as it allows a reduction of 2% of photos and 20% of comparisons. Meanwhile, if the task is oriented toward precision assurance, it is better to use the Euclidean distance. The difference to cosine similarity is not very high, but under the same 100% precision, it provides a lower False negative, higher True-positive, and the same True-negative rate. The zero reduction in 100% precision-oriented task for comparisons indicates that the similarity of the suspect photo was the highest among all reference tattoos; therefore, only the True-positive values were left as candidates. If the models were adjusted to take not the threshold value with multiple candidates but to link each photo with the highest similarity/lowest distance reference tattoo, the false positive ratio would increase automatically as not all suspect photos have a reference. Meanwhile, for the cosine similarity case with the highest F-score, the F-score increases from 48% to 52%, while under those conditions, the precision decreases to 42% from 56%, the recall increases from 42% to 65%, and accuracy remains 98%. For Euclidean distance, the accuracy decreases from 99% to