Pipeline leakage detection method and device
By combining the multi-wavelet collaborative mechanism and the self-attention mechanism model, the problem of insufficient accuracy in detecting tiny leaks in water supply pipelines is solved, and high-precision detection of tiny leaks is achieved.
Patent Information
- Application Number
- CN202511179180.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-08-21
AI Technical Summary
Existing technologies are difficult to effectively detect tiny leaks in water supply pipes, especially under background noise interference, and the detection accuracy is difficult to meet actual needs.
A multi-wavelet collaborative mechanism is adopted to perform three-level discrete wavelet transform on the pressure signal through Haar wavelet, Daubechies wavelet and Symlet wavelet. The self-attention mechanism model is combined to analyze the detail coefficient sequence of the pressure signal to improve the detection accuracy.
It effectively improves the accuracy and reliability of pipeline micro-leak detection, reduces the risk of misjudgment and missed judgment, and can achieve high-precision leak detection under complex working conditions.
Smart Images

Figure CN120667655A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of pipeline leakage detection and provides a pipeline leakage detection method and device. Background Art
[0002] Common water supply pipeline leak detection methods include negative pressure wave detection, digital signal analysis, and fiber optic acoustic sensing. These methods can detect large-scale leaks to a certain extent, but for small leaks (leak hole area less than 5% and leakage volume less than 5% of the total flow), the detection accuracy often fails to meet actual requirements due to the weak leakage signal and susceptibility to background noise.
[0003] In recent years, with the development of artificial intelligence (AI) technology, deep learning models such as LSTM and Transformer have been gradually applied to pipeline leak detection. Although these models have shown certain advantages in processing complex data patterns, existing research has mainly focused on large-scale leak detection, and high-precision detection methods for small leaks remain imperfect. Summary of the Invention
[0004] Based on this, it is necessary to provide a pipeline leakage detection method and device to address the above technical problems. This method is aimed at detecting small pipeline leaks. By analyzing the pressure signal through multiple wavelet transforms and self-attention models, it can accurately determine whether the pipeline is leaking.
[0005] In a first aspect, the present application provides a pipeline leakage detection method, the method comprising: Obtain the pipeline pressure signal dataset; The Haar wavelet, Daubechies wavelet and Symlet wavelet are selected as the basis functions of discrete wavelet transform. The pressure signal data set is subjected to discrete wavelet transform by using these three wavelets. The discrete wavelet transform scale of each wavelet is three-level to obtain the decomposition coefficient sequence of the discrete wavelet transform of the corresponding wavelet type. The decomposition coefficient sequences of the three discrete wavelet transforms are respectively input into the self-attention mechanism model to obtain the probabilities of three pipeline leakages. The three pipeline leakage probabilities are statistically analyzed, and the conclusion of whether the pipeline is leaking is obtained based on the statistical results.
[0006] In one embodiment, the decomposition coefficient sequence corresponding to the discrete wavelet transform of the wavelet type includes: first, second and third level detail coefficient sequences, and a third level approximation coefficient sequence; The first-level detail coefficient sequence obtained by performing discrete wavelet transform using Haar wavelet as a basis function is defined as the first-level detail coefficient sequence of Haar wavelet. The detection method further includes adjusting the first-level detail coefficient sequence of Haar wavelet. The adjusting step includes: When the conclusion of whether the pipeline is leaking is that the pipeline is not leaking based on the statistical results, Haar wavelet transform is performed on the pressure signal data set to obtain the Haar wavelet first-level detail coefficient sequence, and the standard deviation of the Haar wavelet first-level detail coefficient sequence is calculated to obtain the first dynamic threshold. The part of the Haar wavelet first-level detail coefficient sequence that is greater than the first dynamic threshold is retained, and the rest is set to zero to obtain the adjusted Haar wavelet first-level detail coefficient sequence.
[0007] In one embodiment, the decomposition coefficient sequence corresponding to the discrete wavelet transform of the wavelet type includes: first, second and third level detail coefficient sequences, and a third level approximation coefficient sequence; The second-level detail coefficient sequence obtained by performing discrete wavelet transform using Daubechies wavelet as a basis function is defined as the second-level detail coefficient sequence of Daubechies wavelet. The detection method further includes adjusting the second-level detail coefficient sequence of Daubechies wavelet. The adjusting step includes: Standardize the coefficients in the second-level detail coefficient sequence of the Daubechies wavelet, traverse each coefficient in the standardized Daubechies wavelet second-level detail coefficient sequence, and if the absolute value of the coefficient is greater than the adaptive threshold, adjust the coefficient to the deviation between the coefficient and the adaptive threshold. The sign of the coefficient after adjustment is the same as that before adjustment. If the absolute value of the coefficient is less than or equal to the adaptive threshold, set the coefficient to zero. The adaptive threshold is obtained by multiplying the maximum absolute value of the coefficients in the normalized Daubechies wavelet second-level detail coefficient sequence by a preset ratio.
[0008] In one embodiment, the decomposition coefficient sequence corresponding to the discrete wavelet transform of the wavelet type includes: first, second and third level detail coefficient sequences, and a third level approximation coefficient sequence; The third-level detail coefficient sequence obtained by performing discrete wavelet transform using the Symlet wavelet as a basis function is defined as the Symlet wavelet third-level detail coefficient sequence. The detection method further includes adjusting the Symlet wavelet third-level detail coefficient sequence. The adjustment steps include: Perform fast Fourier transform on the third-level detail coefficient sequence of Symlet wavelet to obtain complex spectrum, and calculate power spectral density based on the complex spectrum; The power spectrum density is smoothed using a moving average filter, and candidate peaks are selected from the smoothed power spectrum density. The candidate peaks are configured to satisfy the following conditions: in the power spectrum density, if the power spectrum density of any target frequency point is greater than the power spectrum density of the frequency points adjacent to it on both sides, then the target frequency point is selected as a candidate peak. Select the frequency point with the largest amplitude from the candidate peaks as the main frequency peak, calculate the half-height width of the main frequency peak, and combine the frequency point, amplitude and half-height width of the main frequency peak to obtain the combined characteristics of the power spectrum; The third-level detail coefficient sequence of the Symlet wavelet is concatenated with the combined features to obtain the adjusted third-level detail coefficient sequence of the Symlet wavelet.
[0009] In one embodiment, the detection method further comprises: Before performing discrete wavelet transform on the pressure signal dataset, the pressure signal dataset is preprocessed as follows: Normalize the pressure signal dataset and segment the processed pressure signal dataset into time-series segments; The time-series segments are input into a multi-layer perceptron for encoding adjustment. The encoded signals are spliced along the time dimension to obtain a global feature matrix. Principal component analysis is used to perform data dimensionality reduction on the global feature matrix to complete preprocessing, making the preprocessed pressure signal dataset compatible with discrete wavelet transform processing.
[0010] In one embodiment, normalizing the pressure signal dataset includes: Calculate the mean and standard deviation of the pressure signal data set, subtract the mean of the pressure signal data set from the pressure time series signal in the pressure signal data set, and divide the difference result by the standard deviation of the pressure signal data set to obtain the standardized pressure time series signal; summarize the standardized pressure time series signals to obtain the standardized pressure signal data set.
[0011] In one embodiment, the decomposition coefficient sequence corresponding to the discrete wavelet transform of the wavelet type includes: first, second and third level detail coefficient sequences, and a third level approximation coefficient sequence, and the detection method further includes: The decomposition coefficient sequence of each discrete wavelet transform is first convolved and then input into the self-attention mechanism model to obtain the probability of pipeline leakage.
[0012] In one embodiment, when performing convolution processing on the first, second and third level detail coefficient sequences respectively, the convolution kernel is configured as 1*2.
[0013] In one embodiment, when performing convolution processing on the third-level approximation coefficient sequence respectively, the convolution kernel is configured as 1*1.
[0014] In a second aspect, the present application further provides a pipeline leakage detection device, which comprises: The pressure detection unit is configured to collect a pipeline pressure time series signal and obtain a pipeline pressure signal data set; The processing unit is configured to apply the pipeline leakage detection method of the first aspect to perform pipeline leakage detection based on the pressure signal data set, and output a conclusion on whether the pipeline is leaking.
[0015] The pipeline leak detection method described above acquires a pipeline pressure signal dataset and performs a three-level discrete wavelet transform (DWT) to extract signal features at different frequency and time scales. Selecting Haar, Daubechies, and Symlet wavelets as basis functions, they can respectively capture characteristics such as sudden changes, noise, and periodicity in the pressure signal, thereby comprehensively analyzing the signal. Inputting the decomposition coefficient sequence of each wavelet basis function into a self-attention mechanism model effectively captures the temporal dependence and global characteristics of the signal. The self-attention mechanism identifies key features by calculating correlations between different locations, thereby improving detection accuracy. Because each wavelet basis function captures different features, statistically combining their outputs can reduce the potential error introduced by a single basis function and increase the reliability of the detection results. This method leverages the advantages of multiple wavelet functions and the self-attention mechanism to effectively improve the accuracy and reliability of pipeline micro-leak detection, reducing the risk of false positives and missed detections. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flow chart of a pipeline leakage detection method in one embodiment; Figure 2 A flowchart of discrete wavelet transform in one embodiment; Figure 3 A flowchart for modeling a self-attention mechanism model in one embodiment; Figure 4 Flowchart showing the following preprocessing of a pressure signal dataset in one embodiment; Figure 5 FIG. 1 is a diagram of a pipeline leakage detection device in one embodiment. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0018] In one embodiment, Figure 1 As shown, a pipeline leakage detection method is provided, which includes the following steps: Step 101: Obtain a pipeline pressure signal dataset; Specifically, professional data acquisition equipment can be used to collect pressure data, such as installing a pressure sensor on the pipeline to monitor the pipeline pressure signal in real time and store it as a pressure signal data set.
[0019] Step 102: Selecting Haar wavelet, Daubechies wavelet, and Symlet wavelet as discrete wavelet transform basis functions, and performing discrete wavelet transform on the pressure signal dataset using the three wavelets. The discrete wavelet transform scale of each wavelet is three-level, so as to obtain a decomposition coefficient sequence of the discrete wavelet transform of the corresponding wavelet type. Specifically, pipeline pressure signals, influenced by numerous factors such as geology, environment, pipe material, and leak size, can contain characteristics of varying frequencies, amplitudes, and shapes. A single wavelet kernel is unable to fully capture these characteristics. To address this, this paper, after in-depth analysis of pipeline pressure signal characteristics and wavelet kernel function properties, selects Haar, Daubechies, and Symlet wavelets as the basis functions for discrete wavelet transforms. Multi-kernel wavelets are then used to coordinate pipeline leak detection.
[0020] Specifically, an in-depth analysis of the characteristics of pipeline pressure signals revealed that water pipeline leaks often manifest as sudden, transient changes in pressure or flow. Especially in the early stages of a small leak, the signal exhibits sharp edges due to the sudden drop in pressure within the pipeline. However, traditional Fourier transforms struggle to capture these localized transient changes, and conventional wavelet kernels are prone to masking these sudden changes in the presence of high-frequency noise.
[0021] The Haar wavelet has a simple, compactly supported orthogonal basis function (support length 1). Its rectangular wave characteristics make it extremely sensitive to sudden changes in the signal (such as a sudden pressure drop), enabling precise localization of the leak signal's onset. In the case of a small leak, the signal amplitude is weak and easily overwhelmed by noise. The Haar wavelet, with its sharp time-domain response, can improve leak location accuracy.
[0022] Secondly, pipeline leakage signals usually contain complex background noise (such as pump vibration and water turbulence noise). These noises are mostly concentrated in the high-frequency band and overlap with the transient high-frequency characteristic frequency band of the leakage signal, making it difficult for traditional noise reduction methods to distinguish effective leakage information.
[0023] The Daubechies (db4) wavelet, with its fourth-order vanishing moment, can more smoothly approximate the low-frequency trends of the signal. Its regularity effectively suppresses the pseudo-Gibbs effect of high-frequency noise, preventing distortion after noise reduction. To address the problem of overlapping frequency bands between high-frequency noise and leakage signals, the Daubechies wavelet, through its band-splitting properties and high-order vanishing moments, avoids loss of signal detail and improves the detection rate of small leakage signals.
[0024] Third, water pipeline leakage signals may exhibit certain symmetric or quasi-periodic characteristics (such as decaying oscillations in the pressure waveform) due to factors such as fluid dynamics, periodic pump station startup and shutdown, or pipeline structural resonance. However, the asymmetry of conventional wavelet kernels (such as the DB series) can lead to phase shifts, affecting the integrity of the leakage signature.
[0025] The Symlet wavelet (sym5) is an improved version of the Daubechies wavelet, achieving greater symmetry through optimized filter coefficients. Targeted at detecting symmetrical components in leakage signals, the sym5 wavelet, through its symmetric design, addresses the phase distortion caused by asymmetric wavelet kernels. This enables the model to more accurately capture the oscillatory characteristics of leakage signals and improves detection robustness under complex operating conditions.
[0026] In summary, the multi-wavelet synergy proposed in this application achieves multi-dimensional analysis of tiny leakage signals by using Haar wavelets to precisely locate leakage mutations, db4 wavelets to suppress high-frequency noise, and sym5 wavelets to preserve symmetry. The synergistic effect of these three kernels not only addresses the limitations of a single wavelet kernel (such as Haar's sensitivity to noise and db4's phase shift), but also addresses the complex characteristics of leakage signals (mutations, noise, and periodicity) through the complementary nature of multiple kernels. Ultimately, this creates a highly accurate and robust leakage detection model.
[0027] Furthermore, the pressure signal dataset was subjected to discrete wavelet transform using Haar wavelets, Daubechies wavelets, and Symlet wavelets, respectively. The transform scale for each wavelet was set to three levels (i.e., each wavelet underwent a three-level decomposition). Three-level decomposition involves gradually decomposing the pressure signal into subband signals of different frequency bandwidths, thereby obtaining more detailed signal characteristics. Through the three-level decomposition, a decomposition coefficient sequence corresponding to each wavelet type is obtained. The decomposition coefficient sequence includes approximate coefficients and detail coefficients. The approximate coefficients reflect the low-frequency components and overall trends of the pressure signal, while the detail coefficients capture the high-frequency components and local variations of the pressure signal. The decomposition coefficient sequence corresponding to each wavelet type can comprehensively reflect the characteristics of the pressure signal at multiple levels.
[0028] The discrete wavelet transform process is as follows Figure 2 As shown. The encoded signal is transformed by Haar wavelet, Daubechies wavelet and Symlet wavelet respectively to obtain the decomposition coefficient sequence corresponding to each wavelet type. Discrete wavelet transform (DWT) is a signal processing technology that can analyze the local characteristics of the signal at multiple scales and is widely used in signal compression, denoising, feature extraction and other fields. Assume that the time series is x [ n ], the low-pass filter coefficient of the wavelet basis function is h [ m], the high-pass filter coefficient is g [ m ]. Then, the discrete wavelet transform is expressed as follows: First level decomposition: First-order approximation coefficients (low-frequency components): .
[0029] First level detail coefficient (high frequency component): .
[0030] in, cA 1[ k ] is the first approximate coefficient after the first-order decomposition; cD 1[ k ] is the first-level detail coefficient after first-level decomposition; h [ m ] is the low-pass filter coefficient; g [ m ] is the high-pass filter coefficient; x [ n ] is the original time series; K is the new time index, and due to the effect of downsampling, its value range is half of the original signal length; M The index of the filter, used to traverse the filter coefficients.
[0031] For multi-level decomposition, the approximate coefficients are decomposed recursively. For example, the second-level decomposition: Approximate coefficients for the second quarter: .
[0032] Second level detail coefficient: .
[0033] And so on to get the j-th level decomposition cA j [ k ]and cD j [ k ].
[0034] in, cA j [ k ] is the first j The approximate coefficient after level decomposition reflects the low-frequency components of the pressure signal at this scale. k is the new time index, and due to the downsampling effect, its value range is half of the original signal length. cD j [ k ] is the first jThe detail coefficient after level decomposition reflects the high-frequency components of the pressure signal at that scale. Similarly, due to the effect of downsampling, its value range is half of the original signal length.
[0035] It should be noted that the input signal is transformed by Haar wavelet, Daubechies wavelet and Symlet wavelet respectively. Each wavelet transform performs three-level decomposition. Taking the three-level decomposition of Haar wavelet as an example, the specific implementation steps are as follows: First-level decomposition: input is Z[n], output is the first-level approximate coefficient cA 11 and detail coefficient cD 11 , the first level detail coefficient cD 11 Recorded as D11; Second level decomposition: recursive decomposition cA 11 , output cA 21 and cD 21 , the second level detail coefficient cD 21 Recorded as D21; Third level decomposition: recursive decomposition cA 21 , output cA 31 and cD 31 , the third level detail coefficient cD 31 Recorded as D31, the third-level approximation coefficient cA 31 Denoted as A31.
[0036] Similarly, we can obtain the first-level detail coefficient D12, second-level detail coefficient D22, third-level detail coefficient D32 and third-level approximation coefficient A32 corresponding to the Daubechies wavelet; and the first-level detail coefficient D13, second-level detail coefficient D23, third-level detail coefficient D33 and third-level approximation coefficient A33 corresponding to the Symlet wavelet.
[0037] By using Haar wavelets to precisely locate leakage mutations, Daubechies wavelets to suppress high-frequency noise, and Symlet wavelets to preserve symmetry, we achieve multi-dimensional analysis of tiny leakage signals. The synergistic effect of these three kernels addresses the limitations of a single wavelet kernel (such as Haar's sensitivity to noise and Daubechies's phase shift), while also addressing the complex characteristics of leakage signals (mutations, noise, and periodicity) through the complementary nature of multiple kernels.
[0038] As the DWT (discrete wavelet transform) is decomposed level by level, the frequency characteristics, time resolution and signal characteristics of the detail coefficients also change.
[0039] Frequency characteristics: As the decomposition level increases, the frequency range corresponding to the detail coefficient gradually decreases, gradually covering the different frequency components of the signal from high frequency to low frequency.
[0040] Temporal resolution: The lower the level of detail coefficient, the higher the temporal resolution, which can more accurately locate transient changes in the signal; the higher the level of detail coefficient, the lower the temporal resolution, but can reflect the macroscopic change trend of the signal.
[0041] Signal characteristics: Detail coefficients at different levels reflect characteristics of different scales in the signal. Low-level detail coefficients mainly capture rapid changes and high-frequency characteristics in the signal, while high-level detail coefficients capture slow changes and low-frequency characteristics in the signal. The goal of this application is to detect tiny leaks. From the aforementioned signal characteristic analysis section, it can be seen that low-level detail coefficients can fully reflect this leakage characteristic. After trying to set the decomposition level to 1, 2, 3, 4, and 5, the present invention checked the final detection effect and found that after the decomposition level exceeded 3, the detection accuracy almost no longer had an upward trend. Therefore, the present invention set the decomposition level to 3, that is, to perform 3-level decomposition, and finally obtained 1 approximate coefficient sequence and 3 detail coefficient sequences, that is, Figure 2 A3 (approximation coefficient) and D1, D2, D3 (detail coefficients).
[0042] In addition, the detail coefficients of each wavelet transform have different characteristics. In order to comprehensively coordinate the wavelet transforms and achieve better recognition effects, this application adjusts some of the coefficients respectively. The specific adjustment steps are described later.
[0043] Step 103: Input the decomposition coefficient sequences of the three discrete wavelet transforms into the self-attention mechanism model respectively to obtain the probabilities of the three pipeline leaks, perform statistics on the three output pipeline leakage probabilities, and obtain a conclusion on whether the pipeline is leaking based on the statistical results.
[0044] Specifically, three different wavelet transforms are used to detect pipeline leaks. Each wavelet transform decomposes the complex pressure signal into a sequence of detail coefficients at different frequencies and an approximate coefficient sequence. Furthermore, the coefficient sequences for each wavelet transform are fed into a self-attention mechanism model. The self-attention mechanism analyzes the relationships between each element in the sequence data and other elements, identifying which components are most likely to indicate a leak.
[0045] The self-attention model calculates a probability value based on the input decomposition coefficient sequence. This probability value indicates the likelihood of a pipeline leak. A statistical analysis is performed on the probability values obtained from the three wavelet transforms, comprehensively considering the probability of leaks in different frequency bands. If the majority of the probability values indicate a leak, it can be considered that the pipeline is likely leaking. For example, the probability values obtained from the three wavelet transforms can be averaged, or a weighted average can be selected.
[0046] The modeling process of the self-attention mechanism model is as follows Figure 3As shown in the figure. After multi-core wavelet collaborative multi-scale decomposition, namely the three-level decomposition of Haar wavelets, Daubechies wavelets, and Symlet wavelets, the first-level detail coefficients, second-level detail coefficients, third-level detail coefficients, and third-level approximation coefficients corresponding to each wavelet are obtained. Each coefficient is then convolved and input into four convolutional modules: Conv1, Conv2, Conv3, and Conv4 for further adjustment. The dynamically adjusted output signal is then input into the self-attention mechanism model. Utilizing the self-attention mechanism, the model captures long-range correlations in leakage signals (such as the propagation characteristics of pressure fluctuations caused by leakage) from a global perspective, achieving long-term dependency modeling.
[0047] The convolutions in the embodiments of this application are designed to be learnable convolutions, which can be automatically adjusted according to the characteristics of different signals during the model training process. For example, taking the Haar wavelet transform as an example, the detail coefficients (D11-D31) after the wavelet transform are convolved with a kernel of 1×2, and the approximation coefficient A31 is convolved with a kernel of 1×1. The implementation steps are as follows: For the detail coefficients (D11-D31), a 1×2 convolution kernel with a stride of 1 and 32 output channels is set and randomly initialized. For the approximation coefficient (A31), a 1×1 convolution kernel with a stride of 1 and 32 output channels is set and randomly initialized. The ReLU activation function is chosen. Similarly, Daubechies wavelet and Symlet wavelet basis functions can also be calculated using the above method. By designing the convolution kernel for the detail coefficients to be 1×2, the impact of noise on the key features contained in the detail information for leakage detection can be reduced. Furthermore, since the approximation coefficients reflect the stationary portion of the signal, configuring the convolution kernel for the approximation coefficients to be 1×1 reduces the number of parameters required for subsequent self-attention model learning, improving computational efficiency. This approach allows the model parameters to be dynamically adjusted based on the signal characteristics, achieving dynamic feature optimization, adaptively distinguishing between noise and valid leakage features, and avoiding signal distortion caused by fixed thresholds or traditional filtering.
[0048] Furthermore, the three wavelet-transformed signals after convolution are fed into a self-attention mechanism model for temporal modeling. This captures the long-range correlations of leakage signals (such as the propagation characteristics of pressure fluctuations caused by leakage) from a global perspective, breaking through the short-term memory limitations of traditional RNN models due to vanishing gradients and enabling the modeling of long-term temporal dependencies. The output of the self-attention mechanism model is the detection result, given as a probability. The implementation steps are as follows: For the three wavelet transforms, three self-attention mechanism models are set up respectively (such as Figure 3), the number of heads in the multi-head self-attention of the self-attention mechanism model is set to 8, and the hidden layer dimension is set to 512. The probabilities output by the three self-attention mechanism models are averaged to obtain the final detection result, that is, the probability of pipeline leakage.
[0049] As described above, the collaborative design of learnable convolution operations and Transformers overcomes the accuracy bottlenecks of traditional methods for small leak detection, which are caused by noise interference and insufficient modeling of temporal dependencies. Furthermore, this application utilizes three independent Transformers (with a self-attention mechanism). This allows the overall algorithm to fully leverage the Transformer's excellent adaptability, flexibility, robustness, and ability to process long sequences for temporal signals. Furthermore, each Transformer model can be optimized for data decomposed using a specific wavelet kernel function, potentially improving the learning of specific features and further enhancing the robustness and accuracy of classification. The three classification probabilities output by the model are averaged to obtain the final detection result.
[0050] In one embodiment, Figure 4 As shown in FIG, before performing discrete wavelet transform on the pressure signal data set, the pressure signal data set is preprocessed as follows: Step 401: normalizing the pressure signal dataset and segmenting the processed pressure signal dataset into time-series segments; Specifically, the mean and standard deviation of all pressure time series signals in the pressure signal dataset are calculated. The mean represents the average level of the pressure signal data, while the standard deviation reflects the degree of dispersion of the pressure signal data. Furthermore, for each segment of the pressure time series signal in the pressure dataset, the mean of the entire dataset is subtracted from each value, aligning the pressure signal data around zero mean. The resulting difference is then divided by the standard deviation of the pressure signal dataset to obtain the standardized pressure time series signal.
[0051] For example, assume that the water supply pipe pressure time series signal x[n] has a sampling frequency of 200 Hz and a length N=12000 (1 minute of data).
[0052] Data normalization: x'[n]=(x[n]-μ) / σ.
[0053] Where μ is the mean and σ is the standard deviation.
[0054] After normalization, the pressure signal dataset is segmented into time-series segments, converting it into an input format suitable for a multilayer perceptron. Segmentation can be performed using a sliding window approach. For example, a window length of 512 data points can be set, with a step size of 256 data points. Starting from the beginning of the pressure signal dataset, a data segment of 512 data points is captured as a time-series segment. The window is then moved according to the set step size of 256, capturing subsequent segments in sequence until the entire dataset has been processed, generating 46 time-series segments.
[0055] Step 402: The time-series segments are input into a multi-layer perceptron for encoding adjustment. The encoded signals are spliced along the time dimension to obtain a global feature matrix. The principal component analysis is used to reduce the dimension of the global feature matrix to complete preprocessing, so that the preprocessed pressure signal data set is compatible with discrete wavelet transform processing.
[0056] Specifically, the time-series segments are fed into a multilayer perceptron (MLP) for encoding and adjustment. As a feedforward neural network, the MLP learns complex patterns and features in the data through nonlinear transformations in its hidden layers. The encoded signal, the output of the MLP processing, is concatenated along the time dimension to form a global feature matrix that integrates the feature information of all the time-series segments.
[0057] To further reduce the dimensionality of the pressure signal data and remove redundant information, principal component analysis (PCA) can be used to reduce the dimensionality of the global feature matrix. PCA projects the raw data into a low-dimensional space by identifying the main directions of variation in the data, namely the principal components, while retaining as much important information as possible. Furthermore, the pressure signal dataset can be converted into a dataset that retains key features while reducing dimensionality, making it compatible with discrete wavelet transform processing. The discrete wavelet transform can decompose the signal at multiple scales and extract features at different frequency and time scales. The preprocessed pressure signal dataset can provide a clearer and more focused input for the wavelet transform, helping to improve the accuracy and reliability of subsequent pipeline leak detection.
[0058] For example, the MLP encoder network structure is set, and the network parameters are as follows: Input layer: 512 neurons (corresponding to window length); Hidden layer 1: 256 neurons, activation function ReLU; Hidden layer 2: 128 neurons, activation function ReLU; Dropout: The inter-layer dropout rate is 0.2 to prevent overfitting; Output layer: 64 neurons, linear activation, output encoding is Z∈R 46×64 ; Splice along the time dimension to generate the global feature matrix Z global ∈R 2944 , the dimension is compressed to 256 through PCA to adapt to the subsequent wavelet decomposition.
[0059] In one embodiment, a first-level detail coefficient sequence obtained by performing discrete wavelet transform using Haar wavelet as a basis function is defined as a Haar wavelet first-level detail coefficient sequence. The detection method further includes adjusting the Haar wavelet first-level detail coefficient sequence. The adjusting step includes: When the conclusion obtained based on the statistical results is that the pipeline is not leaking, the pressure signal data set is subjected to wavelet transform and the standard deviation is calculated. The first dynamic threshold is obtained based on the standard deviation. The part of the Haar wavelet first-level detail coefficient sequence that is greater than the first dynamic threshold is retained, and the rest is set to zero to obtain the adjusted Haar wavelet first-level detail coefficient sequence.
[0060] Specifically, if the statistical conclusion is that the pipeline is leaking, the Haar wavelet can be used to decompose the pressure signal dataset to calculate a sequence of first-level detail coefficients. Furthermore, the standard deviation of this pressure signal dataset is calculated. The standard deviation reflects the degree of dispersion in the pressure data and is an important factor in determining the dynamic threshold. The dynamic threshold can be determined based on the calculated standard deviation and is typically set to a multiple of the standard deviation, for example, three times the standard deviation. This setting effectively filters out most noise signals while retaining signal components that may contain leak characteristics.
[0061] The calculated dynamic threshold is applied to the first-level detail coefficient sequence of the Haar wavelet, and the part of the first-level detail coefficient sequence that is greater than the dynamic threshold is retained, while the other parts are set to zero.
[0062] For example, the following adjustments are made to the Haar wavelet first-level detail coefficient sequence D1 obtained by using the Haar wavelet transform: Set the first dynamic threshold θ=3σ n , σ n is the standard deviation of the no-leakage signal.
[0063] When the pipeline is operating normally without leakage, the pressure signal is collected for 10 minutes and Haar wavelet transform is performed to obtain the first-level detail coefficient sequence of Haar wavelet, and the standard deviation of the first-level detail coefficient sequence of Haar wavelet is calculated.
[0064] Calculate the standard deviation: .
[0065] Where N is the number of pressure signal samples when the pipeline is operating normally without leakage; x i is the first-level detail coefficient of the i-th Haar wavelet; μ is the mean of the first-level detail coefficient sequence of the Haar wavelet during leakage-free operation.
[0066] The part of the first-level detail coefficient sequence of the Haar wavelet that is greater than the first dynamic threshold is retained, and the rest is set to zero. The calculation formula is as follows: .
[0067] In this embodiment, the dynamic threshold θ=3σ n .
[0068] In one embodiment, a second-level detail coefficient sequence obtained by performing discrete wavelet transform using Daubechies wavelet as a basis function is defined as a Daubechies wavelet second-level detail coefficient sequence. The detection method further includes adjusting the Daubechies wavelet second-level detail coefficient sequence. The adjusting step includes: Standardize the coefficients in the second-level detail coefficient sequence of the Daubechies wavelet, traverse each coefficient in the standardized Daubechies wavelet second-level detail coefficient sequence, and if the absolute value of the coefficient is greater than the adaptive threshold, adjust the coefficient to the deviation between the coefficient and the adaptive threshold. The sign of the coefficient after adjustment is the same as that before adjustment. If the absolute value of the coefficient is less than or equal to the adaptive threshold, set the coefficient to zero. The adaptive threshold is obtained by multiplying the maximum absolute value of the coefficients in the normalized Daubechies wavelet second-level detail coefficient sequence by a preset ratio.
[0069] Specifically, each coefficient in the Daubechies wavelet second-level detail coefficient sequence is normalized. This is achieved by calculating the difference between each coefficient and the sequence mean and dividing it by the sequence standard deviation, thereby converting the coefficient to a standardized form with zero mean and unit variance. This eliminates the effect of dimensioning and makes the data more comparable.
[0070] Each coefficient in the normalized Daubechies wavelet second-level detail coefficient sequence is traversed to determine the relationship between its absolute value and the adaptive threshold. The adaptive threshold is determined by taking the maximum absolute value in the normalized coefficient sequence and multiplying it by a preset ratio. The preset ratio can be a parameter determined empirically or experimentally to control the strictness of the threshold.
[0071] For example, for the second-level detail coefficient D22 in the second-level detail coefficient sequence after Daubechies decomposition, considering that D2 contains mid-frequency band information, a soft threshold denoising adjustment is performed on it, thereby retaining signal continuity while denoising, and the steps are as follows: The coefficients D22={d1,d2,...,d N}, the length is N; D22 is standardized and the calculation formula is as follows: .
[0072] Wherein, μ is the mean of the coefficients in the second-level detail coefficient sequence, and σ is the standard deviation of the coefficients in the second-level detail coefficient sequence.
[0073] Set an adaptive threshold based on the pressure data signal strength: λ=0.1·max|D22|.
[0074] For each coefficient d in D22 k Do the following: If the absolute value of the coefficient is greater than the adaptive threshold, the coefficient is adjusted to the deviation between the coefficient and the adaptive threshold, and the sign of the adjusted coefficient is the same as that before the adjustment.
[0075] That is, if |d k ∣>λ, calculate the value after contraction: d k ′=sign(d k )⋅(∣d k ∣−λ).
[0076] If the absolute value of the coefficient is less than or equal to the adaptive threshold, the coefficient is set to zero: d k ′=0.
[0077] Where sign is the sign function, defined as: .
[0078] In one embodiment, a third-level detail coefficient sequence obtained by performing discrete wavelet transform using the Symlet wavelet as a basis function is defined as a Symlet wavelet third-level detail coefficient sequence. The detection method further includes adjusting the Symlet wavelet third-level detail coefficient sequence. The adjusting step includes: Perform fast Fourier transform on the third-level detail coefficient sequence of Symlet wavelet to obtain complex spectrum, and calculate power spectral density based on the complex spectrum; The power spectrum density is smoothed using a moving average filter, and candidate peaks are selected from the smoothed power spectrum density. The candidate peaks are configured to satisfy the following conditions: in the power spectrum density, if the power spectrum density of any target frequency point is greater than the power spectrum density of the frequency points adjacent to it on both sides, then the target frequency point is selected as a candidate peak. Select the frequency point with the largest amplitude from the candidate peaks as the main frequency peak, calculate the half-height width of the main frequency peak, and combine the frequency point, amplitude and half-height width of the main frequency peak to obtain the combined characteristics of the power spectrum; The third-level detail coefficient sequence of the Symlet wavelet is concatenated with the combined features to obtain the adjusted third-level detail coefficient sequence of the Symlet wavelet.
[0079] Specifically, a fast Fourier transform (FFT) is performed on the third-level detail coefficient sequence of the Symlet wavelet to convert the time-domain signal into the frequency-domain signal, obtaining a complex spectrum. Based on the complex spectrum, the power spectral density is calculated, which represents the power distribution of the signal at different frequencies.
[0080] Furthermore, a moving average filter is used to smooth the power spectrum density to reduce noise fluctuations and make the power spectrum density curve smoother. Candidate peaks are then selected from the smoothed power spectrum density. In the power spectrum density, if the amplitude of any target frequency point is greater than the amplitude of the adjacent frequency points on both sides, the target frequency point is selected as a candidate peak. The frequency point with the largest amplitude is selected from all candidate peaks as the main frequency peak. The half-height width of the main frequency peak is calculated, that is, the distance between the two frequency points on both sides of the main frequency peak whose power spectrum density is equal to half of the main peak amplitude is found. The frequency point, amplitude and half-height width of the main frequency peak are combined into a feature vector, which is called the combined feature of the power spectrum.
[0081] The Symlet wavelet third-level detail coefficient sequence is concatenated with the above-mentioned combined features, that is, the combined features are attached to the original detail coefficient sequence to form a new sequence, namely, the adjusted Symlet wavelet third-level detail coefficient sequence.
[0082] For example, for data after Symlet wavelet transform, the third-level detail coefficient D33 of the Symlet wavelet is adjusted to highlight the mid- and low-frequency characteristics of the signal (i.e., trend changes and periodic characteristics), and the steps are as follows: Perform fast Fourier transform (FFT) on D33 to obtain the complex spectrum S(f); calculate its power spectrum density P(f) using the following formula: .
[0083] Among them, Fs is the sampling frequency and N is the number of samples.
[0084] A moving average filter (the window length is set to 5 in the embodiment of the present application) is used to smooth the power spectrum density and reduce noise fluctuations. The calculation formula is as follows: .
[0085] Traverse all frequency points f, if they satisfy: P smooth (f)>P smooth (f−1) and P smooth (f)>P smooth (f+1).
[0086] Then mark f as a candidate peak.
[0087] Set the dynamic threshold θ=μ+2σ, where μ is the mean of the power spectrum density and σ is the standard deviation of the power spectrum density Furthermore, retain the smooth (f)>θ candidate peak, select the peak with the largest amplitude as the main frequency f peak , record its amplitude P peak =P(f peak ).
[0088] Find P(f)=0.5P on both sides of the main frequency peak peak The frequency point f left and f right , then the calculation formula for the half-maximum width FWHM is: FWHM=f right −f left .
[0089] The combined feature of the power spectrum is Feature=[f peak ,P peak ,FWHM], D33 and the combined feature are concatenated to get the final result [D33,Feature].
[0090] According to the above description, in the embodiment of the present application, some detail coefficients obtained by the three wavelet transforms are adjusted accordingly, so as to further highlight the advantages and characteristics of each wavelet transform while achieving the goal of comprehensive coordination and characteristic complementarity of multi-core wavelets.
[0091] To further illustrate the detection method provided in the embodiments of the present application, more than 3,000 pipeline signals with leakage lasting 1-2 minutes were used as negative samples, and more than 6,000 normal pipeline signals without leakage lasting 1-2 minutes were used as positive samples. These signals were used to train the model, and the model was evaluated using three indicators: precision P, recall R, and F1 value. Precision P is the ratio of true positive samples predicted as positive to all predicted positive samples, recall R is the ratio of true positive samples predicted as positive to the actual positive samples, and F1 value comprehensively considers the two evaluation indicators of precision and recall, and its range is [0, 1]. The calculation formulas for each evaluation indicator are as follows: ; ; ; Where TP is the true positive sample and the predicted positive sample; FP is the true negative sample and the predicted positive sample; FN is the true positive sample and the predicted negative sample; TN refers to the true negative sample and the predicted negative sample.
[0092] The comparison of the effect of the method provided by this application and the classic support vector machine (SVM) is shown in the following table. The table shows that the accuracy of the present invention in identifying leakage signals reaches 97%, which has achieved the design purpose well.
[0093]
[0094] In summary, the leakage detection method provided by the embodiments of this application has at least the following advantages: It proposes a multi-core wavelet synergy mechanism, which addresses the limitations of a single wavelet kernel and, through multi-core complementarity, covers complex characteristics of leakage signals, such as mutations, noise, and periodicity. Furthermore, it designs a dynamic feature optimization mechanism and deeply integrates it with the Transformer's time series modeling capabilities. This not only addresses the difficulty in extracting features from tiny leakage signals due to their weak amplitude and noise, but also compensates for the shortcomings of traditional methods in modeling leakage propagation effects through global time series analysis.
[0095] Based on the same concept, Figure 5 As shown, the present application also provides a pipeline leakage detection device, characterized in that the pipeline leakage detection device includes: The pressure detection unit 501 is configured to collect pipeline pressure time series signals and obtain a pipeline pressure signal data set; The processing unit 502 is configured to apply the above pipeline leakage detection method to perform pipeline leakage detection based on the pressure signal data set, and output a conclusion on whether the pipeline is leaking.
[0096] Specifically, the pressure detection unit 501 can collect time-series pressure signals within the pipeline and integrate them into a pressure signal dataset, providing basic data for subsequent analysis. The processing unit 502 can be responsible for analyzing the dataset using the aforementioned pipeline leak detection method, including steps such as multi-wavelet transform, convolution processing, and a self-attention mechanism model, and ultimately outputting a conclusion on whether the pipeline is leaking.
[0097] The pipeline leakage detection device can realize the organic combination of data collection and intelligent analysis, and can detect pipeline leakage efficiently and accurately, and is particularly suitable for the detection scenario of small leaks.
[0098] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0099] The above embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for detecting pipeline leakage, characterized in that: The detection method comprises the following steps: Obtain the pipeline pressure signal data set; Selecting Haar wavelet, Daubechies wavelet and Symlet wavelet as basis functions of discrete wavelet transform, performing discrete wavelet transform on the pressure signal data set respectively by using the three wavelets, with the discrete wavelet transform scale of each wavelet being three levels, to obtain a decomposition coefficient sequence of the discrete wavelet transform of the corresponding wavelet type; The decomposition coefficient sequences of the three discrete wavelet transforms are respectively input into the self-attention mechanism model to obtain three pipeline leakage probabilities. Statistics are performed based on the three pipeline leakage probabilities, and a conclusion on whether the pipeline is leaking is obtained based on the statistical results.
2. The pipeline leakage detection method according to claim 1, characterized in that: The decomposition coefficient sequence of the discrete wavelet transform corresponding to the wavelet type includes: first, second and third level detail coefficient sequences, and third level approximation coefficient sequence; A first-level detail coefficient sequence obtained by performing discrete wavelet transform using Haar wavelet as a basis function is defined as a Haar wavelet first-level detail coefficient sequence. The detection method further includes adjusting the Haar wavelet first-level detail coefficient sequence. The adjusting step includes: When the conclusion obtained based on the statistical results that the pipeline is not leaking is that the pipeline is not leaking, Haar wavelet transform is performed on the pressure signal data set to obtain the Haar wavelet first-level detail coefficient sequence, and the standard deviation of the Haar wavelet first-level detail coefficient sequence is calculated to obtain a first dynamic threshold value. The part of the Haar wavelet first-level detail coefficient sequence that is greater than the first dynamic threshold value is retained, and the remaining part is set to zero to obtain an adjusted Haar wavelet first-level detail coefficient sequence.
3. The pipeline leakage detection method according to claim 1, characterized in that: The decomposition coefficient sequence of the discrete wavelet transform corresponding to the wavelet type includes: first, second and third level detail coefficient sequences, and third level approximation coefficient sequence; A second-level detail coefficient sequence obtained by performing discrete wavelet transform using Daubechies wavelet as a basis function is defined as a Daubechies wavelet second-level detail coefficient sequence. The detection method further includes adjusting the Daubechies wavelet second-level detail coefficient sequence. The adjusting step includes: Normalizing the coefficients in the Daubechies wavelet second-level detail coefficient sequence, traversing each coefficient in the normalized Daubechies wavelet second-level detail coefficient sequence, and adjusting the coefficient to the deviation between the coefficient and the adaptive threshold if the absolute value of the coefficient is greater than an adaptive threshold, with the sign of the adjusted coefficient being the same as that before the adjustment; and setting the coefficient to zero if the absolute value of the coefficient is less than or equal to the adaptive threshold; The adaptive threshold is obtained by multiplying the maximum absolute value of the coefficients in the normalized Daubechies wavelet second-level detail coefficient sequence by a preset ratio.
4. The pipeline leakage detection method according to claim 1, characterized in that: The decomposition coefficient sequence of the discrete wavelet transform corresponding to the wavelet type includes: first, second and third level detail coefficient sequences, and third level approximation coefficient sequence; A third-level detail coefficient sequence obtained by performing discrete wavelet transform using the Symlet wavelet as a basis function is defined as a Symlet wavelet third-level detail coefficient sequence. The detection method further includes adjusting the Symlet wavelet third-level detail coefficient sequence. The adjusting step includes: Performing a fast Fourier transform on the third-level detail coefficient sequence of the Symlet wavelet to obtain a complex spectrum, and calculating a power spectral density based on the complex spectrum; Smoothing the power spectrum density using a moving average filter, and selecting candidate peaks from the smoothed power spectrum density, wherein the candidate peaks are configured to satisfy: if the power spectrum density of any target frequency point in the power spectrum density is greater than the power spectrum densities of the frequency points adjacent to both sides, then the target frequency point is selected as the candidate peak; Selecting the frequency point with the largest amplitude from the candidate peaks as the main frequency peak, calculating the half-height width of the main frequency peak, and combining the frequency point, amplitude, and half-height width of the main frequency peak to obtain a combined feature of the power spectrum; The Symlet wavelet third-level detail coefficient sequence is concatenated with the combined feature to obtain an adjusted Symlet wavelet third-level detail coefficient sequence.
5. The pipeline leakage detection method according to any one of claims 1 to 4, characterized in that: The detection method further comprises: Before performing discrete wavelet transform on the pressure signal data set, the pressure signal data set is preprocessed as follows: performing standardization processing on the pressure signal dataset, and segmenting the processed pressure signal dataset into time-series segments; The time-series segments are input into a multilayer perceptron for encoding adjustment. The encoded signals are spliced along the time dimension to obtain a global feature matrix. Principal component analysis is used to perform data dimensionality reduction on the global feature matrix to complete preprocessing, so that the preprocessed pressure signal data set is compatible with discrete wavelet transform processing.
6. The pipeline leakage detection method according to claim 5, characterized in that: The normalization process of the pressure signal data set includes: Calculate the mean and standard deviation of the pressure signal data set, subtract the mean of the pressure signal data set from the pressure time series signal in the pressure signal data set, and divide the difference result by the standard deviation of the pressure signal data set to obtain a standardized pressure time series signal; summarize the standardized pressure time series signals to obtain a standardized pressure signal data set.
7. The pipeline leakage detection method according to claim 1, characterized in that: The decomposition coefficient sequence of the discrete wavelet transform corresponding to the wavelet type includes: first, second and third level detail coefficient sequences, and a third level approximation coefficient sequence, and the detection method further includes: The decomposition coefficient sequence of each discrete wavelet transform is first convolved and then input into the self-attention mechanism model to obtain the probability of pipeline leakage.
8. The pipeline leakage detection method according to claim 7, characterized in that: When performing convolution processing on the first, second and third level detail coefficient sequences respectively, the convolution kernel is configured as 1*2.
9. The pipeline leakage detection method according to claim 7, characterized in that: When performing convolution processing on the third-level approximation coefficient sequence respectively, the convolution kernel is configured as 1*1.
10. A pipeline leakage detection device, characterized in that: The pipeline leakage detection device comprises: The pressure detection unit is configured to collect a pipeline pressure time series signal and obtain a pipeline pressure signal data set; The processing unit is configured to apply the pipeline leakage detection method according to any one of claims 1 to 9 to perform pipeline leakage detection based on the pressure signal data set, and output a conclusion on whether the pipeline is leaking.
Citation Information
Patent Citations
Self-adaptive valid signal type positioning method for determining leakage of fluid pipeline
CN108506742A
Leakage sound signal denoising method and system based on improved wavelet threshold function
CN118013199A
Method and system for identifying working condition sound signals of water supply pipeline
CN118959911A
Water supply network single-node flow prediction method based on wavelet real-time decomposition and iTransform model
CN120234615A
Method and system of leak detecting for oil and gas pipeline based on excitation response
US20220397477A1