# An Enhanced YOLOv5-Based Algorithm for Metal Surface Defect Detection
## 4 Experimental Results and Analysis
### Analysis of Ablation Experiments  
The model parameters of YOLOv5, YOLOv5-A, YOLOv5-B, YOLOv5-C, and IE-YOLOv5 are presented in Table 2. Table 2 presents the results, with the \"Inference Time\" column displaying the average time needed for the model to infer a single image, and the \"Weight\" column indicating the model's volume or size. Table 3 illustrates the results of the comparative experiments, showcasing how various model variants affect the performance of the YOLOv5 model:  
1. Model YOLOv5-A achieved notable improvements compared to the original YOLOv5 model. It showed a 3.6% reduction in inference time, a 0.8% increase in mean average \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Model** & **GSconv** & **Slim-Neck** & **PSA** & **Weight** & **Inference Time** \\ \hline YOLOv5 & \(\times\) & \(\times\) & \(\times\) & 23.2 MB & 2.8 ms \\ YOLOv5-A & ✓ & \(\times\) & \(\times\) & 23.2 MB & 2.7 ms \\ YOLOv5-B & \(\times\) & ✓ & \(\times\) & 27.6 MB & 2.5 ms \\ YOLOv5-C & \(\times\) & \(\times\) & ✓ & 28.2 MB & 2.7 ms \\ IE-YOLOv5 & ✓ & ✓ & ✓ & 28.2 MB & 2.5 ms \\ \hline \hline \end{tabular} \(\checkmark\) indicates that the module was introduced and \(\times\) indicates that it was not introduced.  
\end{table} 
Table 2: Comparison of model parameters. Figure 10: (**a**) Comparison of accuracy values for various networks; (**b**) comparison of loss values for various networks. precision (mAP), and a 1.6% boost in frames per second (FPS). This indicates that replacing the standard convolution (Conv) with GSConv not only reduced inference time but also improved the detection accuracy and speed. 2. The YOLOv5-B model demonstrated a 1.3% mAP improvement over the original YOLOv5 model. It validates the effectiveness of incorporating the FF-Slim-Neck structure while keeping the model's size and inference time nearly unchanged. The findings indicate that the FF-Slim-Neck structure enhanced the model's ability to generalize and improved its accuracy in detecting defects. 3. Model YOLOv5-C, which incorporated the PSA attention mechanism, showed significant improvements. It experienced a 21.6% increase in volume, which may have led to a 3.6% decrease in detection speed. However, this was balanced by a 1% increase in mAP, demonstrating the effectiveness and efficiency of the proposed PSA attention mechanism. The improved feature fusion network played a significant role in performance enhancement. In this study, the comparison between the proposed IE-YOLOv5 model and the original YOLOv5 model yields the following results:  
1. The IE-YOLOv5 model shows a 21.6% increase in volume, which indicates more parameters and potentially better representation capacity. 2. There was a 5.1% decrease in detection speed for the IE-YOLOv5 model compared with the original YOLOv5 model, suggesting a slight reduction in real-time inference performance. 3. The inference time was significantly reduced by 10.7% compared to the original YOLOv5, which shows overall computational efficiency improvement. 4. There was a 2.4% improvement in mean average precision (mAP) compared to original YOLOv5, which indicates enhanced detection accuracy across different defect types. 5. The IE-YOLOv5 model demonstrated increased detection accuracy for inclusion, roll, and scratch defects by 3.4%, 3.0%, and 2.4%, compared to the original YOLOv5, respectively. These findings demonstrate that the improved feature fusion network in the IE-YOLOv5 model effectively contributes to enhancing the algorithm's performance, especially with regard to detection accuracy and inference efficiency. The defect detection speed of IE-YOLOv5 exhibits a marginal decrement of 5.1% when compared to the original YOLOv5. This signifies that under identical hardware and environmental conditions, IE-YOLOv5 necessitates a slightly longer duration to process images and generate defect detection outcomes.