## 5 Conclusions and Prospect  
This study proposes an optimized industrial pipeline X-ray weld seam defect detection model based on YOLOv5, in which the EMA attention mechanism is incorporated into the first C3 module of the backbone network, the ECA attention mechanism is added before the SPPF layer, and the WIoU loss function replaces the CIoU loss function. The training experiments demonstrate that, compared to the original YOLOv5 model, the improved version introduces only a minimal increase in parameter count. Although the inference speed (FPS) decreases by 18.94, the Precision, Recall, and [EMAIL_ADDRESS] values reach 94.1%, 89.2%, and 94.6%, respectively--representing improvements of 11.5%, 5.4%, and 6.9%. Comparative evaluations show that the improved model outperforms several mainstream object detection algorithms, including Faster R-CNN, SSD, RT-DETR, YOLOv3, YOLOv5, YOLOv8, YOLOv9, and YOLOv10, achieving higher AP and [EMAIL_ADDRESS] scores across various defect categories, while maintaining a better balance between speed and accuracy. Specifically, the [EMAIL_ADDRESS] of the optimized YOLOv5 model exceeds that of Faster R-CNN, SSD, RT-DETR, YOLOv3, YOLOv8, YOLOv9, and YOLOv10 by 14.89%, 13.02%, 6.1%, 19.37%, 7.1%, 7.5%, and 10.7%, respectively, demonstrating its effectiveness in addressing the automated detection of weld seam defects. Ablation studies confirm that the three improvement strategies work synergistically to significantly enhance the model's detection performance, with particularly notable improvements observed in the accuracy of detecting non-penetration and crack defects. Confusion matrix analysis further reveals that, overall, the improved model exhibits strong classification capability for all defect types. However, some misclassification of linear defects and missed detections of cracks remain. In practical defect detection scenarios, the optimized model substantially increases the confidence scores for all defect types compared to the baseline YOLOv5 and accurately identifies defect categories, thereby reducing the incidence of misclassification. These findings indicate that the proposed model can significantly improve the accuracy of X-ray weld seam defect detection and meet the demands of industrial applications. Since deep learning-based detection models typically require large datasets for effective training, future work will focus on expanding the defect image database by collecting more annotated X-ray images to enhance the model's generalization capability. Additionally, due to the complex and irregular morphological characteristics of cracks--often appearing as filamentous or reticulated structures--the current model still shows limitations in accurately detecting crack defects. Enhancing the detection accuracy for this particular defect type will be a key focus in subsequent research. Furthermore, to enable deployment on embedded devices, future work will explore network structure optimization and model compression techniques such as pruning and knowledge distillation to achieve further model lightweighting. Conceptualization, G.S. and W.L. ([PERSON]); methodology, G.S. and X.S. ; software, G.S. and Q.W. ; validation, G.S., X.S. and Q.W. ; formal analysis, G.S. and X.S. ; investigation, G.S., Q.W. and W.L. ([PERSON]); resources, G.S. ; data curation, G.S. and W.L. ([PERSON]); writing--original draft preparation, G.S. ; writing--review and editing, W.L. ([PERSON]); visualization, G.S. and X.S. ; supervision, W.L. ([PERSON]); project administration, W.L. ([PERSON]); funding acquisition, W.L. ([PERSON]). All authors have read and agreed to the published version of the manuscript. This research was funded by National Natural Science Foundation of China (grant no. 52066002). Not applicable. The data presented in this study are available on request to the authors and will not be made public due to privacy and ethical concerns. Conflicts of Interest: Author [PERSON] was employed by the company Natural Gas Branch of SINOPEC.