Abstract:The connection quality of PE gas pipelines can directly affect the normal transmission of medium and low-pressure gas. Structural distortion, cold welding and other defects produced by electrofusion welding will significantly weaken the mechanical properties of the pipeline, which will threaten the stable operation of the gas pipeline network. Therefore, based on the DR Image datasets of PE gas pipelines electrofusion welding defects collected on-site, this paper proposes a defect detection method based on the DSG-ResNet34 model to realize rapid and accurate detection of electrofusion welding defects. This network model consists of three parts: the backbone network CBAM-ResNet34 module, the dynamic sparse gating feature pyramid networks DSG-FPN, and the multi-scale detection head. Firstly, the CBAM-ResNet34 structure of backbone network is used to enhance the network model′s attention to defect features from two dimensions of channel and space. Then, the DSG-FPN, which integrates a dynamic sparse gating module, an Inception module, and sparse connections, dynamically fuses multi-scale defect features-effectively preserving small-target features while suppressing background noise. Finally, the multi-scale detection head converts the enriched features into precise detection outputs. The DSG-ResNet34 model achieves a defect detection accuracy of up to 95.5%, with a P2 layer precision of 82.7% and a minimum recall rate of 85.6% for small targets. The detection speed reaches 68 fps, and the model contains 22.3 million parameters. This model can quickly locate and identify four typical electrofusion welding defects: holes, fused surface inclusion, structural distortion and cold welding. Both its detection performance and speed outperform existing models. This study provides a high-precision solution for intelligent testing of PE pipeline welding quality, which is of great significance for ensuring the safe operation of gas pipeline network.