# An Improved YOLOv5 Model for Detecting Laser Welding Defects of Lithium Battery Pole
## 3 Experiments and Analysis
### Experimental Results and Discussion
#### 3.2.1 Experiments on BPLWD Dataset  
We experimentally compared the improved YOLOv5 algorithm (YOLOv5-ours) with the more influential one-stage algorithms YOLOv5, YOLOv7, YOLOv6, and YOLOX in recent years, and the results are shown in Table 4 and Figure 7. Our improved YOLOv5 improved the average accuracy by 1.1% compared to the original model. It increased the precision and recall of the welding hole by 1.5% and 2%, respectively, and the recall of bulge by 1.6%. Despite the larger computation of the model, the inference speed remained within 2 ms, and the fps reached 270, which is fully capable of real-time industrial inspection. As shown in Figure 7, YOLOv5-ours had the highest average accuracy compared with the other four YOLO algorithms. This demonstrates that our improved model has good detection performance and can meet the industrial requirements for detecting the laser welding defects of a lithium battery pole.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Name** & **Value** \\ \hline Size of picture & 640 \(\times\) 640 \\ Epochs & 200 \\ Batch size & 32 \\ Learning rate & 0.01 \\ Momentum & 0.937 \\ Weight decay & 0.0005 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Parameter setting.  
We selected four recently proposed lightweight CNN modules: MobileNetV3 [33], GhostNet [34], EfficientNet [35], ShuffleNetV2 [36], and replaced RepVGG in the YOLOv5-ours network with the above modules to compare the effects of the detection accuracy and performance of different modules. The experimental results are shown in Table 5, and the network using the RepVGG module had the highest detection accuracy and fast inference speed, indicating that the RepVGG module based on structural re-parameterization can increase the model's detection accuracy and shorten the inference time.  
Additionally, we compared the defect detecting effects of the original YOLOv5 and our improved YOLOv5 algorithm, and the results are shown in Figure 8. Obviously, YOLOv5 had a low confidence level for the detection welding hole, and missed detecting the bulge  
\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Algorithm** & **Category** & **P (\%)** & **R (\%)** & **AP (\%)** & **[EMAIL_ADDRESS] (\%)** & **fps** & **GFLOPs** & **Latency (ms)** \\ \hline YOLOv5-ours & W & 95.2 & 93.0 & 96.4 & & & \\ \cline{2-8} ours & B & 94.7 & 95.3 & 97.6 & & & \\ \hline YOLOv5 & W & 93.7 & 91.0 & 95.1 & & & \\ \cline{2-8} YOLOv5 & B & 96.0 & 93.7 & 96.7 & & & \\ \hline YOLOv7 & W & 93.0 & 88.9 & 94.6 & & & \\ \cline{2-8} YOLOv7 & B & 95.7 & 94.6 & 96.1 & & & \\ \hline YOLOv6 & W & 95.7 & 88.7 & 96.2 & & & \\ \cline{2-8} YOLOv6 & B & 92.5 & 93.2 & 96.0 & & & \\ \hline YOLOX & W & 87.9 & 87.2 & 89.1 & & & \\ \cline{2-8} YOLOv5 & B & 87.4 & 89.1 & 90.4 & & & \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison experiments of the different algorithms.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Algorithm** & **[EMAIL_ADDRESS] (\%)** & **[EMAIL_ADDRESS]:0.95 (\%)** & **Latency (ms)** \\ \hline YOLOv5-ours(RepVGG) & 97 & 61.2 & 1.7 \\ YOLOv5-ours(MobileNetV3) & 95.5 & 58.9 & 1.8 \\ YOLOv5-ours(GhostNet) & 95.3 & 60.1 & 3.5 \\ YOLOv5-ours(EfficientNet) & 95.5 & 60.6 & 3.6 \\ YOLOv5-ours(ShuffleNetV2) & 96.1 & 58.5 & 1.6 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Comparison of different lightweight models.  
Figure 7: Comparison of the accuracy of different algorithms.  
defects. Relatively, the YOLOv5-ours model not only successfully detected all of the defects, but also improved the confidence score. The results indicate that our improved algorithm is good at feature extraction and can better meet the industrial requirement of a low miss inspection rate for detection tasks.