Leakage detection method based on improved DenseNet model

By improving the network structure of the DenseNet model and using technical means such as deep separable convolution and variable growth rate, the existing models have solved the problems of large amount of computing, high memory consumption and high training difficulty in pipeline leakage detection, and efficient and accurate pipeline leakage detection and classification are achieved.

CN120375059APending Publication Date: 2025-07-25WANJITAI TECH GRP DIGITAL CITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510447598.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing ResNet and DenseNet models have problems such as insufficient feature reuse, limited local feature modeling capabilities, large computing volume, high memory consumption, and high training difficulty in pipeline leakage detection, making it difficult to effectively detect and classify pipeline leakage.

Method used

By improving the DenseNet model, the Stem module, multiple Stage modules, Transition modules, GlobalAvgPool modules and LayerNorm modules are used, combining deep separable convolution, variable growth rate and segmentation patch preprocessing, optimize the network structure to improve accuracy and speed.

Benefits of technology

It realizes accurate and efficient detection and classification of pipeline leakage under extreme data conditions, meets actual engineering needs, improves detection accuracy and processing speed, and reduces computing costs and memory consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120375059A_ABST
    Figure CN120375059A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of pipeline leakage detection and classification, and particularly relates to a leakage detection method based on an improved DenseNet model, and the method comprises the steps: building the improved DenseNet model, and carrying out the pipeline leakage detection through the built improved DenseNet model; according to the method, a new transformation layer is provided to replace an original transformation layer, segmentation patch preprocessing is added, the growth rate GR and the overall depth of the network are remodeled, meanwhile, ER and GR are decoupled, and the model is enhanced with the input dimension, so that the network obtains higher precision and processing speed under the condition that the processing is more extreme, and the processing efficiency of the network is improved. Therefore, faults such as pipeline leakage can be accurately and efficiently detected and classified, and actual engineering requirements are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of pipeline leakage detection and classification, and particularly relates to a leakage detection method based on an improved DenseNet model. Background Art

[0002] Pipeline transportation has become one of the important means for transporting fluid industrial products such as oil, natural gas, and water. However, pipeline failures can cause huge property losses and environmental hazards, especially when transporting chemical industrial gases or liquids with corrosiveness, flammability, etc. Therefore, it is very important to detect any pipeline damage in time to prevent catastrophic consequences.

[0003] In recent years, deep learning DL methods have also made important progress in pipeline detection. For example, long short-term memory models are used to study the relationship between pipeline corrosion depth and its influencing factors. A visual depth transfer learning method is used, which can not only predict the defect size but also estimate the defect cross-sectional profile of oil and gas pipelines. A method for identifying harmful (such as cracks) or non-harmful (noise events, etc.) defects in magnetic flux leakage images through a CNN network.

[0004] However, it should be noted that although networks such as Transformer have been successively proposed, using convolutional neural networks to handle such problems is still a quite effective means, and networks such as the Resnet series and Densenet series still have performance that does not belong to the former.

[0005] The defects of ResNet in processing pipeline leakage images include insufficient feature reuse, limited local feature modeling ability, and large parameter and computational amounts. Although its residual connection alleviates the vanishing gradient, it cannot make full use of the features of all layers, which may lead to the loss of subtle leakage features. In addition, ResNet relies on local convolution, making it difficult to capture global context information, and the large computational amount is prone to overfitting when the data is limited, requiring higher deployment resources.

[0006] Although DenseNet has been improved on the basis of Resnet, its defects in processing pipeline leakage images mainly include high memory consumption, feature redundancy, and high training difficulty. Although its dense connection enhances feature reuse, it leads to a rapid increase in the number of feature maps and high memory consumption, which is more obvious especially for high-resolution images. In addition, the dense connection may cause feature redundancy, reducing the sensitivity to key leakage features, and the complex structure is prone to training instability when the data is limited, increasing the risk of overfitting or underfitting. Summary of the Invention

[0007] To solve the above technical problems, the present invention provides a leakage detection method based on an improved DenseNet model, including:

[0008] An improved DenseNet model is established, and pipeline leakage detection is carried out through the established improved DenseNet model;

[0009] The improved DenseNet model includes: a Stem module, multiple Stage modules, a Transition module, a GlobalAvgPool module, a LayerNorm module, and a fully connected layer;

[0010] Pipeline leakage detection is carried out through the established improved DenseNet model, including:

[0011] S1: Input the pipeline fault pictures into the Stem module for preprocessing, and divide the original large pictures into several small pictures;

[0012] S2: Input the divided pictures into multiple Stage modules for multi-layer feature extraction;

[0013] S3: After feature extraction in each layer of the Stage module, the LayerNorm module is used to reduce the dimension and downsample the features to facilitate deeper feature extraction in the next stage;

[0014] S4: Input the output features of the last layer of the Stage module into the GlobalAvgPool module for global average pooling operation, compress the feature map in the spatial dimension, and convert it into a fixed-length feature vector;

[0015] S5: Input the feature vector after global average pooling into the LayerNorm module for normalization processing to make the feature distribution more stable;

[0016] S6: Use the previously obtained feature vector as input, and through a fully connected operation, map the features to the corresponding category space to obtain the pipeline fault category.

[0017] Advantages of the present invention:

[0018] In the present invention, a new transition layer Transition is proposed to replace the original transition layer, segmentation patch preprocessing is added and the growth rate GR and the overall depth of the network are reshaped. At the same time, ER and GR are decoupled and combined with the input dimension to enhance the model. In this way, the network can obtain higher accuracy and processing speed when facing more extreme situations (such as large batch data, unbalanced data), so as to realize accurate and efficient detection and classification of pipeline leakage and other faults, meeting the actual engineering requirements. Description of the Drawings

[0019] Figure 1 It is a schematic diagram of the backbone network structure of the IDnet of the present invention;

[0020] Figure 2 It is a schematic diagram of the feature extraction process, i.e., the F process, of the 1-4 stages (IDnet block) in the IDnet of the present invention;

[0021] Figure 3 It is a schematic diagram of the processing flow of the IDnet block of the present invention;

[0022] Figure 4 It is a schematic diagram of the process of Transition S / 2 after each IDnet block of the present invention. Specific embodiments

[0023] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0024] A leakage detection method based on an improved DenseNet model, as Figure 1 shown, includes:

[0025] Establish an improved DenseNet model, and perform pipeline leakage detection through the established improved DenseNet model;

[0026] The improved DenseNet model includes: a Stem module, multiple Stage modules, a Transition module, a GlobalAvgPool module, a LayerNorm module, and a fully connected layer;

[0027] Performing pipeline leakage detection through the established improved DenseNet model includes:

[0028] S1: Input the pipeline fault picture into the Stem module for preprocessing, and divide the original large picture into several small pictures;

[0029] S2: Input the divided pictures into multiple Stage modules for multi-layer feature extraction;

[0030] S3: After feature extraction of each layer of the Stage module, use the LayerNorm module to reduce the dimension and downsample the features to facilitate deeper feature extraction in the next stage;

[0031] In the process of feature extraction, the original convolution layer is changed to a depth-wise separable convolution, which can significantly reduce the amount of calculation while ensuring its feature extraction capability. By adjusting the kernel (for example, changing the kernel to 7), the output channel is made smaller than the input channel. This dimensionality reduction can be regarded as a compression of the input features. This compression can reduce the feature dimension and remove redundant information while retaining key information. The feature extraction process is as follows: Figure 2 .

[0032] Finally, the post-activation function is used to improve the gradient flow and LN is used instead of BN to reduce the internal covariate shift and improve the training stability.

[0033] Changes in the intermediate dimensions, which are the dimensions after a single feature extraction operation. Traditional DenseNets also use inverse dilation convolution to expand the receptive field, but their inverse dilation convolution ratio (ER) only changes with the growth rate (GR) (for example, ER = 4 × GR) to reduce the input and output dimensions. However, this actually impairs the ability to encode features through nonlinearity. Therefore, the method is redesigned by making ER proportional to the input dimension (ER is decoupled from GR), and halving GR (for example, from 120 to 60), so that features can be further enriched and computational costs can be controlled before applying nonlinearity.

[0034] At the same time, introducing variable GR instead of unified GR can significantly improve the accuracy. The so-called variable GR means that GR changes with the deepening of the network architecture. Generally, GR can be gradually reduced as the network goes from shallow to deep.

[0035] The first three stages are followed by a conversion layer, which mainly reduces the dimension and downsamples the output of the previous stage to facilitate deeper feature extraction in the next stage. Figure 4 shown.

[0036] The transition layers between each stage are designed to reduce the number of channels. Due to the dense connections in each block, the dense accumulation of features does not allow a high growth rate (GR). The situation becomes worse when multiple blocks are stacked within one stage, such as in the third stage, where many blocks are accumulated in one stage with low GR.

[0037] 1: Use a transition layer in a stage, not only after each stage, but also after every three blocks, with a stride of 1. These transition layers focus on dimensionality reduction rather than downsampling. This modification significantly reduces the computational cost.

[0038] 2: Improve the transition layer, delete the average pool, unify it to global average pooling, and replace the convolution by adjusting the kernel size and stride. In this way, the transition layer can also play a role in dimensionality reduction and downsampling, and the transition layer is placed after each stage.

[0039] S4: Input the output features of the last-stage Stage module into the GlobalAvgPool module for global average pooling operation, compress the feature map in the spatial dimension, and convert it into a fixed-length feature vector;

[0040] S5: Input the feature vector after global average pooling into the LayerNorm module for normalization to make the feature distribution more stable;

[0041] S6: Use the previously obtained feature vector as input, and through a fully connected operation, map the features to the corresponding class space to obtain the pipeline fault category.

[0042] The improvement compared to classical DenseNets such as 121, 169, 201 (the following changes are all based on 201 as the baseline), the IDnet process is as Figure 1 shown.

[0043] 【1】Overall architecture changes:

[0044] Expand the network by increasing the GR while reducing its depth. Specifically, to achieve this goal, increase the GR from 32 to 120; to adjust the number of blocks in each stage, reduce it from (6, 12, 48, 32) to a smaller (3, 3, 12, 3) for depth adjustment. This strategic modification can speed up training and reduce memory.

[0045] The Stem module consists of two parts. One is the original flipping, scaling, rotating, operating, and edge padding operations to enrich the data diversity. The other part is the newly added Patchification operation. Before formally extracting features from the image, divide the image into several small images by setting the patch size to 4 and the stride to 4 (only the initial value, which can be changed during actual processing), and then input them into the network for feature extraction.

[0046] 1. Layer normalization (Ln) replaces batch normalization (BN).

[0047] 2. Post-activation function, that is, perform a linear transformation first and then an activation operation.

[0048] 3. Use depthwise separable convolution instead of the original convolution layer.

[0049] 4. Adjust the kernel to 7 and make the output channels less than the input channels.

[0050] After the above operations, the computational cost is slightly increased but the accuracy is greatly improved.

[0051] The IDnet block in the stage module associates ER with the feature dimension input to the IDnet block module, enabling the channel expansion of each IDnet block to increase as the input dimension expands.

[0052] DenseNets also adopt ER (inverse bottleneck expansion ratio); however, it is only applied to the growth rate (GR) (e.g., ER = 4×GR), rather than the input dimension, to reduce the input and output dimensions. But this actually impairs the ability to encode features through non-linearity.

[0053] Therefore, the method is redesigned by making ER proportional to the input dimension (decoupling ER from GR). This change results in an increased computational demand for larger intermediate dimensions, halving the GR (e.g., from 120 to 60). That is, the features are enriched before applying non-linearity, and 7 channels are further compressed to control the computational cost. Faster training speed and improved accuracy are achieved.

[0054] The transition layer in the stage module. The transition layer mainly reduces the dimension and downsamples the output of the previous stage to facilitate deeper feature extraction in the next stage. The transition layer is as Figure 4 .

[0055] The transition layer between each stage aims to reduce the number of channels. Due to the dense connections in each block, the dense accumulation of features does not allow a high growth rate (GR). The situation becomes worse when multiple blocks are stacked within a stage. For example, in the third stage, many blocks accumulate in a stage with a low GR.

[0056] Using a transition layer in a stage, not only after each stage, but also after every three blocks, with a stride of 1. These transition layers focus on dimensionality reduction rather than downsampling. This modification significantly reduces the computational cost.

[0057] Improve the transition layer, remove the average pooling, perform global average pooling uniformly at the end, and replace the convolution by adjusting the kernel size and stride. In this way, the transition layer can also play the role of dimensionality reduction and downsampling, and placing the transition layer after each stage shows a +0.2% p gain with little impact on efficiency.

[0058] Add the Patchification operation to the preprocessing layer. Before feature extraction from the original image, through a Stem preprocessing layer with the Patchification operation, set the patch size to 4 and the stride to 4. This significantly reduces the computational amount and improves the computational speed.

[0059] Merge the channel layer scales through a processing method similar to the squeeze-and-excitation network to achieve the purpose of rescaling.

[0060] Input the pipeline fault picture into the RDNet network for classification. The functions of each layer and the overall process are as follows: The input pipeline fault picture passes through the Stem module, multiple Stage modules and Transition modules, the GlobalAvgPool module, the LayerNorm module in sequence, and finally outputs the classification result through the FC (fully connected) layer.

[0061] Stem layer: As the starting part of the network, perform Patchification operation on the input pipeline fault picture, and convert the original image data into a feature representation suitable for subsequent network processing.

[0062] The Stage module adopts the IDnet block structure. Each IDnet block corresponds to a processing stage, and there are four processing stages in total, as Figure 3 shown;

[0063] Each processing stage uses a feature mixer composed of a 7×7 depthwise separable convolution, a LayerNorm layer normalization, a Linear linear transformation layer, a GELU activation function, and a Linear linear transformation layer in sequence to extract features;

[0064] The divided picture first performs a convolution operation independently on each channel through a depth convolution using a 7×7 convolution kernel. The number of convolution kernels is equal to the number of input channels, and then performs a pointwise convolution using a 1×1 convolution kernel to linearly combine the output of the depth convolution; normalize the features passing through the depthwise separable convolution through the LayerNorm layer, calculate the mean and standard deviation of all feature values of each sample, subtract the mean from each feature value and divide by the standard deviation to obtain the normalized feature value; flatten the normalized two-dimensional features into one-dimensional, perform a linear transformation on it through the Linear linear transformation layer, learn a set of weight parameters through the GeLU activation function, and map the input features to a new feature space; finally, perform a linear transformation again through the Linear linear transformation layer to obtain the final output features.

[0065] It contains multiple feature concatenation (Concat) operations internally. This operation can fuse feature information from different sources and enrich the feature expression.

[0066] The features are further processed using a Feature mixer f. The Feature mixer consists of a (7×7 depthwise separable convolution), LayerNorm (layer normalization), Linear (linear transformation layer), GELU (activation function), Linear, etc., which can mix and transform the features to extract more discriminative features, helping to distinguish different types of pipeline failures. Different Stage modules progress step by step, continuously extracting and integrating more advanced features.

[0067] Processing flow: In the feature extraction operation F within each IDnet block process.

[0068] Depthwise separable convolution: The input first passes through a depthwise convolution using a 7×7 convolution kernel to perform convolution operations independently on each channel, and the number of convolution kernels is equal to the number of input channels. Then, a pointwise convolution uses a 1×1 convolution kernel to linearly combine the output of the depthwise convolution.

[0069] In this way, by splitting the convolution operation, the computational amount and the number of parameters are reduced, which not only improves the computational efficiency, reduces the risk of overfitting and storage requirements, but also speeds up the model training and inference speed on the basis of ensuring the feature extraction ability and a certain accuracy.

[0070] Layer normalization: The features passing through the depthwise separable convolution are normalized by layer normalization. Layer normalization normalizes all feature values of each sample, that is, calculates the mean and variance of the (H*W*C) feature values of each sample, and then subtracts the mean from each feature value and divides by the standard deviation to obtain the normalized feature values. The size of the normalized feature map remains unchanged.

[0071] Linear transformation layer: The normalized two-dimensional features are flattened into one-dimensional, and then linearly transformed. By learning a set of weight parameters, the input features are mapped to a new feature space. The linear transformation layer can further abstract and combine the features to extract more advanced feature representations.

[0072] GeLU activation function: GeLU is a commonly used non-linear activation function, which can introduce non-linearity into the model, enabling the model to learn more complex functional relationships. Its formula is as follows:

[0073] GELU(x) = x·Φ(x)

[0074]

[0075] Transition layer: It contains operations such as LayerNorm and Conv. On the one hand, the feature dimension is changed through the convolution operation; on the other hand, the resolution of the feature map is reduced by downsampling (stride operation) to reduce the computational amount, and it also plays a transitional role between different Stages, adjusting the size and number of channels of the feature map, enabling the network to better process features at different levels.

[0076] Global average pooling layer: It performs global average pooling operation on the feature map after being processed by multiple previous modules. The feature map is compressed in the spatial dimension and transformed into a feature vector with a fixed length, aggregating feature information and reducing the number of parameters.

[0077] Layer normalization: It normalizes the feature vector after global average pooling, making the feature distribution more stable, which helps the training and learning of the subsequent fully connected layer, and improves the stability and convergence speed of the network.

[0078] FC layer: It takes the feature vector obtained previously as input, and through the fully connected operation, maps the features to the corresponding category space. According to the number of categories of pipeline faults, it outputs the corresponding number of nodes. Each node represents a fault category, and the output value of the node represents the probability that the input picture belongs to this category. Finally, the pipeline fault category to which the picture belongs is determined through these probabilities.

[0079] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A leakage detection method based on an improved DenseNet model, characterized in that, Including: Build an improved DenseNet model and perform pipeline leakage detection through the built improved DenseNet model; The improved DenseNet model includes: Stem module, multiple Stage modules, Transition module, GlobalAvgPool module, LayerNorm module, and fully connected layer; Performing pipeline leakage detection through the built improved DenseNet model includes: S1: Input the pipeline fault picture into the Stem module for preprocessing, and divide the original large picture into several small pictures; S2: Input the divided pictures into multiple Stage modules for multi-layer feature extraction; S3: After feature extraction by each layer of the Stage module, use the LayerNorm module to reduce the dimension and downsample the features to facilitate deeper feature extraction in the next stage; S4: Input the output features of the last layer of the Stage module into the GlobalAvgPool module for global average pooling operation, compress the feature map in the spatial dimension, and transform it into a feature vector of a fixed length; S5: Input the feature vector after global average pooling into the LayerNorm module for normalization processing to make the feature distribution more stable; S6: Use the previously obtained feature vector as input, and through a fully connected operation, map the features to the corresponding category space to obtain the pipeline fault category.

2. The leak detection method based on the improved DenseNet model according to claim 1, characterized in that The Stem module consists of two parts. One part includes basic operations such as flipping, scaling, rotating, and edge padding to enrich the diversity of data. The other part newly adds the Patchification operation. The picture is divided into several small pictures by setting the patch size to 4 and the stride to 4.

3. A leakage detection method based on an improved DenseNet model according to claim 1, characterized in that, The Stage module adopts the IDnet block structure, and each IDnet block corresponds to a processing stage, with a total of four processing stages; Each processing stage uses a feature mixer composed of a 7×7 depthwise separable convolution, a LayerNorm layer normalization, a Linear linear transformation layer, a GELU activation function, and a Linear linear transformation layer in sequence for feature extraction; The divided pictures first perform convolution operations independently on each channel through depthwise convolution using a 7×7 convolution kernel. The number of convolution kernels is equal to the number of input channels, and then perform a linear combination of the output of the depthwise convolution through pointwise convolution using a 1×1 convolution kernel; Normalize the features passed through the depthwise separable convolution through the LayerNorm layer, calculate the mean and standard deviation of all feature values for each sample, subtract the mean from each feature value and divide by the standard deviation to obtain the normalized feature values; Flatten the normalized two-dimensional features into one-dimensional, perform a linear transformation on it through the Linear linear transformation layer, learn a set of weight parameters through the GeLU activation function, and map the input features to a new feature space; Finally, perform a linear transformation again through the Linear linear transformation layer to obtain the final output features.

4. The leak detection method based on an improved DenseNet model according to claim 3, characterized in that, The IDnet block makes the channel expansion of each IDnet block expand as the input dimension increases by associating the growth rate ER with the input image dimension.

5. A leakage detection method based on an improved DenseNet model according to claim 1, characterized in that, The improved DenseNet model is improved by using the inverse bottleneck expansion ratio ER; The network is expanded by increasing the growth rate GR and reducing its depth simultaneously to reduce the input and output dimensions.

6. The leak detection method based on an improved DenseNet model according to claim 5, wherein, The network is expanded by increasing the growth rate GR and reducing its depth simultaneously to reduce the input and output dimensions, including: Increasing GR from 32 to 120; to adjust the number of blocks in each stage, the depth is adjusted from (6, 12, 48, 32) to a smaller (3, 3, 12, 3).