Oil and gas pipeline magnetic flux leakage signal detection method based on visual picture
By adopting a deep learning method based on YOLOv5 in the detection of magnetic leakage signals in oil and gas pipelines, combining GhostConv and C3Ghost modules, and WIoU loss function, the problem of long detection time and insufficient accuracy in the existing technology is solved, and efficient and accurate detection of magnetic leakage signals is achieved.
Patent Information
- Application Number
- CN202311649662.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2025-06-06
AI Technical Summary
The prior art relies on manual judgment or traditional deep learning methods in the detection of magnetic leakage signals in oil and gas pipelines, and there are problems such as long detection time, high labor consumption and insufficient accuracy.
The deep learning pipeline leakage signal detection method based on YOLOv5 is adopted. By converting the original leakage signal data into visual images, and introducing GhostConv and C3Ghost modules into the network, the number of parameters is reduced; at the same time, the replacement loss function is a WIoU loss function, and its dynamic non-monotonic focus mechanism is used to improve the detection speed and accuracy.
It realizes that while reducing the amount and size of model parameters, it improves the accuracy and speed of magnetic leakage signal detection, significantly improving the detection efficiency and effect.
Smart Images

Figure BDA0004586968870000041 
Figure BDA0004586968870000042 
Figure HDA0004586968880000011
Abstract
Description
Technical Field
[0001] The invention relates to a method for detecting magnetic leakage signals of oil and gas pipelines based on visualized images, and belongs to the field of computer vision and intelligent information technology. Background Art
[0002] The transportation of chemical raw materials such as petroleum and natural gas cannot be separated from underground pipelines. As a tool for long-distance transportation, oil and gas pipelines play a pivotal role in today's society. However, due to various internal and external factors, pipelines buried deep underground may have various defects that lead to transportation risks. Therefore, the detection of such oil and gas pipelines is very important. Magnetic leakage detection can analyze and detect transportation pipelines very safely and effectively to prevent accidents. Its working principle is that in a space full of magnetic fields, pipeline defects will affect the surrounding magnetic fields, causing the sensor to receive relevant data. Through subsequent analysis, the location information of the defects can be clearly found.
[0003] Manual judgment and deep learning target detection are two ways to analyze magnetic flux leakage signals in recent years. Compared with the method based on deep learning, the traditional manual judgment analysis method relies more on people's subjective consciousness, requires strong professional skills and prior knowledge, requires a lot of time and energy, and cannot be popularized. The discrimination method based on deep learning can not only greatly shorten the detection time, but also save labor, and has a high application prospect. Among them, the target detection algorithm based on deep learning can be divided into two categories: single-stage target detection and dual-stage target detection. Compared with single-stage target detection algorithms such as YOLO and SSD, dual-stage target detection algorithms such as FastR-CNN and R-FCN need to first extract the image area, and then detect the specific target. It can be seen that single-stage target detection has the advantage of speed, and the detection process is relatively simple. Therefore, the present invention is based on the method of deep learning, and a deep learning pipeline magnetic flux leakage signal detection method based on YOLOv5 is constructed. Summary of the invention
[0004] The present invention proposes a method for detecting magnetic leakage signals of oil and gas pipelines based on visualized images. The purpose is to visualize the magnetic leakage data through preliminary work, select YOLOv5 as the basic network of the present invention, replace the convolutional layers and C3 network except the first layer in the basic network with GhostConv and C3Ghost modules, reduce the number of network parameters, and replace the loss function in the original network with the WIoU loss function, thereby improving the accuracy of the network while improving the target detection speed.
[0005] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0006] (1) Convert the original magnetic flux leakage signal data into a visual image.
[0007] (2) Perform data enhancement on the collected images to increase the number of data sets.
[0008] (3) The convolutional layers except the first layer in the basic network and the C3 network are replaced with GhostConv and C3Ghost modules to reduce the number of network parameters.
[0009] (4) Use WIoU as the loss function of the model and make full use of the dynamic non-monotonic focusing mechanism of WIoUv3 to improve the speed and accuracy of network detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 YOLOv5 network model.
[0011] Figure 2 Schematic diagram of data augmentation.
[0012] Figure 3 Ghost Bottlenecks module.
[0013] Figure 4 Improved overall network structure. DETAILED DESCRIPTION
[0014] The present invention will be further described below in conjunction with the accompanying drawings:
[0015] The network model construction method of the present invention is as follows:
[0016] The basic network used in this invention is the v6.1 version of YOLOv5. Compared with the previous version, the network structure of v6.1 is more streamlined. The Focus of the backbone network is replaced with the Conv structure, the SPPF module is used to replace the SPP module of the previous version, and the C3 module is improved to reduce the number of repetitions of the C3 module. The network structure is as follows Figure 1 shown.
[0017] First, the original data form of the leakage magnetic signal is analyzed. The original data of the leakage magnetic signal is a two-dimensional matrix, in which the number of columns represents the number of channels of the leakage magnetic signal detector, and there are 344 channels in total; the data in each column represents the leakage magnetic data detected by the same sensor. In order to realize the automatic detection of leakage magnetic signals, this method converts the original leakage magnetic signal into a visual image, in which the horizontal axis is the sensor channel and the vertical axis is the value detected by the sensor.
[0018] Secondly, since the number of data sets plays a vital role in the training effect of the model in the field of deep learning, the data enhancement method is used in the present invention to expand the obtained data set. One method is to extract the defective part of a curve and the flat part of another defect-free curve respectively, and add the two to generate a new leakage magnetic curve with defects. In addition, the common methods of image data enhancement are also used in the present invention, including: random horizontal flipping, scale transformation, random vertical inversion, translation transformation, noise perturbation, mirror transformation, etc. to increase the size of the leakage magnetic data set, such as Figure 2 However, it should be noted that the above data enhancement methods are all generated based on the original data, and there is still a gap between the actual curve defect shape. These data-enhanced curve images have very limited enhancement for deep learning framework training.
[0019] The main problems solved by magnetic flux leakage data detection based on target detection can be divided into three aspects. First, the location of defects in the pipeline must be determined. Secondly, the size of the defects in the pipeline must be determined. Finally, the type of defects in the pipeline must be determined through further judgment, including metal loss-corrosion, anomalies in girth welds, etc. The YOLOv5 algorithm has developed rapidly in recent years. While ensuring the detection speed, its detection accuracy is also continuously improving. It is widely used in various practical scenarios, so it is selected as the basic network.
[0020] On this basis, in order to further reduce the overall parameters of the network and optimize the model, the convolutional layers and C3 networks in the YOLOv5 basic network except the first layer are replaced with GhostConv and C3Ghost modules to reduce the number of network parameters. The GhostConv and C3Ghost modules are the basic units of Ghostnet. Although they are only 1*1 convolutional layers in the convolution calculation process, they still generate a certain amount of calculation, and many convolutional neural networks do not take into account the phenomenon of redundant features. Ghostnet uses a series of linear transformations to generate feature maps, which avoids the above problems. Therefore, using GhostConv and C3Ghost modules to replace some modules of the original network can effectively reduce the amount of network calculation. When the Ghostnet network processes an image, it will go through the following steps: first, calculate the 1*1 convolutional block, then use the stacking of GhostBottlenecks to obtain the feature layer of the image, and use another 1*1 convolutional layer to adjust the channel, and then perform a fully connected classification after a global average pooling and channel adjustment. The structure of GhostBottlenecks is as follows Figure 3 shown.
[0021] Finally, the loss function in the YOLOv5 network is replaced with the WIoU loss function, so as to make full use of the dynamic non-monotonic focusing mechanism of the WIoU loss function, improve the speed of convergence of the anchor frame to the real frame, and increase the accuracy of the model. The most important part of the WIoU loss function is the dynamic non-monotonic focusing mechanism. In the process of target detection, it is inevitable to encounter low-quality training pictures. At this time, the loss function will increase the penalty for such low-quality pictures due to geometric factors, resulting in a decrease in the generalization ability of the overall training model. The dynamic non-focusing mechanism can avoid this problem to a large extent, reduce the impact of geometric factors on the overall loss, and further enable the model to obtain better generalization ability while improving the accuracy of the model.
[0022] Definition of WIoU loss function:
[0023] L WIoUv1 =R WIoU L IoU (1)
[0024]
[0025] Where W g , H g In order to prevent R WIoU Unnecessary gradients are generated to affect the convergence speed, and the width and height of the minimum bounding box are separated from the calculation graph. WIoU ∈[1,e), the L of the anchor box of the common quality example will be enhanced IoU , when L IoU ∈[0,1], the R of the high-quality anchor box will be significantly reduced. WIoU , and focus on the position of the center box when the target box and the anchor box coincide.
[0026] In order to verify the effectiveness of the pipeline magnetic leakage signal detection method based on YOLOv5 proposed in the present invention, we conducted a comparative experiment on the network model proposed in the present invention on a self-collected data set. A total of 1,172 magnetic leakage curve data sets were used. There were several defects in each visualized magnetic leakage curve diagram, and the ratio of the training set to the validation set was about 8:2.
[0027] The comparative experimental results are shown in Table 1, and the initial weight is yolov5s.pt.
[0028] Table 1 Comparative experimental results
[0029]
[0030] YOLOv5 is the data result of the experiment using the original YOLOv5 network, YOLOv5-WIoU is a comparative experiment in which the CIoU loss function in the original network is replaced with the WIoU loss function; YOLOv5-Ghostnet replaces the convolutional layers and C3 network in the YOLOv5 basic network except the first layer with GhostConv and C3Ghost modules; Proposed is the target detection model proposed by the present invention. On the basis of replacing the original basic network with the Ghostnet module, WIoU is used as the loss function for the experiment. The structure diagram of the model is shown in the figure. Figure 4 shown.
[0031] From the experimental results in Table 1, it can be seen that after replacing the loss function in the original YOLOv5 network with the WIoU loss function, the mAP index of the original network is improved by 1.3%. After replacing the convolutional layers and C3 network in the YOLOv5 basic network except the first layer with the GhostConv and C3Ghost modules, the accuracy of the model has increased slightly, but it is not much different from the original network. The number of parameters has been reduced by 52.4%, and the model size has been reduced by 54.2%, and the original network has been lightweighted. When the WIoU and Ghostnet modules are introduced into the model at the same time, the mAP index increases by 2.2% compared with the original network, and the model accuracy is improved while achieving lightweight. From the experimental results, it can be seen that this model has increased the detection accuracy compared with the original model in solving the detection of magnetic leakage signals, reduced the number of model parameters, and optimized the relevant algorithms.
Claims
1. A method for detecting magnetic leakage signals of oil and gas pipelines based on visual images. Features The following steps are involved: (1) First, the obtained raw data of magnetic leakage signals is visualized, and the abstract electromagnetic signal data is converted into specific image information that can be used for target recognition. The sample size is increased through data enhancement methods to improve the training effect of the model. (2) Based on (1), the YOLOv5 target recognition algorithm is selected as the basic network of the present invention, the relevant network parameters are configured, and the convolutional layers except the first layer and the C3 network in the basic network are replaced with GhostConv and C3Ghost modules to reduce the number of network parameters; (3) Based on (2), the CIoU loss function in the YOLOv5 model is replaced by the WIoU loss function to reduce the total degrees of freedom of the network and improve the accuracy of the original network.
2. The method according to claim 1, Features The raw data of the magnetic flux leakage signal obtained in step (1) is visualized as follows: Firstly, the original data form of the leakage magnetic signal is analyzed. The original data of the leakage magnetic signal is a two-dimensional matrix, in which the number of columns represents the number of channels of the leakage magnetic signal detector, and there are 344 channels in total. The data in each column represents the leakage magnetic data detected by the same sensor. In order to realize the automatic detection of leakage magnetic signals, this method converts the original leakage magnetic signal into a visual image, in which the horizontal axis is the sensor channel and the vertical axis is the value detected by the sensor. After generating the visual image, the existing leakage magnetic data is used for data enhancement, the number of leakage magnetic curves is increased, the size of the data set is enriched, and the training reliability of the model is improved.
3. The method according to claim 1, Features In step (2), the YOLOv5 target recognition algorithm is selected as the basic network of the present invention, and the convolutional layers except the first layer and the C3 network in the basic network are replaced with GhostConv and C3Ghost modules, as follows: The main problems solved by magnetic flux leakage data detection based on target detection can be divided into three aspects. First, the location of defects in the pipeline must be determined, followed by the size of the defects in the pipeline. Finally, the type of defects in the pipeline must be determined through further judgment, including metal loss-corrosion, anomalies in the girth weld, etc. The YOLOv5 algorithm has developed rapidly in recent years. On the basis of ensuring the detection speed, its detection accuracy has been continuously improved, and it has been widely used in various practical scenarios. Therefore, it is selected as the basic network. In order to further reduce the number of parameters on the basis of the original model, the convolutional layers and C3 networks in the basic network except the first layer are replaced by GhostConv and C3Ghost modules. Among them, GhostConv and C3Ghost modules are the basic units of Ghostnet. Although it is only a 1*1 convolutional layer in the process of convolution calculation, it still generates a certain amount of calculation, and many convolutional neural networks do not take into account the phenomenon of redundant features. Ghostnet uses a series of linear transformations to generate feature maps, which avoids the above problems. Therefore, using GhostConv and C3Ghost modules to replace some modules of the original network can effectively reduce the amount of network calculation.
4. The method according to claim 1, Features Step (3) replaces the CIoU loss function in the basic network with the WIoU loss function. The specific steps are as follows: By modifying the parameter configuration and structure of the model, the CIoU loss function in the YOLOv5 network is replaced with the WIoU loss function, thereby making full use of the dynamic non-monotonic focusing mechanism of the WIoU loss function, improving the speed at which the anchor frame converges to the true frame, and increasing the accuracy of the model.