YOLO11-Based Weld Defect Detection Method for X-Ray Images Integrating SIoU Bounding Box Regression and P2 Shallow Feature Enhancement
Li Gao, Hailong Liu, Weixin Gao, Junjie HeX-ray inspection is crucial for pipeline weld non-destructive testing (NDT), yet automatic defect detection remains challenging due to low contrast, complex backgrounds, and significant variations in defect morphology. To address these issues, this paper proposes an improved YOLOv11-based method for X-ray weld images, integrating Smooth IoU (SIoU) bounding box regression and P2 shallow feature enhancement. First, to enhance the localization accuracy of elongated Region of Interest (ROI) targets in small-diameter pipe welds, the original CIoU loss is replaced with SIoU loss. By introducing an Angle Cost term, SIoU provides explicit directional constraints, guiding the predicted bounding box to align with the ground-truth orientation. Experimental results show the YOLOv11s + SIoU model achieves 99.5% mAP@50 and 99.9% precision, outperforming the baseline. Second, to improve the detection of larger defects (e.g., lack of fusion, incomplete penetration, and cracks) in long-distance pipeline welds, a P2 detection layer (stride 4) is added. This layer preserves high-resolution spatial details and shallow edge features that are typically lost during deep downsampling. Evaluated on a 960 × 960 input resolution, the YOLOv11s + P2 model achieves 93.07% precision, 94.8% mAP@50, and 72.01% mAP@50–95. The proposed method effectively combines directional constraint with shallow feature preservation, providing a robust solution for both ROI localization and large defect recognition in complex weld X-ray images.