Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 14, No. 1, 2025 294 Geometric Parameter Evaluation of Oil and Gas Pipeline Defects Based on Deep Learning Neural Networks Kaiqi Yan, Wei Wu, Hangxin Wei, Jinghao Sun School of Mechanical Engineering, Xi’an Shiyou University, Xi’an 710065, China Abstract: Pipeline magnetic flux leakage (MFL) detection technology has been widely used in online pipeline defect detection due to its advantages of not requiring coupling agents and being easily automated. Accurately predicting defect sizes based on detection data and conducting applicability evaluations are crucial for subsequent repair decisions. Based on the collected MFL data, a deep learning object detection model based on PP-YOLOE (Paddle Paddle - You Only Look Once Evolved) is proposed according to the characteristics of defect data. By converting MFL data into images and feeding them into the model for object detection training, defects can be quickly located and data extracted, providing an accurate and reliable dataset for defect quantification. The axial and radial MFL data of pipeline defects are used as inputs to the model, and the length, width, and depth of defects are output in parallel according to the characteristics of MFL data, thus achieving the assessment and prediction of defect sizes. Keywords: Object Detection; Deep Learning; Magnetic Flux Leakage (MFL) Detection; Image Processing. 1. Introduction Due to the long pipeline route and complex operating environment, the oil and natural gas transported inside the pipeline often contain a large amount of corrosive substances, which are affected by the temperature and pressure of the medium[1]. Long term operation can cause serious corrosion to the inner wall of the pipeline. Magnetic Flux Leakage (MFL) is a widely used non- destructive testing method for detecting defects in long- distance oil pipelines. By conducting MFL tests on pipeline defects, data is collected to provide reliable references for defect identification, maintenance, and repair[2]. In the field of magnetic flux leakage detection quantification, single task models based on deep learning are widely used. These models typically use convolutional neural networks (CNN) or recurrent neural networks (RNN) to extract features from magnetic flux leakage data[3], learn and train defects. Traditional single task models are more suitable for training scenarios where task objectives are independent of each other. However, due to the correlation between the leakage magnetic field generated by pipeline defects and the various size parameters of defects, it affects the learning efficiency of single task models for defect quantification tasks. In the quantification of pipeline defects, it is necessary to simultaneously output the length, width, and depth dimensions of the defects, and these size parameters will affect the characteristics of the defect signal[4]. The construction of a pipeline corrosion defect dataset was completed through the PP-YOLOE model, and the MTL model was used to train and quantify the size of corrosion defects[5]. Optimization was carried out from the aspects of activation function and optimization algorithm, and the optimal strategy was selected to achieve accurate prediction of corrosion defect size and improve the quality and efficiency of pipeline magnetic leakage detection data analysis. 2. Defect Pipeline Detection Process 2.1. Hydraulic System Working Principle The MFL data consists of data in three magnetic field directions: radial, axial, and circumferential. Different magnetic field - direction data contains different MFL signal characteristics[6]. When the circumferential component of the MFL signal fluctuates greatly and has no obvious pattern, the radial and axial components are usually selected to analyze the relationship between the defect size and the MFL signal. The pipeline MFL signals involved in this experiment include two types of radial MFL signals and axial MFL signals. By changing the defect size, the distribution law of the MFL field of pipeline defects under different sizes is obtained. Under the condition of the same width, as the defect depth increases, the peak values of the radial and axial MFL components of the defect increase significantly. Under the same depth, the positive - negative extreme - value spacing of the radial MFL component increases with the increase of the width, and the valley - spacing of the axial MFL component increases with the increase of the width. In Figures 1 and 2, when the length and width are kept constant and only the defect depth is changed, the variation laws of the radial and axial MFL components are shown. 2.2. Object Detection Model Establishment After the pre - processed images are input into the object detection model, the image feature information is first extracted. Subsequently, the extracted target features are fused, and the fused images are post - processed and recognized through the detection head[7], finally achieving the output of the object detection task. The composition of the PP - YOLOE model (Figure 3) includes a backbone feature extraction network, a path aggregation network, and a detection head. The backbone feature extraction network is used to extract different types of visual information (C3, C4, C5) of the input image, which is then sent to the path aggregation network for target feature aggregation. The path aggregation network includes three levels: P3, P4, and P5, and 295 each level is classified and recognized through a detection head. When the detection head obtains the transmitted features, it first enhances the network's perception ability of the target edge features through the feature enhancement module, then integrates each dimension of the image, and uses convolutional processing to perform spatial and channel transformations on the length, width, and dimension of the target, realizing accurate prediction of the target position, category, and confidence. Figure 1. Radial magnetic flux leakage component Figure 2. Axial magnetic flux leakage component Figure 3. PP-YOLOE Model Architecture The model architecture of PP - YOLOE is proposed. The backbone network is CSPRep ResNet, the neck is the path aggregation network (PAN), and the head is the efficient task - aligned head (ET - head). Width multiplier α and depth multiplier β are used to obtain a series of detection networks with different parameters and computational costs. The width of the basic backbone network is set to [64, 128, 256, 512, 1024]. Except for the stem, the depth of the basic backbone network is set to [3, 6, 6, 3]. The width and depth of the basic neck network are set to [192, 384, 768] and 3, respectively. 296 Table 1 shows the specifications of the width multiplier α and depth multiplier β of different models. Table 1. Width multiplier 𝛼 and depth multiplier 𝛽 specification for a series of networks width multiplier 𝛼 depth multiplier 𝛽 s 0.50 0.33 m 0.75 0.67 l 1.00 1.00 x 1.25 1.33 2.2.1. Task Alignment Learning (TAL) To further improve the accuracy, it consists of dynamic label assignment and task - alignment loss. Dynamic label assignment means prediction/loss perception. According to the prediction, it assigns a dynamic number of positive anchors to each real - world target[8]. By clearly aligning these two tasks, TAL can obtain the highest classification score and the most accurate bounding box at the same time. For the task - alignment loss, the normalized t, �̂� is used to replace the target in the loss. The maximum IoU is used for normalization. The binary cross - entropy (BCE) for classification is: 𝐿 ∑ 𝐵𝐶𝐸 𝑃 , �̂� (1) 2.2.2. Efficient Task - Aligned Head (ET - head) In object detection, the ET - head is proposed. It uses ESE to replace the layer attention in TOOD, simplifies the alignment of the classification branch to a shortcut, and replaces the alignment of the regression branch with the Distribution Focal Loss (DFL) layer[9]. Different label assignments on the basic model. Use CSPRep ResStage as the backbone network and neck, adopt a 1×1 convolutional layer as the head, and only train for 36 epochs on COCO train2017. In the learning of classification and localization tasks, Variational Focal Loss (VFL) and Distribution Focal L oss (DFL) are selected respectively[10]. Applying VFL and DFL to the object detector has achieved performan ce improvements. For VFL, different from the Quality Focal Loss (QFL) in [reference], VFL uses the target s core to weight the loss of positive samples, making the loss of positive samples with high IoU relatively large. Both use the IoU - aware classification score (IACS) as the target for prediction, effectively learning the joint r epresentation of the classification score and the localizat ion quality estimate, thus achieving a high degree of co nsistency between training and inference. For DFL, to s olve the problem of inflexible bounding - box represent ation, using a general distribution to predict the boundi ng box is proposed. The model is supervised by the fol lowing loss function: 𝐿𝑜𝑠𝑠 ∗ ∗ ∗ ∑ (2) where �̂� represents the normalized target score. obtained. 3. Improved PP - YOLOE Model The improved PP - YOLOE consists of an expandable backbone and neck, Task Alignment Learning, an Efficient Task - aligned head with DFL and VFL, and the SiLU activation function. 3.1. Backbone Optimization The Backbone of PP - YOLOE improves ResNet using the RepVGG module and the model concept of CSP. It also uses modules such as the SiLU activation function and Effitive SE Attention. RepVGG is an improvement based on VGG[11]. An Identity and a residual branch are added to the Block of the VGG network. In the model inference stage, all network layers are converted into 3×3 convolutions through the Op fusion strategy, facilitating network deployment and acceleration. The convolution layers and BN layers in the residual block are fused through the following equations: 𝑊 𝑊 (3) 𝑏 ∗ 𝛽 (4) 𝑏 𝑀 ∗ 𝑊, 𝜇, 𝜎, 𝛾, 𝛽 𝑀 ∗ 𝑊 𝑏 (5) 𝑊 and 𝑏 represent the weights and biases of the fused convolution, respectively. Convolutions with different convolution kernels are converted into convolutions with 3×3 - sized convolution kernels (Figure 4). Since the entire residual block may contain a 1×1 convolution branch and an Identity branch, for the 1×1 convolution branch, the entire conversion process is to replace the 1×1 convolution kernel with a 3×3 convolution kernel and merge the 3×3 convolutions in the residual branch. The weights and biases of all branches are superimposed to obtain a fused 3×3 convolutional layer. A 3×3 convolution kernel is set, and the weight values at all 9 positions are set to 1. After multiplying it with the input feature map, the original values are maintained. Swish activation function: Swish contains SiLU: 𝑆𝑖𝐿𝑈 𝑥 𝑥 ∗ 𝑆𝑖𝑔𝑚𝑜𝑖𝑑 𝑥 (6) 𝑆𝑤𝑖𝑠ℎ 𝑥 𝑥 ∗ 𝑆𝑖𝑔𝑚𝑜𝑖𝑑 𝛽𝑥 (7) 𝛽 is a training parameter. Figure 4. The structure of CBS 3.2. Strengthening the CSPNet Structure Design a Partial Dense Block. Through the split - and - merge strategy, the number of gradient paths is doubled. A 297 cross - stage strategy is adopted to reduce the disadvantages of using explicit feature - map replication for connection. The number of channels at the bottom layer of DenseNet is much larger than the growth rate. Since the bottom - layer channels involved in the dense layer operation in the partial dense block only account for half of the original channels, it can effectively solve nearly half of the computational bottleneck (Figure 5). Assume that the basic feature - map size of the dense block in DenseNet is 𝑤 ∗ ℎ ∗ 𝑐, the growth rate is 𝑑, and there are layers in total. Then, the CIO of this dense block is 𝑐 ∗ 𝑚 𝑚 𝑚 ∗ 𝑑 2 . 𝑚 and 𝑑 are usually much smaller than 𝑐, but the partial dense block can save up to half of the network memory traffic. Figure 5. CSPNet structure The SPP module can use the same image with different sizes (scales) as the input and obtain pooled features of the same length[12]. The SPP module can also process images with different aspect ratios and sizes, so it improves the scale - invariance of the image and reduces over - fitting. The SPP structure is independent of a specific CNN network design and structure. Through the SPP module[13], the fusion of local and global features at the featherMap level is realized, enriching the expression ability of the final feature map and thus iproving the MAP. 4. Simulation and Experiments 4.1. Data Collection The ANSYS MAXWELL finite - element simulation software is used to build a pipeline - defect MFL detection model, providing data for the subsequent design of the pipeline - defect detection system based on deep - learning neural networks and the prediction of defect sizes. To further verify the effectiveness of the method proposed in this paper in practical engineering, the on - site defect MFL data is obtained using a pipeline - defect MFL detection experimental platform. A pipeline with a diameter of 210 mm, a wall thickness of 13 mm, and a length of 100 mm is selected. Pipeline defects are artificially made, and Hall sensors are used to detect the MFL data. An experimental platform framework is built. Finally, defect - size data in the range of 10 - 40 mm in length, 10 - 40 mm in width, and 1 - 9 mm in depth are collected. 4.2. Data Pre – processing Various types of noise are added to the MFL data, and data augmentation operations are performed on the dataset to expand the MFL data to 10,000 samples. The Markov transformation field is used to perform a two - dimensional transformation on the one - dimensional MFL data. Since the radial and axial MFL data need to be input simultaneously, to improve the training efficiency, the two - dimensional images of the radial and axial MFL data are feature - fused and set to a size of 32×32 pixels, as shown in Figure 6. Figure 6. Flow chart of Markov transition field A pipeline MFL curve image dataset based on a convolutional neural network is established. The pixel size of the feature image of each defect is 32×32. The dataset is randomly divided into a training set and a test set in a 9:1 ratio. Figure 7 shows the defect sizes corresponding to randomly selected different feature maps. 298 Figure 7. Feature maps corresponding to different defect sizes 4.3. Optimization Process (1) Select an appropriate initial learning rate LR for the network. (2) Select a suitable momentum MT for stochastic gradient descent. (3) Select a suitable L2 regularization coefficient λ. The above three parameters affect each other. Any change in one parameter will cause the remaining parameters to have an impact on the final effect of PP - YOLOE. Therefore, it is necessary to find the globally optimal parameter combination. The dataset is input into the PP - YOLOE model, and an optimization algorithm is used to select the hyperparameters. The maximum number of iterations is set to 20. As can be seen from Table 3, after 30 iterations, the RMSE obtained by the 12th optimized model is the lowest, which is 0.0691. Finally, the initial learning rate of the network LR = 0.0008, the momentum of stochastic gradient descent MT = 0.8224, and the L2 regularization coefficient λ = 0.009 are determined. At this time, it indicates that the optimal iteration has been reached, and subsequent calculations can no longer improve the objective function, indicating that the global optimum has been found. To verify the impact of the optimization algorithm on the results of the PP-YOLOE model, an unoptimized model was established, which maintained the same structure as the optimized PP-YOLOE. The default neural network hyperparameters were selected, that is, learning rate (LR) = 0.01, momentum (MT) = 0.8, and weight decay (λ) = 0.0001. Compared with the unoptimized PP-YOLOE, the optimized PP-YOLOE achieved more accurate predictions. 4.4. Experimental Results To verify the effectiveness of the algorithm in this paper, the optimized model is compared with traditional neural networks, as shown in Table 2. It can be seen from the table that the un - optimized PP - YOLOE has a large defect - size prediction error, so it is necessary to optimize it. The neural - network structure optimized by the optimization algorithm is more accurate in predicting pipeline defects and is significantly better than the un - optimized PP - YOLOE model. Table 2. Comparison of mean squared errors among different network models Network model Training time(s) RMSE BP 2.12 0.73 RBF 2.03 0.75 SVM 2.05 0.70 Transfer learning 2.27 0.4005 PP-YOLOE 3.12 0.1389 Optimal PP-YOLOE 3.01 0.0619 Compared with traditional convolutional neural networks, the PP - YOLOE method has more accurate pipeline - defect size prediction ability and training efficiency. The results show that the method proposed in this paper provides a better - performing comprehensive idea for predicting pipeline - defect MFL detection in oil and gas pipelines. References [1] Huang Biao. Analysis of the Current Situation of Oil and Gas Pipeline Protection and the Construction of a Long - term Mechanism[J]. Petrochemical Industry Technology, 2022, 29(9): 176 - 178. [2] Li Qiuyang, Zhao Minghua, Ren Xuejun, et al. Current Situation and Development Trend of Oil and Gas Pipeline Construction in China[J]. Oil - Gas Field Surface Engineering, 2019, 38(1): 14 - 17. [3] Li Qiuyang, Zhao Minghua, Zhang Bin, et al. Current Situation and Development Trend of Global Oil and Gas Pipeline Construction in 2020[J]. Oil & Gas Storage and Transportation, 2021, 40(12): 1330 - 1337+1348.. 299 [4] Jiang Ke, Wang Dongyuan, Yu Zhifeng, et al. Failure Analysis of Pipelines under the Action of Lateral Landslides: Taking the Two Explosion Accidents of the Guizhou Qinglong Section of the China - Myanmar Pipeline as Examples[J]. Science Technology and Engineering, 2023, 23(21): 8988 - 8995. [5] Wang Junling, Deng Yulian, Li Ying, et al. Review of Drainage Pipeline Detection and Defect Recognition Technologies[J]. Science Technology and Engineering, 2020, 20(33): 13520 - 13528. [6] Liu Jinhai, Zhao Zhen, Fu Mingrui, et al. Pipeline Weld Defect Detection Method Based on Active Small - Sample Learning[J]. Chinese Journal of Scientific Instrument, 2022, 43(11): 252 - 261. [7] Lv Mingxuan, Zhang Bin, Zhou Chao. Parameter Debugging of the Spiral Weld Ultrasonic Phased Array Detection System[J]. Welded Pipe and Tube, 2023, 46(1): 37 - 41. [8] Tang Donglin, Yuan Xiaohong, Zhao Jiang, et al. Design of an On - line Ultrasonic Detection Robot for Internal Corrosion Defects of Pipelines[J]. Measurement & Control Technology, 2015, 34(7): 117 - 119+124. [9] Tian Ye, Gao Tao, Xu Guangda, et al. Research on the Defect Recognition and Quantification Technology of Magnetic Flux Leakage Internal Detection for Long - Distance Pipelines[J]. Oil - Gas Field Surface Engineering, 2018, 37(10): 51 - 54+59. [10] Mo Li, Yong Hao, Li Changjun, et al. Numerical Simulation Study on Magnetic Flux Leakage Detection Signals of Combined Defects in Oil and Gas Pipelines[J]. Journal of Safety Science and Technology in China, 2024, 20(1): 5 - 10. [11] Cao Jie, Ma Jialin, Huang Dailin, et al. A Fault Diagnosis Method Based on Multi - Channel Markov Transition Fields[J]. Journal of Jilin University (Engineering and Technology Edition), 2022, 52(2): 491 - 496. [12] Yee K S. Numerical solution of initial boundary value problems involving maxwell's equations in isotropic media[J]. IEEE Transactions on Antennas & Propagation, 1966, 14(5): Daniel J, Paulin J, Abudhahir A. Characterization of defects in magnetic flux leakage (MFL) images using wavelet transform and neural network[C]. International Conference on Electronics and Communication Systems. IEEE, 2014. [13] Daniel J, Paulin J, Abudhahir A. Characterization of defects in magnetic flux leakage (MFL) images using wavelet transform and neural network[C]. International Conference on Electronics and Communication Systems. IEEE, 2014.