Pipeline tiny leakage detection method based on dynamic differential spectrum and metric learning
By enhancing the signal-to-noise ratio in the detection of minor leaks in pipelines within the high-frequency band and utilizing differential spectrum and metric learning methods, the problem of low signal-to-noise ratio was solved, achieving efficient detection and accurate identification of minor leaks.
Patent Information
- Application Number
- CN202511402313.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2026-01-23
AI Technical Summary
Existing technologies suffer from extremely low signal-to-noise ratios in pipeline micro-leak detection, leading to decreased detection performance, difficulty in effectively extracting and enhancing micro-leak characteristics, and a high risk of missed or false alarms.
An initial time-frequency representation is generated by acquiring the acoustic signal of the pipeline, the dominant frequency in the high-frequency band is determined, a dynamic gain function is constructed to generate an enhanced time-frequency representation, the dynamic difference spectrum is calculated, and feature vectors are extracted using a deep neural network, combined with the k-nearest neighbor algorithm for discrimination.
It significantly improves the accuracy and robustness of micro-leakage detection, enhances the saliency of weak features, improves the model's discriminative ability, and solves the problem of low signal-to-noise ratio.
Smart Images

Figure CN121383113A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of target detection, and particularly relates to a pipeline micro-leakage detection method based on dynamic differential spectrum and metric learning. BACKGROUND
[0002] As a key infrastructure for transporting fluid media such as oil, natural gas and water, the safe and stable operation of the pipeline is of great importance. However, due to factors such as corrosion, material aging and third-party damage, pipeline leakage is inevitable. Among them, micro-leakage is difficult to be discovered in time because of its small leakage amount and weak signal characteristics, but its long-term existence can cause resource waste, environmental pollution, and even major safety accidents. Therefore, it is of great engineering significance and economic value to realize early and accurate detection of pipeline micro-leakage.
[0003] At present, the detection method based on acoustic signal is one of the important technical means for pipeline leakage monitoring. When the pipeline leaks, the fluid ejected from the pipe wall or the surrounding medium will produce acoustic signals of specific frequency through friction. By arranging sensors along the pipeline to collect these signals and analyze them, the occurrence of leakage can be determined. However, in the actual industrial environment, the background noise intensity of the pipeline system itself (such as noise generated by pumps and valves), environmental noise (such as wind noise, vehicle noise, construction noise) is much higher than the acoustic signal generated by micro-leakage, resulting in extremely low signal-to-noise ratio (SNR) of micro-leakage signal, and the effective features are overwhelmed by strong noise, which brings great challenges to detection.
[0004] In the prior art, for example, Chinese patent publication CN.117633588.A proposes a pipeline leakage positioning method based on frequency spectrum weighting and large kernel residual convolutional neural network. The method includes extracting the main frequency in the vibration signal and performing frequency spectrum weighting processing centered on the main frequency to enhance the signal. However, this technical solution has inherent limitations when dealing with micro-leakage problems. The technical key point is to search for the main frequency in the full frequency band of the signal. For micro-leakage, the acoustic signal generated is weak in energy and has extremely low signal-to-noise ratio, and its characteristic frequency is completely overwhelmed by strong background noise such as fluid noise generated by normal operation of the pipeline, pump and valve noise. Therefore, the main frequency searched in the full frequency band is most likely the main frequency of the background noise, rather than the true leakage characteristic frequency. Based on a false main frequency determined by noise, frequency spectrum weighting cannot enhance the target leakage signal, but will further amplify the noise and suppress the already weak leakage characteristics, resulting in decreased detection performance and false negatives or false positives.
[0005] Therefore, how to design a detection method that can effectively extract and enhance the micro-leakage characteristics overwhelmed by strong noise and make reliable discrimination according to the characteristics of micro-leakage is a technical problem to be solved in the current pipeline safety monitoring field. SUMMARY
[0006] To overcome the deficiencies of the prior art, the present application provides a pipeline micro-leakage detection method based on dynamic difference spectrum and metric learning, which first acquires the acoustic signal of the pipeline and generates an initial time-frequency representation; then determines a dominant frequency in the initial time-frequency representation within a predetermined high-frequency band, and based on the dominant frequency, constructs a dynamic gain function to generate an enhanced time-frequency representation, and then calculates the difference between the enhanced time-frequency representation and the initial time-frequency representation to obtain a dynamic difference spectrum; next, the dynamic difference spectrum is input into a deep neural network model to extract a high-dimensional feature vector; finally, based on the metric distance between the feature vector and the pre-stored samples in a reference feature database, a k-nearest neighbor algorithm is used to determine whether there is leakage. The present application highlights weak features by enhancing in a specific frequency band and using difference spectrum, and combines metric learning for reliable discrimination, significantly improving the detection accuracy and robustness of pipeline micro-leakage.
[0007] The technical solution adopted by the present application to solve its technical problems is as follows:
[0008] Step 1: signal processing;
[0009] Acquire the acoustic signal of the pipeline and generate an initial time-frequency representation of the acoustic signal;
[0010] Step 2: feature enhancement;
[0011] Based on the initial time-frequency representation, generate a dynamic difference spectrum;
[0012] Step 3: feature vector generation;
[0013] Input the dynamic difference spectrum into a deep neural network model and extract a feature vector from the deep neural network model;
[0014] Step 4: leakage discrimination;
[0015] Based on the metric distance between the feature vector and the pre-stored normal sample feature vector and / or leakage sample feature vector in the reference feature database, determine whether the acoustic signal indicates leakage.
[0016] Preferably, the step 2 specifically comprises:
[0017] Step 2-1: within a predetermined frequency band, determine a dominant frequency in the initial time-frequency representation;
[0018] Step 2-2: based on the dominant frequency, construct a dynamic gain function, which has a local maximum at the dominant frequency;
[0019] Step 2-3: apply the dynamic gain function to the initial time-frequency representation to obtain an enhanced time-frequency representation;
[0020] Step 2-4: Calculate the difference between the enhanced time-frequency representation and the initial time-frequency representation to obtain a dynamic difference spectrum.
[0021] Preferably, the initial time-frequency representation is a log-mel power spectrum.
[0022] Preferably, in step 2-4, the calculation of the difference is performed on a logarithmic scale.
[0023] Preferably, the interval of the preset frequency band is 5 kHz to 20 kHz.
[0024] Preferably, the dynamic gain function is centered on the dominant frequency, and the gain value is distributed in a triangular shape or a bell shape.
[0025] Preferably, the deep neural network model is a recurrent neural network.
[0026] Preferably, the recurrent neural network is a long short-term memory network.
[0027] Preferably, in step 4, a k-nearest neighbor algorithm is used for leakage discrimination.
[0028] Preferably, the deep neural network model is optimized and trained by a focal loss function.
[0029] A pipeline micro-leakage detection system, comprising:
[0030] A signal acquisition module for acquiring acoustic signals of the pipeline;
[0031] A memory for storing instructions and a reference feature database;
[0032] A processor coupled to the memory and configured to execute the instructions to implement a pipeline micro-leakage detection method.
[0033] Preferably, the processor is configured to execute the instructions to perform the following operations:
[0034] a) Construct a dynamic gain function based on the dominant frequency determined in the preset frequency band, and calculate a dynamic difference spectrum;
[0035] b) Input the dynamic difference spectrum into a long short-term memory network model to extract a feature vector.
[0036] Preferably, the processor is configured to calculate the metric distance between the feature vector of the to-be-tested sample and the pre-stored sample feature vector in the reference feature database by a k-nearest neighbor algorithm, to determine whether there is a leakage.
[0037] The beneficial effects of the present application are as follows:
[0038] 1. Improve the pertinence and effectiveness of feature enhancement: The present application searches for the main frequency in the preset high-frequency band that meets the physical characteristics of the micro leakage, effectively avoiding the interference of low-frequency strong background noise, and ensuring that the enhancement operation is directed at potential leakage signals rather than noise. The problem of suppressing real leakage characteristics due to identifying the main frequency in the full frequency band in the prior art is solved.
[0039] 2. Enhance the saliency of weak features: The present application constructs a dynamic difference spectrum, i.e. performs a dynamic enhancement on the initial time-frequency representation and then performs a difference operation, which can effectively suppress the steady-state or slowly varying background components in the time-frequency diagram, thereby highlighting and sharpening the weak and dynamic features caused by leakage, generating a feature spectrum with higher signal-to-noise ratio, which is beneficial to the subsequent model recognition.
[0040] 3. Improve the robustness and accuracy of model discrimination: The present application uses a deep network to extract a high-dimensional feature vector and combines k-nearest neighbor metric learning method for discrimination. This scheme learns a measurable feature space to distinguish normal and leakage samples, is more sensitive to subtle differences in features, and has better adaptability to data imbalance scenarios, thereby improving the discrimination accuracy of micro leakage.
[0041] 4. Optimize the model training process: By using a focused loss function for model training, the model can pay more attention to the small number of micro leakage samples that are difficult to classify during the training process, solving the model bias problem caused by the large number of normal operating samples compared to leakage samples, and further improving the detection ability of micro leakage. BRIEF DESCRIPTION OF DRAWINGS
[0042] Fig. 1 The flowchart of the method of the present application.
[0043] Fig. 2 The leakage signal spectrum graph of the embodiment of the present application.
[0044] Fig. 3 The frequency spectrum graph of the dynamic difference spectrum of the leakage signal of the embodiment of the present application.
[0045] Fig. 4 The network architecture diagram of the embodiment of the present application based on metric learning. DETAILED DESCRIPTION
[0046] The present application will be further described below in conjunction with the drawings and embodiments.
[0047] The main purpose of the present application is to provide a pipeline micro leakage detection method and system based on dynamic difference spectrum and metric learning, aiming to solve the problem of inaccurate detection of micro leakage signals and even suppression of effective features caused by identifying the main frequency in the full frequency band in the prior art, thereby improving the sensitivity and reliability of micro leakage detection.
[0048] A pipeline micro-leakage detection method based on dynamic differential spectrum and metric learning, comprising the following steps:
[0049] a. Signal processing: acquiring the acoustic signal of the pipeline and generating an initial time-frequency representation of the acoustic signal;
[0050] b. Feature enhancement: based on the initial time-frequency representation, a dynamic differential spectrum is generated, specifically including:
[0051] i. Within a preset frequency band, a main frequency in the initial time-frequency representation is determined;
[0052] ii. Based on a main frequency, a dynamic gain function is constructed, and the dynamic gain function has a local maximum at the main frequency;
[0053] iii. Apply the dynamic gain function to the initial time-frequency representation to obtain an enhanced time-frequency representation;
[0054] iv. Calculate the difference between the enhanced time-frequency representation and the initial time-frequency representation to obtain the dynamic differential spectrum;
[0055] c. Feature vector generation: input the dynamic differential spectrum into a deep neural network model, and extract a feature vector from the deep neural network model;
[0056] d. Leak discrimination: based on the metric distance between the feature vector and the pre-stored normal sample feature vector and / or leakage sample feature vector in a reference feature database, determine whether the acoustic signal indicates a leak.
[0057] The initial time-frequency representation is a log-mel power spectrum, and the difference calculation in step b-iv is performed on a logarithmic scale.
[0058] The preset frequency band interval is 5kHz to 20kHz. The dynamic gain function is centered on the main frequency, and the gain value is in triangular distribution or bell-shaped distribution.
[0059] The deep neural network model is a recurrent neural network.
[0060] The recurrent neural network is a long short-term memory network (LSTM).
[0061] The leakage discrimination step d uses a k-nearest neighbor algorithm.
[0062] The method further comprises a model training step, wherein the deep neural network model is optimized and trained by a focal loss function (Focal Loss).
[0063] A pipeline micro-leakage detection system, comprising:
[0064] a) a signal acquisition module for acquiring acoustic signals of the pipeline;
[0065] b) a memory for storing instructions and a reference feature database;
[0066] c) a processor coupled with the memory and configured to execute the instructions to implement the method of any of the preceding.
[0067] The processor is configured to execute the instructions to implement the following operations:
[0068] a) constructing a dynamic gain function based on the dominant frequency determined within a preset frequency band, and calculating a dynamic differential spectrum;
[0069] b) inputting the dynamic differential spectrum into a long short-term memory (LSTM) model to extract a feature vector.
[0070] The processor is configured to calculate the metric distance between the feature vector of the to-be-tested sample and the pre-stored sample feature vector in the reference feature database by a k-neighbor (k-NN) algorithm, to determine whether there is a leak.
[0071] Embodiments:
[0072] The embodiments of the present application disclose a method for detecting a slight leak of a pipeline and a system for implementing the method.
[0073] The slight leak detection system of the pipeline according to the embodiments of the present application can be a special server, an industrial control computer or an embedded computing device. The system logically comprises:
[0074] a) a signal acquisition module: responsible for acquiring acoustic signals of the pipeline. The module can be composed of a data acquisition card deployed along the pipeline valve, for converting physical sound waves into a digital signal stream. In the embodiments, the input of the module is an acoustic signal pre-acquired and stored in a standard digital audio format (such as WAV).
[0075] b) a memory: a non-volatile storage medium for solidifying computer program instructions executable by the processor, which instruction set completely implements the logic of the method of the present application. The memory is also used as a reference feature database, in which a large number of sample feature vectors extracted by the method of the present application and accurately labeled as "normal working condition" or "leak working condition" are pre-stored.
[0076] c) a processor: as the central processing unit of the system, in communication with the memory. The processor is configured to load and execute the instructions to implement the detection method.
[0077] With reference Figs. 1 to 4 , the specific implementation process of the method of the present application is described in detail.
[0078] Step a: signal processing
[0079] The processor first processes the acquired pipe acoustic time-domain signal x(t) to generate an initial time-frequency representation.
[0080] The initial time-frequency representation is preferably a log-mel power spectrum, denoted as S log-mel (f,t). The mel scale is chosen because it is more consistent with human auditory perception, which can provide a non-linear representation of the frequency of acoustic signals, thus better highlighting the acoustic features related to leakage. Its generation process includes:
[0081] Preprocessing: the signal is processed at a sampling rate of 48 kHz.
[0082] Time-frequency transform: a short-time Fourier transform is applied to the signal using an analysis window of 2048 points and a frame shift of 512 points to obtain a linear scale complex spectrum.
[0083] Power spectrum calculation and mel filtering: the modulus square of the complex spectrum is calculated to obtain a linear power spectrum, which is then passed through a mel filter bank containing 128 triangular filters to obtain a mel power spectrum S mel (f,t).
[0084] Log compression: to compress the dynamic range and simulate the logarithmic response of the auditory system, the mel power spectrum is logarithmically transformed, and the calculation formula is:
[0085] S log-mel (f,t) = C·log(S mel (f,t) + ε)
[0086] Where C is a scaling constant, and ε is a very small value to prevent the logarithmic operation parameter from being zero.
[0087] Dimension normalization: to ensure the consistency of the dimensions of subsequent model inputs, the length of the spectrum on the time axis is unified to a fixed number of frames by truncation or padding.
[0088] Step b: feature enhancement
[0089] Based on S log-mel (f,t), the processor generates a dynamic differential spectrum D(f,t) through a series of sub-steps.
[0090] i. Determine the dominant frequency: the processor searches for the dominant frequency f d in a pre-set high-frequency band highly related to the physical characteristics of the micro-leakage. This band may be set to 5 kHz to 20 kHz. By calculating the average energy of each mel frequency component in this band over all time frames, and determining the frequency component with the maximum average energy as the dominant frequency f d .
[0091] ii. Constructing a dynamic gain function: based on the dominant frequency f d A dynamic gain function G(f) is constructed. This function is centered at f d , with a triangular or bell-shaped distribution of gain. In this embodiment, a triangular distribution is adopted, with a pre-set maximum gain G d at f max , a pre-set minimum gain G min at the boundaries of the pre-set frequency band, and a linear transition in between. Outside the pre-set frequency band, the gain is 1 (i.e. no gain).
[0092] iii. Applying the gain function: the processor applies the gain function G(f) in linear scale to the Mel power spectrum S mel (f, t) to obtain the enhanced Mel power spectrum S' mel (f, t):
[0093] S' mel (f, t) = G(f) · S mel (f, t) iv. Computing the dynamic difference spectrum: the processor performs a difference operation in log scale to highlight the gain effect and suppress the common background components. The dynamic difference spectrum D(f, t) is computed as follows:
[0094] D(f, t) = C · log(S' mel (f, t) + ε) - C · log(S mel (f, t) + ε)
[0095] Step c: feature vector generation;
[0096] Referring to FIG. 4, which illustrates the network architecture based on metric learning adopted by the present application, the processor inputs the dynamic difference spectrum D(f, t) into a deep neural network model to extract a low-dimensional, high-information-content feature vector.
[0097] In this embodiment, the deep neural network model is preferably a recurrent neural network capable of processing sequential data, specifically a long short-term memory network (LSTM). The LSTM model f NN (·) is pre-trained. The processor inputs D(f, t) into the model and extracts the output from the embedding layer before the classification layer, obtaining a fixed-dimensional feature vector v e R d , where d is a pre-set embedding dimension:
[0098] v = f NN (D(f, t))
[0099] The feature vector v is a compact representation of the original acoustic signal after enhancement and deep nonlinear transformation.
[0100] Step d: Leakage detection;
[0101] This step corresponds to the k-NN classifier in Figure 4. According to step d of claim 1 and claim 6, the processor adopts a metric learning-based discrimination method, specifically the k-nearest neighbor (k-NN) algorithm, to achieve leakage discrimination.
[0102] Distance metric: Calculates the feature vector v of the sample to be tested and the feature vector v of each pre-stored sample in the reference feature database. i The Euclidean distance d(v,v) between them i ):
[0103]
[0104] Neighborhood determination: In the reference feature database, based on the calculated distance, find the k feature vectors that are closest to v.
[0105] Classification decision: The category of the sample to be tested is determined by majority voting on the known labels of the k nearest neighbor samples. If the number of "leak" labels is dominant in the voting, then the pipeline is ultimately determined to have a leak.
[0106] Model training:
[0107] To enable the deep neural network model in step c to generate highly discriminative feature vectors, it needs to be optimized and trained. This step should be completed offline before system deployment.
[0108] Dataset construction: Prepare a large number of labeled collected normal pipeline signals (2000 normal signals) and a small number of small leakage signals (20 leakage signals), and process them into dynamic differential spectra through the above steps a and b to form a training dataset.
[0109] Loss Function: To address the class imbalance problem caused by the fact that there are far more normal samples than leaked samples in actual working conditions, the FocalLoss loss function is used as the objective function for optimization. Its definition is:
[0110] FL(p t )=-α t (1-p t ) γ log(p t )
[0111] Where, p t This is the model's predicted probability of the true class. The focusing parameter γ>0 is used to reduce the weight of easily classified samples. α t This is a category balance factor.
[0112] Model optimization: Gradient-based optimization algorithm is adopted to minimize the focusing loss function, and the internal parameters of the neural network model are iteratively updated through back propagation. After the training converges, all training samples are extracted through the model to construct the final reference feature database.
[0113] In this embodiment, the evaluation index is set as:
[0114]
[0115] Where TP, TN, FP, FN are the abbreviations of true positive, true negative, false positive and false negative, respectively.
[0116] Experimental results: After training the data using the proposed LSTM network based on dynamic difference spectrum and metric learning, the model performance is tested on the test set, and ResNet and GRU networks are used for comparison, and dynamic difference spectrum and not using dynamic difference spectrum, and k-NN metric learning and Sigmoid binary classification model are used for comparison. The model performance comparison is shown in Table 1.
[0117] Table 1 Model performance comparison
[0118]
[0119] From the data in Table 1, it can be observed that the method of dynamic difference spectrum and metric learning used in the present application is superior to the general log mel spectrum feature and the traditional classification model, and has a very high recognition rate for pipeline valve leakage detection.
Claims
1. A method for detecting a pipeline micro-leakage based on dynamic differential spectrum and metric learning, characterized in that, The method comprises the following steps: Step 1: signal processing; acquiring an acoustic signal of a pipeline and generating an initial time-frequency representation of the acoustic signal; Step 2: feature enhancement; generating a dynamic differential spectrum based on the initial time-frequency representation; Step 3: feature vector generation; inputting the dynamic differential spectrum into a deep neural network model to extract a feature vector from the deep neural network model; Step 4: leakage discrimination; determining whether the acoustic signal indicates a leakage based on a metric distance between the feature vector and a pre-stored normal sample feature vector and / or a pre-stored leakage sample feature vector in a reference feature database.
2. The method of claim 1, wherein, The step 2 specifically comprises: Step 2-1: determining a main frequency in the initial time-frequency representation within a preset frequency band; Step 2-2: constructing a dynamic gain function based on the main frequency, the dynamic gain function having a local maximum at the main frequency; Step 2-3: applying the dynamic gain function to the initial time-frequency representation to obtain an enhanced time-frequency representation; Step 2-4: calculating a difference between the enhanced time-frequency representation and the initial time-frequency representation to obtain the dynamic differential spectrum.
3. The method of claim 2, wherein, The initial time-frequency representation is a log-mel power spectrum; the interval of the preset frequency band is 5 kHz to 20 kHz; and the dynamic gain function is centered on the main frequency and has a triangular distribution or a bell-shaped distribution of gain values.
4. The method of claim 2, wherein, In the step 2-4, the calculation of the difference is performed on a logarithmic scale.
5. The method of claim 2, wherein, The deep neural network model is a recurrent neural network.
6. The method of claim 2, wherein, The recurrent neural network is a long short-term memory network.
7. The method of claim 2, wherein, The k-neighbor algorithm is used for the leakage discrimination in the step 4.
8. The method of claim 2, wherein, The deep neural network model is trained by optimizing a focus loss function.
9. A detection system for detecting a minute leak in a pipeline using the method of claim 1, wherein The method comprises: a signal acquisition module for acquiring an acoustic signal of a pipeline; a memory for storing instructions and a reference feature database; a processor coupled to the memory and configured to execute the instructions to implement a pipeline micro-leakage detection method.
10. The detection system of claim 9, wherein, The processor is configured to execute the instructions to perform the following operations: a) constructing a dynamic gain function based on a main frequency determined within a preset frequency band and calculating a dynamic differential spectrum; b) inputting the dynamic differential spectrum into a long short-term memory network model to extract a feature vector; The processor is configured to calculate a metric distance between the feature vector of a to-be-tested sample and a pre-stored sample feature vector in a reference feature database by using a k-neighbor algorithm to determine whether there is a leakage.