# Detection of Welding Defects Using the YOLOv8-ELA Algorithm
## 3 Experiments and Results
### Comparative Experiments  
The model's performance is assessed using the [EMAIL_ADDRESS] metric in the experimental results. The [EMAIL_ADDRESS] (mean average precision at an IoU threshold of 0.5) represents the average precision (_AP_) calculated at an intersection over union (IoU) threshold of 0.5. Both the _AP_ and _mAP_ are metrics used to evaluate the average precision of the object detection model. \[AP=\frac{TP+TN}{TP+TN+FP+FN} \tag{7}\]  
\[mAP=\frac{\sum_{n=1}^{Num(class)}AP(n)}{TP+TN+FP+FN} \tag{8}\]  
In the context of object detection, Formula 8 establishes the evaluation metrics as follows: true positives (_TPs_) represent accurately localized defect instances, true negatives (_TNs_) denote correctly identified background regions, false positives (_FPs_) indicate erroneous detections in non-defective areas, and false negatives (_FNs_) correspond to undetected defect instances. The inherent challenge of precise localization in object detection tasks frequently results in zero _TP_ values, particularly when the intersection over union thresholds are strictly enforced. In terms of the processing speed, the _FPS_ (frames per second) metric is adopted to evaluate the real-time performance. A higher _FPS_ value indicates faster processing capability, representing the number of images that can be processed per second. The _FPS_ calculation is derived from the total processing latency per image, as expressed in Formula (9):  
\[FPS=1000/(p+i+NMS) \tag{9}\]  
Specifically, \(p\) represents the time for image pre-processing, \(i\) represents the inference time, and _NMS_ represents the post-processing time. Additionally, the model's parameter count is denoted by Parameters, and the model's computational resource consumption is measured by the FLOPs. Figure 10: Partitioning of the dataset. As shown in Table 2, the YOLOv8 algorithm outperforms the RT-DETR, YOLOv5s, and YOLOv7-Tiny models in terms of all the parameters, achieving the highest precision. The improved YOLOv8-ELA model increases the average precision for pores, slag inclusions, and incomplete penetration by 1.4%, 2.3%, and 0.1%, respectively, compared to the original YOLOv8 model, while maintaining a minimal impact on the detection speed (FPS), parameter count (#Params), and floating-point operations (FLOPs). It also achieves a 1.3% improvement in the overall mAP. Compared with manual detection that relies on operator experience, acquiring a single DR image takes an average of 5-8 s (including moving, focusing, and recording time), and operator fatigue can lead to an increased missed detection rate. The FPS of YOLOv8-ELA measured in the experiment is 93.5, which is significantly higher than that of traditional manual detection. Table 2 shows the comparison of the _precision_ and _recall_ of the model, in which the calculation formulas for the precision and recall are shown in Equations (10) and (11), where the higher the precision, the lower the probability of error detection, and the higher the recall, the lower the probability of omission detection. Table 3 shows the \(F1\) index, which is essentially the harmonic mean of the _precision_ and _recall_, which is used to measure the balance ability of the model between reducing missed detection (_recall_) and suppressing false detection (_precision_), and its formula is shown in Equation (12). \[Precision=\frac{TP}{TP+FP} \tag{10}\]  
\[Recall=\frac{TP}{TP+FN} \tag{11}\]  
\[F1=\frac{2 Precision\times Recall}{Precision+Recall} \tag{12}\]  
By integrating the data from Tables 3 and 4, it is evident that YOLOv8 ELA demonstrates superior performance compared to other models in terms of the recall rate and \(F1\) score. Specifically, for accuracy, the model performs exceptionally well on slag inclusion and incomplete penetration defects, surpassing the other models. However, its accuracy for detecting pores is lower than that of YOLOv8, indicating that the improved model exhibits reduced accuracy for this specific defect type.