## 3 Materials and Methods
### Performance Metrics  
We compared the manually annotated images with the predicted ones with the help of a confusion matrix. The performance metrics [27; 41] used to analyze the results of our research outcomes include the following:  
* Accuracy (ACC) is defined as the ratio of correct predictions to the total predictions made, as illustrated in Equation (6).
* Precision (P) and recall (R) assess the ratio of true positives in all positive predictions and determine the ratio of true positives in all actual positives, respectively. R measures the model's effectiveness in identifying all instances of a class. P and R are computed using Equations (7) and (8), respectively. Recall and sensitivity (Se) are calculated using the same, Equation (8).
* Specificity (Sp) calculates the ratio of true negatives in all negative predictions, as shown in Equation (9).
* The F1 score represents the harmonic mean of P and R, providing a balanced evaluation of the model's accuracy by taking into account false positives and negatives, as demonstrated in Equation (10).
* The receiver operating characteristic (ROC) curve is a graphical representation of a classification model's performance across all classification thresholds. It shows the trade-off between the true positive rate (TPR) and the false positive rate (FPR). TPR is also known as recall or sensitivity (Equation (8)). FPR is the ration of incorrectly identified negative instances to the total actual negative instances, illustrated in Equation (11). As the classification changes, both TPR and FPR change, and plotting them forms the ROC curve. \[\text{Accuracy}=\frac{\text{TP}+\text{TN}}{\text{TP}+\text{TN}+\text{FP}+ \text{FN}}\] (6) \[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}}\] (7)  
Figure 2: YOLOv8 architecture scheme from [40].  
\[\text{Recall or Sensitivity or TPR}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{8}\] \[\text{Specificity}=\frac{\text{TN}}{\text{TN}+\text{FP}}\] (9) \[\text{F1 score}=\frac{\text{TP}}{\text{TP}+\frac{1}{2}(\text{FP}+ \text{FN})}\] (10) \[\text{FPR}=\frac{\text{FP}}{\text{FP}+\text{TN}} \tag{11}\]  
where TP is true positive, TN is true negative, FP is false positive, and FN is false negative. Precision and recall are valuable metrics for evaluating a model's performance when class distributions are imbalanced. Specific tasks might prioritize a higher recall over precision depending on the implications of false positives versus false negatives. For example, in classifying medical images, it is crucial to reduce the rate of false negatives. Therefore, achieving a high recall or sensitivity is prioritized over high precision, as a false negative could lead to an incorrect medical diagnosis and pose risks to a patient's health [27]. As illustrated in Figure 3, a confusion matrix presents data from the experiment, summarizing the outcomes, conducting the assessment, and comparing the results across various model variants. For instance, Equations (7) and (8) can be used to compute P and R for the model displayed in Figure 3. The correct predictions are located on the primary diagonal of the confusion matrix, linking the true class names on the x-axis to the predicted class names on the y-axis. The numbers outside the main diagonal represent prediction errors. Specifically, TP equals 53, TN equals 15, FP equals 5, and FN equals 7. The P and R for this model are 91.4% and 88.4%, respectively. Finally, to properly assess the performance of the models, we calculated the AUC (area under the ROC curve), which ranges from 0 to 1. The AUC provides a single numerical summary of the model's ability to distinguish between positive and negative classes. An AUC value of 1 indicates perfect classification, while a value of 0.5 suggests the model has no discrimination ability (equivalent to random guessing). A higher AUC, such as 0.8, typically indicates better model performance.  
Figure 3: An example of a confusion matrix with the number of annotated and predicted image classes, highlighting TP, TN, FP, and FN.