Pipeline leakage detection method and system, server and medium

By introducing attention mechanism and EIOU loss function in the YOLOv5s model, combining oil and gas pipeline pictures and vibration and temperature data, the problem of poor detection results in oil and gas pipeline leakage detection is solved, and more efficient and accurate leakage identification is achieved.

CN119107531APending Publication Date: 2024-12-10CHONGQING SPECIAL EQUIP INSPECTION & RES INST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411058088.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

Oil and gas pipeline leakage accidents occur from time to time, resulting in difficult-to-estimate consequences, and an efficient detection method is needed to prevent casualties, environmental impacts and property losses.

Method used

Using the improved YOLOv5s model, by inserting attention modules into the model and introducing attention mechanisms, combining reading the vibration and temperature information of the oil and gas pipeline picture data set and preset sampling points, we can identify whether the pipeline is leaked, and optimize the model using the EIOU loss function. Training to improve detection effect.

Benefits of technology

Improves detection effect and efficiency, the improved model can converge faster and provide more accurate leakage positioning, improving the accuracy and reliability of oil and gas pipeline leakage detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119107531A_ABST
    Figure CN119107531A_ABST
Patent Text Reader

Abstract

The invention provides a pipeline leakage detection method and system, a server and a medium. The method comprises the steps that an oil and gas pipeline picture data set is read; an improved YOLOv5s model is constructed; inputting the oil and gas pipeline picture data set into the improved YOLOv5s model, and identifying whether the oil and gas pipeline leaks or not; the step of constructing the improved YOLOv5s model comprises the substeps of constructing the YOLOv5s model; and inserting a plurality of attention modules into the YOLOv5s model for introducing an attention mechanism. In the technical scheme provided by the invention, the efficient attention mechanism CA for the mobile terminal is integrated into the YOLOv5s model, so that the feature extraction capability of the YOLOv5s model is enhanced, and the detection effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition technology, and in particular to a pipeline leakage detection method, system, server and medium. Background Art

[0002] Pipeline transportation has become the main mode of transporting oil and natural gas due to its advantages such as large transportation volume, continuity, economy and reliability. In addition, as the second and third largest energy varieties in my country, oil and natural gas are important components of the global energy supply and an important driving force for promoting my country's social and economic growth. With the development of the oil and gas industry, leakage accidents of oil and gas pipelines occur from time to time due to natural aging of pipelines, construction defects, environmental changes, corrosion, and drilling and oil theft, resulting in inestimable consequences. Therefore, in order to prevent leakage accidents from occurring, causing more casualties, environmental impacts and property losses, it is very necessary to detect oil and gas pipeline leakage in a timely manner. Summary of the invention

[0003] In view of this, one of the purposes of the embodiments of the present application is to provide a pipeline leakage detection method, which can improve the problem of difficult-to-estimate consequences caused by oil and gas pipeline leakage.

[0004] In order to achieve the above technical objectives, the technical solutions adopted in this application are as follows:

[0005] In a first aspect, an embodiment of the present application provides a pipeline leakage detection method, the method comprising:

[0006] Read the oil and gas pipeline image dataset;

[0007] Build and improve the YOLOv5s model;

[0008] The oil and gas pipeline image dataset is input into the improved YOLOv5s model to identify whether the oil and gas pipeline is leaking;

[0009] The method for constructing the improved YOLOv5s model includes:

[0010] Build the YOLOv5s model;

[0011] Several attention modules are inserted into the YOLOv5s model to introduce the attention mechanism.

[0012] Furthermore, the attention module is inserted into at least one of the following positions of the YOLOv5s model, including before or after the convolutional layer, the residual block, and the feature fusion layer.

[0013] Furthermore, the attention module is based on the following method:

[0014] Receiving the oil and gas pipeline picture inputted by the input channel;

[0015] Pooling is performed along the length direction and the width direction of the oil and gas pipeline image to obtain a first length feature vector map and a first width feature vector map;

[0016] Merging the length feature vector map and the first width feature vector map to form a first feature layer;

[0017] Convolutional feature layer;

[0018] The convolutional feature layer is transformed using batch normalization and nonlinear activation functions to form a second feature layer;

[0019] Segment the second feature layer in the length direction and the width direction to form a second length feature vector map and a second width feature vector map;

[0020] After convolving the second length feature vector map and the second width feature vector map, a nonlinear activation function conversion is performed to form a third length feature vector map and a third width feature vector map;

[0021] Output the merged third length feature vector map and third width feature vector map.

[0022] Furthermore, when training the YOLOv5s model with the attention mechanism, the loss function is set to the EIOU loss function, which is:

[0023]

[0024] Where: ρ is the Euclidean distance between the two center points; b is the center point of the prediction box; h is the height of the prediction box; w is the width of the prediction box; b gt is the center point of the real frame; h gt is the height of the real frame; w gt is the width of the real frame; h c is the height of the minimum bounding box; h w The width of the minimum bounding box.

[0025] Furthermore, when training the YOLOv5s model with the attention mechanism, the loss function is set to the IOU loss function, where

[0026] The loss function is:

[0027]

[0028] Where: B is the area of ​​the prediction box; B i is the area of ​​the real box.

[0029] Furthermore, before reading the oil and gas pipeline image dataset, the following steps are performed:

[0030] Receive vibration and temperature of preset sampling points of oil and gas pipelines;

[0031] When the amplitude of the vibration at the preset sampling point is greater than the preset amplitude, and the degree of temperature change is greater than the preset degree, the image of the preset sampling point is collected to form the oil and gas pipeline image data set.

[0032] In a second aspect, the present application also provides a pipeline leakage detection system, including:

[0033] A reading module configured to read an oil and gas pipeline image dataset;

[0034] Build module, configured to build improved YOLOv5s model;

[0035] The recognition module is configured to input the oil and gas pipeline image dataset into the improved YOLOv5s model to identify whether the oil and gas pipeline is leaking;

[0036] The method for constructing the improved YOLOv5s model includes:

[0037] Build the YOLOv5s model;

[0038] Several attention modules are inserted into the YOLOv5s model to introduce the attention mechanism.

[0039] In a third aspect, an embodiment of the present application also provides a server, wherein the server includes a processor and a memory coupled to each other, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the server executes the above method.

[0040] In a fourth aspect, an embodiment of the present application also includes a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes the above method.

[0041] The invention adopting the above technical solution has the following advantages:

[0042] In the technical solution provided in this application, the efficient attention mechanism for mobile terminals is integrated into the YOLOv5s model, which enhances the feature extraction capability of the YOLOv5s model and improves the detection effect.

[0043] In the technical solution provided in this application, in order to solve the problems of slow convergence speed and inaccurate regression results of the YOLOv5s algorithm, this paper adopts EIoU as the loss function, and explicitly measures the differences in the three geometric factors of overlapping area, center point and side length in bounding box regression (BBR), so that the improved YOLOv5s model converges faster and has better positioning effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The present application may be further described by the non-limiting embodiments given in the accompanying drawings. It should be understood that the following drawings only illustrate certain embodiments of the present application and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings may be obtained based on these drawings without creative effort.

[0045] Figure 1 This is the YOLOv5 algorithm flow chart.

[0046] Figure 2 Schematic diagram of the YOLOv5 algorithm training method.

[0047] Figure 3 Schematic diagram of the YOLOv5 algorithm detection method.

[0048] Figure 4 A flow chart of the method provided in an embodiment of the present application.

[0049] Figure 5 This is a structural diagram of the attention mechanism proposed in this embodiment.

[0050] Figure 6 This is a structural diagram of the pipeline leakage detection system proposed in this embodiment.

[0051] Icon: 1-reading module; 2-building module; 3-recognition module. DETAILED DESCRIPTION

[0052] The present application will be described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that in the drawings or descriptions, similar or identical parts use the same figure numbers, and the implementation methods not shown or described in the drawings are forms known to ordinary technicians in the relevant technical field. In the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0053] Please refer to Figure 1 The present application also provides a pipeline leakage detection method, which is based on the YOLOv5 algorithm. YOLOv5 is improved on the basis of YOLOv3 and YOLOv4. It is divided into four parts: input, backbone network, feature fusion module, and output. The network structure is shown in the figure. Figure 1Compared with the previous YOLO version, the YOLOv5 algorithm adjusts the depth multiple and width multiple parameters to make the target detection network have 4 preset model sizes, namely Yolov5s, Yolov5m, Yolov5l, and Yolov5x. In order to meet the detection requirements, this embodiment selects the fastest running YOLOv5s version to detect the existing images.

[0054] like Figure 2 As shown in the figure, during the training phase of YOLOv5s, the oil and gas pipeline dataset is read, and the image is input into the forward network after adaptively adjusting the input scale and anchor box size. The feature information of the image in the model is extracted through the backbone network, and then the extracted feature information is fused through feature fusion. After that, the network output is obtained at the output end, and the area and category information of the prediction box are calculated. The target box is screened through non-maximum suppression NMS, and the loss between the predicted value and the true value is calculated through the loss function. Finally, whether the oil and gas pipeline in the image is leaking is predicted in the test phase. The recognition process is as follows Figure 3 shown.

[0055] like Figure 4 As shown, this method is specifically as follows:

[0056] S110: Reading an oil and gas pipeline image dataset.

[0057] S120: Build an improved YOLOv5s model.

[0058] S130: Input the oil and gas pipeline image dataset into the improved YOLOv5s model to identify whether the oil and gas pipeline is leaking.

[0059] In this embodiment, the construction method of the improved YOLOv5s model is as follows:

[0060] Build the YOLOv5s model;

[0061] Several attention modules are inserted into the YOLOv5s model to introduce the attention mechanism.

[0062] The attention module in this embodiment is in the form of a plug-in.

[0063] CA (Coordinate Attention) embeds location information into channel attention, enabling mobile networks to participate in large areas while avoiding large computational overhead. The cross-channel information, direction perception, and location-sensitive information it captures help the model more accurately locate and identify targets of interest and improve the distinguishability and anti-interference ability of image features, thereby achieving the effect of improving model performance. The introduction of Coordinate Attention in the model specifically includes two steps: Coordinate information embedding and Coordinate Attention generation.

[0064] The attention module of this embodiment is inserted into the following positions of the YOLOv5s model:

[0065] ① Convolutional layer, which can process the feature map output by the convolutional layer.

[0066] ② In the residual block, if the YOLOv5s model uses the residual block structure, an attention module can be added after a convolutional layer of the residual block to enhance the feature extraction capability of the residual block.

[0067] ③ Before or after the feature fusion layer: Add an attention module before or after the feature fusion layer (such as the upsampling and downsampling layers in the FPN structure) to optimize the feature map before fusion or enhance the feature expression ability after fusion.

[0068] In this embodiment, the structure of the attention mechanism is as follows Figure 5 As shown, specifically:

[0069] 1. Receive an oil and gas pipeline image as input from a convolutional layer;

[0070] 2. Pooling is performed along the length and width of the oil and gas pipeline image to obtain the first length feature vector map and the first width feature vector map. In this step, two parallel 1D global pooling operations are used to replace the traditional 2D global pooling, and pooling is performed along the width and height directions of the feature map. In this way, the features of each channel are encoded into two 1D vectors, representing the global features in the horizontal and vertical directions respectively.

[0071] The above two steps form the Coordinate information embedding step. Coordinate Attention generation includes the following steps:

[0072] 1. Merge the length feature vector map and the first width feature vector map to form a first feature layer.

[0073] 2. Convolutional first feature layer.

[0074] 3. Use batch normalization and nonlinear activation function to transform the first feature layer after convolution to form the second feature layer to further extract and fuse features.

[0075] 4. Segment the second feature layer in the length direction and the width direction to form a second length feature vector map and a second width feature vector map;

[0076] 5. After convolving the second length feature vector map and the second width feature vector map, a nonlinear activation function conversion is performed to form a third length feature vector map and a third width feature vector map;

[0077] 6. Output the merged third-length feature vector map and third-width feature vector map to emphasize the target area of ​​interest. This process enhances the representation ability of the feature map, enabling the model to locate and identify targets more accurately.

[0078] In the training phase of improving the YOLOv5s model, the defined loss function is particularly important. YOLOv5 contains three loss functions: classification loss, positioning loss, and confidence loss. The loss function can be used to measure the distance between the predicted information and the expected information. The smaller the gap between the predicted information and the expected information, the smaller the final loss function value. The IOU loss function is widely used in common target detection algorithms due to its high stability, simple calculation, strong interpretability, and wide applicability. In addition, it can effectively shield the interference of the bounding box size to achieve better performance. The formulas for the IOU and IOU loss functions are as follows:

[0079]

[0080] Where: B is the area of ​​the prediction box; B i is the area of ​​the real box.

[0081] YOLOv5 uses the complete intersection-over-union loss function (CIoU Loss) as the loss function. It improves on the traditional IOU loss function by introducing the center point distance and aspect ratio to make the CIOU loss function more stable during training.

[0082] The specific calculation method is as follows.

[0083]

[0084]

[0085] Where: Distance2 is the distance between the center point of the predicted box and the real box; Distance c is the diagonal distance of the minimum circumscribed rectangle; α is the trade-off parameter; v is the correction factor used to adjust the loss function.

[0086] Since the CIOU loss function has disadvantages such as high computational complexity and poor detection effect for small target frames, this embodiment adopts an improved version of CIOU: EIOU loss function. It comprehensively considers the center point distance, width and height difference and intersection area on the basis of considering the position and shape of the target detection frame, improves the accuracy and efficiency of bounding box regression, and thus realizes more accurate loss calculation of the real frame and the predicted frame in the oil and gas pipeline leakage detection task. Its specific calculation method is as follows:

[0087]

[0088] Where: ρ is the Euclidean distance between the two center points; b is the center point of the prediction box; h is the height of the prediction box; w is the width of the prediction box; b gt is the center point of the real frame; h gt is the height of the real frame; w gt is the width of the real frame; h c is the height of the minimum bounding box; h w The width of the minimum bounding box.

[0089] In summary, this embodiment implements the following improvements based on the existing YOLOv5 model to address the leakage problem of exposed oil and gas pipelines, including:

[0090] 1) In view of the complex environment of oil and gas pipelines, the efficient attention mechanism CA used on mobile terminals is integrated into the algorithm to enhance the feature extraction capability of the model and improve the detection effect.

[0091] 2) To address the problems of slow convergence speed and inaccurate regression results of the original YOLOv5 algorithm, this embodiment adopts EIoU as the loss function and explicitly measures the differences in three geometric factors, namely, overlapping area, center point and side length, in bounding box regression (BBR). Compared with the existing YOLOv5 model, the improved YOLOv5 has faster convergence speed and better positioning effect.

[0092] 3) This embodiment collects relevant natural gas pipeline data sets and constructs a final data set containing 3,000 oil and gas pipeline leakage images by integrating the existing leakage images and video data of oil pipelines. The training set, test set, and validation set are randomly divided in a ratio of 8:1:1.

[0093] 4) The experimental platform is Windows 10 system, the CPU is Intel(R) Core(TM) i7-10700CPU, the development framework is Pytorch, the programming language is Python, and the CUDA version is 11.4.

[0094] 5) For the oil and gas pipeline leakage detection model based on improved YOLOv5s, average precision (mAP), precision (Precision), and recall (Recall) are used as evaluation indicators of the experiment. The indicator formulas are shown in Table 1.

[0095] Table 1 Evaluation indicators

[0096]

[0097]

[0098] This embodiment improves the attention mechanism and loss function of the YOLOv5s model. In order to further verify the optimization effect of the improved method proposed in this paper on the algorithm performance and the effectiveness of detecting oil and gas pipeline leakage, this paper designs 4 groups of ablation experiments, and the experimental results are shown in Table 2.

[0099] Table 2 Ablation experiment results

[0100]

[0101] By comparison, it can be found that the performance of the improved YOLOv5 algorithm is improved compared to the original YOLOv5 algorithm. The performance indicators of the improved YOLOv5 model formed by adding the CA attention mechanism and improving the EIOU loss function on the basis of the original YOLOv5 algorithm have increased to varying degrees. Finally, after adding the CA attention mechanism and improving the EIOU loss function on the basis of the YOLOv5 model, the mAP value of the experimental model for oil and gas pipeline leakage detection increased by 4.8%.

[0102] Before S110, the following steps are also included: S100: receiving the vibration and temperature of a preset sampling point of the oil and gas pipeline; when the amplitude of the vibration of the preset sampling point is greater than the preset amplitude, and the degree of temperature change is greater than the preset degree, collecting an image of the preset sampling point to form the oil and gas pipeline image data set.

[0103] According to S100, pipeline leakage is generally caused by third-party drilling or stress changes caused by geological conditions, and stress changes will cause a large change in the amplitude of vibration. Therefore, when the amplitude of vibration is large, the probability of leakage at the corresponding preset sampling point increases. Temperature is a condition for measuring whether oil and gas leaks. When oil and gas leaks, the temperature will change significantly. Therefore, when the temperature change is greater than the preset level, the probability of leakage increases further. Therefore, it is necessary to collect corresponding pictures to further determine whether a leak has occurred.

[0104] In this embodiment, the collection of vibration and temperature can be achieved by arranging distributed optical fibers.

[0105] This embodiment also proposes a pipeline leakage detection system, based on the above pipeline leakage detection method, including:

[0106] A reading module 1, configured to read an oil and gas pipeline image dataset;

[0107] Building module 2, configured to build an improved YOLOv5s model;

[0108] The recognition module 3 is configured to input the oil and gas pipeline image dataset into the improved YOLOv5s model to identify whether the oil and gas pipeline is leaking.

[0109] The embodiment of the present application further proposes a server, which includes a processor and a memory coupled to each other, wherein a computer program is stored in the memory. When the computer program is executed by the processor, the server executes the above-mentioned pipeline leakage detection method.

[0110] The embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is run on a computer, the computer executes the pipeline leakage detection method described in the above embodiment.

[0111] Through the description of the above implementation methods, technical personnel in this field can clearly understand that the present application can be implemented by hardware, and can also be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0112] In the embodiments provided in the present application, it should be understood that the disclosed medium, system and method can also be implemented in other ways. The medium, system and method embodiments described above are merely schematic, for example, the flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the medium, system and method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a part of a module, a program segment or a code, and a part of the module, program segment or code includes one or more executable instructions for implementing the specified logical function. It should also be noted that each box in the block diagram and / or the flow chart, and the combination of the boxes in the block diagram and / or the flow chart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.

[0113] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A pipeline leakage detection method, characterized in that: The method comprises: Read the oil and gas pipeline image dataset; Build and improve the YOLOv5s model; The oil and gas pipeline image dataset is input into the improved YOLOv5s model to identify whether the oil and gas pipeline is leaking; The construction of the improved YOLOv5s model includes: Build the YOLOv5s model; Several attention modules are inserted into the YOLOv5s model to introduce the attention mechanism.

2. The method according to claim 1, characterized in that: The attention module is inserted into at least one of the following positions of the YOLOv5s model, including before or after the convolutional layer, residual block, and feature fusion layer.

3. The method according to claim 2, characterized in that: The introduced attention mechanism includes: Receiving the oil and gas pipeline picture inputted by the input channel; Pooling is performed along the length direction and the width direction of the oil and gas pipeline image to obtain a first length feature vector map and a first width feature vector map; Merging the length feature vector map and the first width feature vector map to form a first feature layer; Convolutional feature layer; The convolutional feature layer is transformed using batch normalization and nonlinear activation functions to form a second feature layer; Segment the second feature layer in the length direction and the width direction to form a second length feature vector map and a second width feature vector map; After convolving the second length feature vector map and the second width feature vector map, a nonlinear activation function conversion is performed to form a third length feature vector map and a third width feature vector map; Output the merged third length feature vector map and third width feature vector map.

4. The method according to claim 1, characterized in that: When training the YOLOv5s model with the attention mechanism, let the loss function be the EIOU loss function, which is: Where: ρ is the Euclidean distance between the two center points; b is the center point of the prediction box; h is the height of the prediction box; w is the width of the prediction box; b gt is the center point of the real frame; h gt is the height of the real frame; w gt is the width of the real frame; h c is the height of the minimum bounding box; h w The width of the minimum bounding box.

5. The method according to claim 1, characterized in that: When training the YOLOv5s model with the attention mechanism, let the loss function be the IOU loss function, which is: Where: B is the area of ​​the prediction box; B i is the area of ​​the real box.

6. The method according to claim 1, characterized in that: Before reading the oil and gas pipeline image dataset, the method includes: Receive vibration and temperature of preset sampling points of oil and gas pipelines; When the amplitude of the vibration at the preset sampling point is greater than the preset amplitude, and the degree of temperature change is greater than the preset degree, the image of the preset sampling point is collected to form the oil and gas pipeline image data set.

7. A pipeline leakage detection system, characterized in that: include: A reading module configured to read an oil and gas pipeline image dataset; Build module, configured to build improved YOLOv5s model; The recognition module is configured to input the oil and gas pipeline image dataset into the improved YOLOv5s model to identify whether the oil and gas pipeline is leaking; The construction of the improved YOLOv5s model includes: Build the YOLOv5s model; Several attention modules are inserted into the YOLOv5s model to introduce the attention mechanism.

8. A server, characterized in that: The server comprises a processor and a memory coupled to each other, wherein a computer program is stored in the memory. When the computer program is executed by the processor, the server executes the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 6.

Citation Information

Cited By

  • TDGA-YOLO-based cryogenic propellant leakage detection positioning method and device

    CN120635420A