A gas pipeline leakage detection method based on deep learning

By combining deep learning with pipeline image preprocessing and a dual-path channel attention module, the problem of accurate identification in complex backgrounds in gas pipeline leak detection is solved, achieving efficient and low-cost gas leak detection.

CN120823564BActive Publication Date: 2025-11-25SICHUAN SHIELD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511327477.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-17
Publication Date
2025-11-25
Estimated Expiration
2045-09-17

AI Technical Summary

Technical Problem

Existing gas pipeline leak detection technologies struggle to accurately identify minute leaks in complex environments. Traditional methods are highly susceptible to environmental noise interference and are costly. Furthermore, existing datasets suffer from limited labeling, resulting in insufficient feature learning and low segmentation accuracy.

Method used

A deep learning-based gas pipeline leak detection method is adopted, which combines a pipeline image preprocessing module and a dual-path channel attention module. The pipeline region is quickly located by using maximum entropy and region growing adaptive threshold segmentation, and gas leak features are extracted by SegFormer encoder and DPCA to achieve high-precision segmentation.

Benefits of technology

It significantly improves the accuracy and precision of gas pipeline leak detection in complex environments, reduces reliance on traditional methods, lowers additional data annotation costs, and is suitable for low-contrast and complex industrial scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120823564B_ABST
    Figure CN120823564B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on deep learning's gas pipeline leakage detection method, belong to image data processing technical field, including steps: obtaining pipeline leakage detection dataset D1;Based on target entropy and region growing constructs pipeline image preprocessing module, for generating pipeline region annotation on sample;Based on double-path feature extraction and dynamic fusion, FFT feature extraction constructs double-path attention module DPCA;Based on SegFormer encoder and DPCA constructs gas leakage segmentation network and training obtains gas leakage segmentation model, for the pipeline infrared image identification of to-be-identified in recognition.This application does not need to introduce additional pipeline annotation task, can quickly locate pipeline area by pipeline image preprocessing module, by DPCA to feature extraction, analysis and identification, can improve the accuracy of gas leakage detection, especially suitable for the identification of leakage area in pipeline infrared image with low contrast and complex industrial scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image data processing, and particularly relates to a gas pipeline leakage detection method based on deep learning. BACKGROUND

[0002] Gas pipeline leakage detection is of great significance in ensuring public safety, preventing resource waste, and reducing environmental pollution. In high-risk areas such as urban gas pipeline networks, industrial sites, and residential areas, it is very important to quickly and accurately detect gas leaks. Therefore, an efficient and reliable technical solution is urgently needed to achieve all-weather intelligent monitoring. The current mainstream gas pipeline leakage detection technologies mainly include:

[0003] Manual inspection: Professional personnel carry detection equipment to periodically patrol along the pipeline and use sniffing instruments or infrared thermometers to detect possible leakage points. This method is inefficient and costly, and is limited by the inspection cycle and personnel experience, making it difficult to detect sudden leaks. In complex terrain or adverse weather conditions, the coverage and accuracy of manual inspection are greatly reduced.

[0004] Fixed sensor monitoring: Gas concentration sensor networks are deployed along the pipeline to detect changes in the concentration of flammable gases such as methane to determine leakage conditions. This solution can achieve continuous monitoring, but has problems such as large response delay (gas needs to diffuse to the sensor) and susceptibility to environmental temperature and humidity interference. At the same time, the deployment and maintenance cost of the sensor network is high, it is difficult to fully cover long-distance pipelines, and it cannot accurately locate the leakage source.

[0005] Detection based on traditional image processing: Since the leakage area is difficult to identify, and some gases are colorless, infrared cameras are used to capture pipeline infrared images, and edge detection, threshold segmentation, and other algorithms are used to identify suspicious leakage areas. Although this method has lower equipment costs, it has significant technical limitations in complex industrial scenarios: (1) Complex scene and single data annotation: Current pipeline leakage detection datasets such as GasVLeak Dataset only annotate images with leaks and only annotate the leakage area. Its target class is only 1, generally represented by leak or gas-leak. When performing target segmentation, the number of learnable features is relatively small. If additional class annotations are added, it will increase the workload of annotating the pipeline. In addition, when performing gas leakage target segmentation on the pipeline structure in complex industrial scenarios, the pipeline surface features overlap with the leakage area, the pipeline surface is rusted, the vegetation is obstructed, the environmental noise is disturbed, and other factors cause the segmentation accuracy to be low, which significantly reduces the performance of detection systems based on threshold segmentation and edge detection.

[0006] (2) Early identification of small leaks is difficult: gas leaks are inherently hidden, and some gases are colorless or have no obvious color, resulting in low contrast between gas and background in images. Traditional image processing techniques often cannot effectively distinguish between real leaks and visual disturbances such as steam and dust, resulting in high false positive and false negative rates. In addition, traditional identification methods rely mainly on manually designed feature extraction rules, which are extremely sensitive to environmental factors such as light changes and background noise, making it difficult to stably identify small gas leak characteristics.

[0007] Glossary:

[0008] SegFormer (Simple and Efficient Design for Semantic Segmentation with Transformers) is a semantic segmentation network that includes an encoder and a decoder, where the encoder is a MixTransformer encoder (MiT) that extracts multi-scale features through a hierarchical Transformer structure. MiT is divided into four stages, each of which is a Transformer encoder. When an image sample is input, MiT outputs four feature maps Fm1~Fm4 of different scales through stages 1~4, with the scale being 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the image sample, respectively, and the channel number varying with the model size, for example, 32→64→160→256. SUMMARY

[0009] The purpose of the present application is to provide a gas pipeline leakage detection method based on deep learning, which solves the problem of low contrast between pipeline, leakage gas and background in pipeline infrared images, large noise interference, and inaccurate segmentation of leakage gas, which leads to inaccurate detection of gas leakage accidents.

[0010] To achieve the above purpose, the technical scheme adopted by the present application is as follows: a gas pipeline leakage detection method based on deep learning, comprising the following steps:

[0011] S1, obtaining a pipeline leakage detection data set D1, wherein the sample is a pipeline infrared image labeled with a target region, and the target region is a leakage region;

[0012] S2, constructing a pipeline image preprocessing module for generating pipeline region labeling on the sample, wherein the generation method of the pipeline region in the sample comprises steps S21~S24;

[0013] S21, converting the sample into a gray-scale image containing 256 gray levels, and counting the gray-scale distribution of each gray level;

[0014] S22, divide the gray image into background and target by optional gray level s, and obtain a segmentation image, 0≤s≤255, calculate the background information entropy H(B) and the target information entropy H(O) at this time, and calculate the sum of information entropy Hs of the gray level s, Hs=H(B)+H(O);

[0015] S23, obtain the sum of information entropy of each gray level by the method of S22, take the maximum sum of information entropy as the target entropy of the sample, mark the gray level corresponding to the target entropy as the growth threshold Th, and mark the segmentation image corresponding to Th as I Th ;

[0016] S24, traverse I Th in the target region, take the pixel point set with the longest continuous coordinates as the growth region S, and perform region growth on S according to Th to obtain the pipeline region;

[0017] S25, mark the pipeline region to the sample to obtain a preprocessed sample;

[0018] S3, construct a double-path channel attention module DPCA;

[0019] The DPCA is configured to input a first feature map C1 through a first input end, and input a second feature map C2 through a second input end, obtain a third feature map C3 and a fourth feature map C4 by respectively performing depth separable convolution and dilated convolution on C1 and C2, obtain a threshold feature map C5 by performing splicing, 1×1 convolution and sigmod activation operation on C3 and C4, and obtain a fusion feature map C6 according to a formula C6=C3×C5[0]+C4×C5[1], wherein C5[0] and C5[1] are feature maps of first and second channels of C5 respectively;

[0020] perform FFT transformation on C6 and extract real and imaginary parts, splice the real and imaginary parts along the channel dimension, and then perform 1×1 convolution to obtain a first frequency domain feature F1, obtain a second frequency domain feature F2 by multi-layer perception, multiply F2 and C6 to obtain a channel attention feature F3, and obtain an output feature F of the DPCA according to a formula out , wherein F out is the same size as the sample;

[0021] S4, construct a gas leakage segmentation network, including a SegFormer encoder and a DPCA, wherein output ends of stages 2 and 4 of the SegFormer encoder correspond to a first input end and a second input end of the DPCA respectively, and an output feature F out of the DPCA is taken as a prediction output;

[0022] S5, train the gas leak segmentation network until convergence to obtain the gas leak segmentation model. One training step is as follows: obtain a batch of samples, each sample is processed by the pipeline image preprocessing module to generate corresponding preprocessed samples, and then the gas leak segmentation network is used to obtain the predicted output. The loss between the true annotation of the sample and the predicted output is calculated, and the parameters of the gas leak segmentation network are adjusted to minimize the loss.

[0023] S6: Obtain the infrared image of the pipeline to be identified, generate the corresponding preprocessed sample through the pipeline image preprocessing module, and then obtain the prediction output through the gas leak segmentation model.

[0024] Preferably, the pipeline leak detection dataset D1 is the GasVLeak Dataset.

[0025] As a preferred option, the background information entropy H(B) and the target information entropy H(O) are calculated according to the following formulas;

[0026] ,

[0027] ,

[0028] ,

[0029] In the formula, i is the variable representing the background gray level, j is the variable representing the target gray level, and p i Let p be the probability distribution of the i-th background gray level. j Let be the probability distribution of the gray level of the j-th target.

[0030] As a preferred option, the region growing algorithm is as follows: for a pixel q inside the growing region S and a pixel p outside the growing region S, if p is an eight-neighbor pixel of q and |f(q)–f(p)|≤Th, then q is judged as a similar pixel and added to the growing region S, where f(q) and f(p) are the gray levels of pixels q and p, respectively.

[0031] Preferably, the dual-path attention module DPCA includes a first input terminal, a second input terminal, a depthwise separable convolutional layer, a dilated convolutional layer, a concatenated convolutional layer, a dynamic fusion layer, a frequency domain feature extraction layer, a frequency domain feature processing layer, a multilayer perceptron layer, an extended multiplication layer, and a convolutional addition layer.

[0032] The first input terminal and the second input terminal are used to input C1 and C2, respectively;

[0033] The depthwise separable convolutional layer is used to perform a 3×3 depthwise separable convolution on C1 to obtain C3;

[0034] The dilated convolutional layer is used to perform a 3×3 dilated convolution on C2 to obtain C4;

[0035] The concatenated convolutional layer is used to concatenate C3 and C4, perform 1×1 convolution and sigmoid activation operation to obtain the threshold feature map C5. C5 has two output channels, namely the first channel and the second channel.

[0036] The dynamic fusion layer is used to obtain the fusion feature map C6 according to the formula C6=C3×C5[0]+C4×C5[1], where C5[0] and C5[1] are the feature maps of the first and second channels of C5, respectively;

[0037] The frequency domain feature extraction layer is used to perform FFT transformation on C6 and extract the real and imaginary parts;

[0038] The frequency domain feature processing layer is used to concatenate the real and imaginary parts along the channel dimension and then perform a 1×1 convolution to obtain the first frequency domain feature F1;

[0039] The multi-layer sensing layer is used to perform multi-layer sensing on F1 through the steps of fully connected layer compression, ReLU activation, and fully connected layer recovery to obtain the second frequency domain feature F2.

[0040] The extended multiplication layer is used to multiply F2 and C6 to obtain the channel attention feature F3;

[0041] The convolutional summation layer is used to adjust F3 and C4 to the sample size using 3×3 convolutions, and then sums them element by element to obtain the output feature F. out .

[0042] Preferably, the annotation in S25 is pixel-level, including the category and coordinates of the pipe region, wherein the category is the pipe region.

[0043] As a preferred choice, the loss in S5 is the cross-entropy loss.

[0044] Regarding the pipeline image preprocessing module: Based on the shape characteristics of pipelines, a pipeline image preprocessing module was designed by combining maximum entropy and region growing to quickly locate pipeline regions in infrared pipeline images. This is because gas leaks typically originate from pipeline regions. In subsequent target detection, the pipeline region can be prioritized, eliminating interference from background areas in the image and helping the gas leak segmentation network to more accurately segment the leak area. In the pipeline image preprocessing module, different samples correspond to different gray levels of target entropy, and the growth threshold Th also varies. This allows for dynamic adjustment of the growth threshold for different samples, effectively filtering out most background interference, improving the signal-to-noise ratio of leaking gas pixels, reducing the area that the segmentation model focuses on, and significantly improving the performance and accuracy of gas leak segmentation. Combined with the geometric characteristics of the pipeline, the pipeline coordinates in the sample can be quickly located during region growing.

[0045] Regarding the dual-path attention module DPCA: Two paths were designed. One path takes the shallow features (stage 2 feature map) of the Segformer encoder as input to C1, and the other path takes the deep features (stage 4 feature map) of the Segformer encoder as input to C2. C1 and C2 are processed respectively to obtain C3 and C4. The feature map size of C3 and C4 is consistent with that of C1. Then, the threshold feature C5 is obtained by row concatenation, 1×1 convolution and sigmoid activation operation. The output channel of C5 is 2 and the size remains unchanged. According to the formula C6=C3×C5[0]+C4×C5[1], dynamic fusion is completed to obtain feature C6. Then, the frequency domain feature is extracted by two-dimensional real number fast Fourier transform of C6, highlighting the periodic or directional features of gas leakage. Then, the frequency domain feature is split into real part and imaginary part, and after processing, F1 is obtained. The size and height of F1 are consistent with C2, and the width is C2 / 2+1, which can more comprehensively characterize the frequency domain mode of gas leakage. After obtaining F1, the second frequency domain feature F2 is obtained through multi-layer perception. F2 and C6 are multiplied to obtain the channel attention feature F3. Finally, F3 and C2 are convolved in 3×3, the original image is resized, and the two are added to obtain the output feature F. out .

[0046] Compared with the prior art, the advantages of the present invention are as follows:

[0047] (1) A pipeline image preprocessing module was designed, which can quickly identify pipeline regions in samples of existing pipeline leak detection datasets and integrate them into the subsequent identification of leak regions. This module is compatible with existing publicly available pipeline leak detection data, requires no additional data annotation, and has universal applicability.

[0048] (2) In the pipeline image preprocessing module, an adaptive threshold segmentation method based on the combination of maximum image entropy and region growing is proposed: First, different segmentation thresholds are adaptively generated for different samples by maximizing the sum of background information entropy and target information entropy to generate segmented images, effectively solving the problem of separating the pipeline from the background in low-contrast pipeline infrared images. Second, instead of directly using the target in the segmented image as the pipeline region, the segmentation threshold is used as the growth threshold. Combining the elongated shape of the pipeline, a line is first found in the target region of the pipeline infrared image, and the set of pixels corresponding to the line is used as the growth region S. Then, the pipeline region is quickly generated by combining the growth threshold and the region growing algorithm. This method is a re-segmentation based on the segmented image, which not only makes the segmentation more accurate but also allows for rapid localization of the pipeline coordinates in the pipeline infrared image. This method segments the pipeline region quickly and accurately.

[0049] (3) A dual-path channel attention module (DPCA) was designed as the decoder for matching the SegFormer encoder. Given the pipe coordinates, the SegFormer encoder extracts features at two different scales and feeds them into the DPCA. The DPCA then uses a dual-path mechanism (high-frequency details and low-frequency context) to capture the local detail features and global context information of the gas leak in the preprocessed sample, solving the problem of insufficient feature extraction in complex backgrounds by the traditional single-path model. Secondly, a dynamic fusion layer was designed, which can adaptively generate a threshold feature C5 (dynamic threshold) to achieve intelligent weighted fusion of dual-path features. Finally, a frequency-domain enhanced channel attention mechanism was introduced, using fast Fourier transform to extract and analyze the characteristic bands of the leaking gas, significantly improving the modeling ability of inter-channel dependencies, thereby improving the segmentation accuracy of the leaking gas in the infrared image.

[0050] In summary, this invention eliminates the need for additional pipeline annotation tasks. By combining maximum image entropy and region growing for adaptive threshold segmentation, it can quickly locate pipeline regions in infrared images, helping the segmentation model to more accurately segment leaking gas regions. By using DPCA to extract, analyze, and identify features from the Segformer encoder output, it can improve the accuracy of gas leak detection, and is particularly suitable for identifying leaking regions in pipeline infrared images with low contrast and complex industrial scenarios. Attached Figure Description

[0051] Figure 1 Diagram of a gas leak segmentation network structure;

[0052] Figure 2 This is a structural diagram of the dual-path attention module. Detailed Implementation

[0053] The present invention will be further described below with reference to the embodiments and accompanying drawings.

[0054] Example 1: See Figure 1 and Figure 2 A deep learning-based method for detecting gas pipeline leaks includes the following steps;

[0055] S1, Obtain pipeline leak detection dataset D1, where the samples are infrared images of pipelines marked with a target area, and the target area is the leak area;

[0056] S2, Construct a pipe image preprocessing module to generate pipe region annotations on samples, wherein the method for generating pipe regions in a sample includes steps S21 to S24;

[0057] S21, convert the sample into a grayscale image containing 256 gray levels, and count the grayscale distribution of each gray level;

[0058] S22, randomly select a gray level s to divide the gray image into background and target, and obtain the segmented image, 0≤s≤255, calculate the background information entropy H(B) and target information entropy H(O) at this time, and calculate the sum of the information entropy of gray level s Hs, Hs=H(B)+H(O).

[0059] S23, obtain the sum of information entropy for each gray level using the method in S22, take the sum of the largest information entropy as the target entropy of the sample, label the gray level corresponding to the target entropy as the growth threshold Th, and label the segmented image corresponding to Th as I. Th ;

[0060] S24, Traversal I Th The set of pixels with the longest consecutive coordinates in the target region is taken as the growth region S. The pipe region is obtained by growing S according to Th using the region growing algorithm.

[0061] S25, mark the pipeline area in the sample to obtain the preprocessed sample;

[0062] S3, construct the dual-path attention module DPCA;

[0063] The DPCA is used to input a first feature map C1 through the first input terminal and a second feature map C2 through the second input terminal. C1 and C2 are respectively subjected to depthwise separable convolution and dilated convolution to obtain a third feature map C3 and a fourth feature map C4. Then, C3 and C4 are concatenated, 1×1 convolution and sigmoid activation operation to obtain a threshold feature map C5. Then, according to the formula C6=C3×C5[0]+C4×C5[1], a fused feature map C6 is obtained, where C5[0] and C5[1] are the feature maps of the first and second channels of C5, respectively.

[0064] Perform an FFT transformation on C6 to extract its real and imaginary parts. Concatenate the real and imaginary parts along the channel dimension and then perform a 1×1 convolution to obtain the first frequency domain feature F1. After multilayer perceptron processing, obtain the second frequency domain feature F2. Multiply F2 and C6 to obtain the channel attention feature F3. Then, according to the formula... Obtain the output feature F of DPCA out The F out Same as sample size;

[0065] S4, construct a gas leak segmentation network, including a SegFormer encoder and a DPCA, wherein the outputs of stages 2 and 4 of the SegFormer encoder are respectively connected to the first and second inputs of the DPCA, and the output feature F of the DPCA is... out As the predicted output;

[0066] S5, train the gas leak segmentation network until convergence to obtain the gas leak segmentation model. One training step is as follows: obtain a batch of samples, each sample is processed by the pipeline image preprocessing module to generate corresponding preprocessed samples, and then the gas leak segmentation network is used to obtain the predicted output. The loss between the true annotation of the sample and the predicted output is calculated, and the parameters of the gas leak segmentation network are adjusted to minimize the loss.

[0067] S6: Obtain the infrared image of the pipeline to be identified, generate the corresponding preprocessed sample through the pipeline image preprocessing module, and then obtain the prediction output through the gas leak segmentation model.

[0068] In this embodiment, the pipeline leak detection dataset D1 is the GasVLeak Dataset. The background entropy H(B) and target entropy H(O) are calculated according to the following formulas;

[0069] ,

[0070] ,

[0071] ,

[0072] In the formula, i is the variable representing the background gray level, j is the variable representing the target gray level, and p i Let p be the probability distribution of the i-th background gray level. j Let be the probability distribution of the gray level of the j-th target.

[0073] In this embodiment, the region growing algorithm is as follows: For a pixel q inside the growing region S and a pixel p outside the growing region S, if p is an eight-neighbor pixel of q and |f(q)–f(p)|≤Th, then q is judged as a similar pixel and added to the growing region S. f(q) and f(p) are the gray levels of pixels q and p, respectively.

[0074] The Dual-Path Attention Module (DPCA) includes a first input, a second input, a depthwise separable convolutional layer, a dilated convolutional layer, a concatenated convolutional layer, a dynamic fusion layer, a frequency domain feature extraction layer, a frequency domain feature processing layer, a multilayer perceptron layer, an extended multiplication layer, and a convolutional addition layer.

[0075] The first input terminal and the second input terminal are used to input C1 and C2, respectively;

[0076] The depthwise separable convolutional layer is used to perform a 3×3 depthwise separable convolution on C1 to obtain C3;

[0077] The dilated convolutional layer is used to perform a 3×3 dilated convolution on C2 to obtain C4;

[0078] The concatenated convolutional layer is used to concatenate C3 and C4, perform 1×1 convolution and sigmoid activation operation to obtain the threshold feature map C5. C5 has two output channels, namely the first channel and the second channel.

[0079] The dynamic fusion layer is used to obtain the fusion feature map C6 according to the formula C6=C3×C5[0]+C4×C5[1], where C5[0] and C5[1] are the feature maps of the first and second channels of C5, respectively;

[0080] The frequency domain feature extraction layer is used to perform FFT transformation on C6 and extract the real and imaginary parts;

[0081] The frequency domain feature processing layer is used to concatenate the real and imaginary parts along the channel dimension and then perform a 1×1 convolution to obtain the first frequency domain feature F1;

[0082] The multi-layer sensing layer is used to perform multi-layer sensing on F1 through the steps of fully connected layer compression, ReLU activation, and fully connected layer recovery to obtain the second frequency domain feature F2.

[0083] The extended multiplication layer is used to multiply F2 and C6 to obtain the channel attention feature F3;

[0084] The convolutional summation layer is used to adjust F3 and C4 to the sample size using 3×3 convolutions, and then sums them element by element to obtain the output feature F. out .

[0085] In step S25, the annotation is pixel-level, including the category and coordinates of the pipe region, where the category is the pipe region. The loss in step S5 is the cross-entropy loss.

[0086] Example 2: See Figure 1 and Figure 2 To illustrate the effectiveness of this invention, a comparative experiment was conducted, designed as follows:

[0087] Dataset: GasVLeak Dataset, with a training set to validation set ratio of 8:2.

[0088] Experimental environment: The hardware environment is NVIDIA RTX 2080Ti GPU, and the software environment is PyTorch 1.12.

[0089] Target detection was performed using four existing technical methods and the method of this invention under the same experimental settings, and accuracy and mean cross-union ratio (mIoU) were selected as evaluation indicators, resulting in Table 1 below.

[0090] Table 1. Comparison of Evaluation Indicators

[0091] Method Accuracy % mIoU % SegNet 79.88 73.36 DeeplabV3+ 83.23 77.24 Segformer 86.16 81.09 UNet 85.47 79.16 The invention 88.79 83.86

[0092] As shown in Table 1, the present invention significantly improves both accuracy and average crossover ratio.

[0093] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A deep learning-based method for detecting gas pipeline leaks, characterized in that, Includes the following steps; S1, Obtain pipeline leak detection dataset D1, where the samples are infrared images of pipelines marked with a target area, and the target area is the leak area; S2, Construct a pipe image preprocessing module to generate pipe region annotations on samples, wherein the method for generating pipe regions in a sample includes steps S21 to S24; S21, convert the sample into a grayscale image containing 256 gray levels, and count the grayscale distribution of each gray level; S22, randomly select a gray level s to divide the gray image into background and target, and obtain the segmented image, 0≤s≤255, calculate the background information entropy H(B) and target information entropy H(O) at this time, and calculate the sum of the information entropy of gray level s Hs, Hs=H(B)+H(O). S23, obtain the sum of information entropy for each gray level using the method in S22, take the sum of the largest information entropy as the target entropy of the sample, label the gray level corresponding to the target entropy as the growth threshold Th, and label the segmented image corresponding to Th as I. Th ; S24, Traversal I Th The set of pixels with the longest consecutive coordinates in the target region is taken as the growth region S. The pipe region is obtained by growing S according to Th using the region growing algorithm. S25, mark the pipeline area in the sample to obtain the preprocessed sample; S3, construct a dual-path attention module; The dual-path attention module is used to input a first feature map C1 through the first input terminal and a second feature map C2 through the second input terminal. C1 and C2 are respectively subjected to depthwise separable convolution and dilated convolution to obtain a third feature map C3 and a fourth feature map C4. Then, C3 and C4 are concatenated, subjected to 1×1 convolution and sigmoid activation operation to obtain a threshold feature map C5. Then, according to the formula C6=C3×C5[0]+C4×C5[1], a fused feature map C6 is obtained, where C5[0] and C5[1] are the feature maps of the first and second channels of C5, respectively. Perform an FFT transformation on C6 to extract its real and imaginary parts. Concatenate the real and imaginary parts along the channel dimension and then perform a 1×1 convolution to obtain the first frequency domain feature F1. After multilayer perceptron processing, obtain the second frequency domain feature F2. Multiply F2 and C6 to obtain the channel attention feature F3. Then, according to the formula... Obtain the output features F of the dual-path attention module out The F out Same as sample size; S4, construct a gas leak segmentation network, including a SegFormer encoder and a dual-pathway attention module. The outputs of stages 2 and 4 of the SegFormer encoder are respectively connected to the first and second inputs of the dual-pathway attention module. The output feature F of the dual-pathway attention module is then processed. out As the predicted output; S5, train the gas leak segmentation network until convergence to obtain the gas leak segmentation model. One training step is as follows: obtain a batch of samples, each sample is processed by the pipeline image preprocessing module to generate corresponding preprocessed samples, and then the gas leak segmentation network is used to obtain the predicted output. The loss between the true annotation of the sample and the predicted output is calculated, and the parameters of the gas leak segmentation network are adjusted to minimize the loss. S6: Obtain the infrared image of the pipeline to be identified, generate the corresponding preprocessed sample through the pipeline image preprocessing module, and then obtain the prediction output through the gas leak segmentation model.

2. The gas pipeline leak detection method based on deep learning according to claim 1, characterized in that, The pipeline leak detection dataset D1 is the GasVLeak Dataset.

3. The gas pipeline leak detection method based on deep learning according to claim 1, characterized in that, Background information entropy H(B) and target information entropy H(O) are calculated according to the following formulas respectively; , , , In the formula, i is the variable representing the background gray level, j is the variable representing the target gray level, and p i Let p be the probability distribution of the i-th background gray level. j Let be the probability distribution of the gray level of the j-th target.

4. The gas pipeline leak detection method based on deep learning according to claim 1, characterized in that, The region growing algorithm is as follows: For a pixel q inside the growing region S and a pixel p outside the growing region S, if p is an eight-neighbor pixel of q and |f(q)–f(p)|≤Th, then q is judged as a similar pixel and added to the growing region S. f(q) and f(p) are the gray levels of pixels q and p, respectively.

5. The gas pipeline leak detection method based on deep learning according to claim 1, characterized in that, The dual-path attention module includes a first input terminal, a second input terminal, a depthwise separable convolutional layer, a dilated convolutional layer, a concatenated convolutional layer, a dynamic fusion layer, a frequency domain feature extraction layer, a frequency domain feature processing layer, a multilayer perceptron layer, an extended multiplication layer, and a convolutional addition layer. The first input terminal and the second input terminal are used to input C1 and C2, respectively; The depthwise separable convolutional layer is used to perform a 3×3 depthwise separable convolution on C1 to obtain C3; The dilated convolutional layer is used to perform a 3×3 dilated convolution on C2 to obtain C4; The concatenated convolutional layer is used to concatenate C3 and C4, perform 1×1 convolution and sigmoid activation operation to obtain the threshold feature map C5. C5 has two output channels, namely the first channel and the second channel. The dynamic fusion layer is used to obtain the fusion feature map C6 according to the formula C6=C3×C5[0]+C4×C5[1], where C5[0] and C5[1] are the feature maps of the first and second channels of C5, respectively; The frequency domain feature extraction layer is used to perform FFT transformation on C6 and extract the real and imaginary parts; The frequency domain feature processing layer is used to concatenate the real and imaginary parts along the channel dimension and then perform a 1×1 convolution to obtain the first frequency domain feature F1; The multi-layer sensing layer is used to perform multi-layer sensing on F1 through the steps of fully connected layer compression, ReLU activation, and fully connected layer recovery to obtain the second frequency domain feature F2. The extended multiplication layer is used to multiply F2 and C6 to obtain the channel attention feature F3; The convolutional summation layer is used to adjust F3 and C4 to the sample size using 3×3 convolutions, and then sums them element by element to obtain the output feature F. out .

6. The gas pipeline leak detection method based on deep learning according to claim 1, characterized in that, The annotations in S25 are pixel-level annotations, including the category and coordinates of the pipe region, where the category is the pipe region.

7. The gas pipeline leak detection method based on deep learning according to claim 1, characterized in that, In S5, the loss is the cross-entropy loss.

Citation Information

Patent Citations

  • Method for quickly positioning leakage point based on image recognition

    CN114581440A

  • Flood remote sensing image segmentation method based on deep learning

    CN118762190A