# A Lightweight TA-YOLOv8 Method for the Spot Weld Surface Anomaly Detection of Body in White
## 4 Experiment
### Evaluation and Analysis  
To objectively assess the performance of models used for detecting welding spot defects, several evaluation metrics are employed. These include GFLOPS (Giga Floating-point Operations Per Second), which quantifies the model's execution efficiency by measuring the number of floating-point operations performed per second. Model parameters are also considered to assess the model's size and complexity. Additionally, FPS (Frames Per Second) is used to gauge detection speed by recording the number of frames processed per second. Model accuracy is assessed using mean Average Precision (_mAP_), calculated as shown in Equation (4). The \(F_{1}\)-score, representing a weighted average of precision and recall, is used to evaluate the model's overall performance and stability, with its calculation given in Equation (5). \[mAP=\frac{\sum P_{A}}{N} \tag{4}\]  
\[F_{1}-S=2\times\frac{P\times R}{P+R} \tag{5}\]  
In Equation (4), \(N\) denotes the total number of categories. \(P_{A}\) represents the area beneath the precision-recall curve, where recall values are plotted on the x-axis and precision values on the y-axis. The metric [EMAIL_ADDRESS] denotes the mean Average Precision at a CIoU threshold of 0.5. In Equation (5), precision measures the model's ability to distinguish between positive and negative samples, with higher precision indicating an improved distinction of negative samples. \(S\) represents score, \(P\) means precision, and \(R\) represents recall rate. Recall assesses the model's effectiveness in identifying positive samples, where higher recall signifies a more accurate detection of positive instances. The \(F_{1}\)-S provides a balance between precision and recall, where a higher \(F_{1}\)-S reflects a model with stronger overall performance and robustness. The impact of integrating different attention modules on the model's detection accuracy is presented in Table 3. These experiments were conducted on the YOLOv8 model, in which the neck structure was reconfigured as shown in Figure 3. From the results in Table 3, it is evident that adding different attention modules slightly increases the computational load and parameter count. The model's [EMAIL_ADDRESS] value demonstrates some variability, where the addition of the channel attention module alone produces a moderate improvement in [EMAIL_ADDRESS]; however, in specific instances, a reduction in accuracy is also observed. When combining both channel and spatial attention within the CBAM module in YOLOv8, the network achieves further accuracy gains over the configuration with channel attention alone, with an increase of up to 0.9%. This suggests that spatial attention further enhances detection accuracy. Notably, the spatial attention mechanism in MC-FPN yields an impressive accuracy of 90.13%, representing a substantial improvement rate of 1.55%, while also providing faster detection speeds than the configuration with the CBAM module. Based on the preceding data, we reconstruct the neck structure of YOLOv8 into MC-FPN, resulting in a 32% reduction in the model's parameter count and a 12.5% decrease in computational complexity. Additionally, model accuracy, measured by [EMAIL_ADDRESS], improved by 1.9%. Replacing SPPF with SimSPPF had minimal effects on model accuracy, parameter count, and computational complexity, although it increased detection speed by 2 frames per second (FPS). The introduction of the Task-Aligned head module, while slightly increasing the parameter count and computational complexity, contributed an additional 1.3 percentage points in [EMAIL_ADDRESS] accuracy. Combining MC-FPN with the SPPF module improved model accuracy while reducing both computational complexity and parameter count. Overall, the enhanced YOLOv8 version, integrating MC-FPN, SimSPPF, and TA-Head modules, outperformed the baseline YOLOv8 model in terms of detection accuracy, computational complexity, and parameter count.