A method for identifying key frequencies of pipeline leakage acoustic signals based on MGrad-CAM

CN119084846BActive Publication Date: 2026-10-16DALIAN UNIV OF TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411433157.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2026-10-16
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

[0006]针对现有技术存在的问题,本发明提供了一种基于MGrad-CAM(多通道梯度加权类激活映射,Multi-Channel Gradient-Weighted Class Activation Mapping)的管道泄漏声信号关键频率识别方法,以至少解决由于相关技术中依靠传统信号处理方法难以准确识别高度复杂非线性泄漏信号的关键频率,造成的管道泄漏检测精度低的技术问题

Benefits of technology

[0040] This invention proposes a key frequency identification method for pipeline leakage acoustic signals based on MGrad-CAM. This method can identify key frequencies of pipeline leakage acoustic signals without relying on traditional digital signal processing techniques and expert prior knowledge. Specifically, this invention employs parallel multi-channel convolutional blocks, allowing the leakage detection model to focus more on extracting local features. In each independent channel, the model can adaptively adjust learnable parameters; this fine-tuning enables the model to more accurately distinguish valuable frequency features in different frequency bands. Furthermore, by aggregating the output characteristic maps of multiple channels, this model enhances the resolution of MGrad-CAM, thereby solving the technical problem of low pipeline leakage detection accuracy caused by the difficulty in accurately identifying key frequencies of highly complex nonlinear leakage signals using traditional signal processing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119084846B_ABST
    Figure CN119084846B_ABST
Patent Text Reader

Abstract

The application discloses a kind of pipe leakage sound signal key frequency identification method based on MGrad-CAM, belong to pipe leakage detection field.First, the target pipe time-domain acoustic signal under water supply pipe leakage and normal state is collected, and the pipe time-domain acoustic signal dataset is established, and the time-domain signal is preprocessed to obtain the input data of pipe leakage detection model.Secondly, the different frequency band amplitude distribution of time-domain acoustic signal data is input into pipe leakage detection model and trained, and the trained leakage detection model is obtained.Third, MGrad-CAM method is called to leakage detection model, and the frequency importance sequence for pipe leakage key frequency identification is generated.Finally, the frequency spectrum signal and the frequency importance sequence are plotted in the same coordinate system, and the maximum value in the frequency importance sequence corresponds to the key frequency of the pipe leakage sound signal.The application can realize the identification of pipe leakage sound signal key frequency without relying on traditional digital signal processing technology and expert prior knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of pipeline leakage detection and relates to a method for identifying key frequencies of pipeline leakage acoustic signals based on MGrad-CAM. Background Technology

[0002] With the acceleration of urbanization, the scale and complexity of water supply systems are constantly increasing, and pipeline leakage problems are becoming increasingly prominent, posing a significant threat to the effective utilization of water resources and water supply security. Traditional pipeline leakage detection methods, such as manual inspection and pressure testing, have drawbacks such as low efficiency, high cost, and poor real-time performance, making them difficult to meet the needs of modern water supply systems. Therefore, pipeline leakage detection methods based on acoustic signals have been widely used in water supply companies due to their advantages of non-invasiveness, strong real-time performance, and relatively low cost.

[0003] When a pipeline leaks, the high-speed water jet from the leak point collides and rubs violently against the pipe wall, generating broadband sound waves. These sound waves caused by the leak exhibit amplitude distribution characteristics that are drastically different from those under normal conditions (i.e., ambient noise) within a specific frequency band. These specific frequency bands are defined as the "critical frequencies" of the leak sound signal, serving as direct and crucial indicators for identifying pipeline leaks. Accurately identifying and understanding the critical frequencies of pipeline leak sound signals not only assists technicians in quickly and accurately identifying pipeline leaks but also provides a theoretical basis for signal preprocessing in subsequent pipeline leak location methods. Furthermore, it guides the development of leak detection equipment, prompting the development of monitoring devices more sensitive to critical leak frequencies, enabling earlier and more accurate detection of pipeline leaks in practical applications.

[0004] In related technologies, the identification of key frequencies of leakage sound signals largely relies on traditional digital signal processing techniques, such as empirical mode decomposition and wavelet packet analysis. However, these methods cannot accurately identify the key frequencies of pipeline leaks when processing highly complex and nonlinear leakage signals, and often require operators to have considerable prior knowledge of signal characteristics, thus raising the technical threshold. Furthermore, in the actual operating environment of water supply pipelines, environmental noise interference is unavoidable, leading to a decrease in the signal-to-noise ratio and increased signal spectrum complexity, further increasing the difficulty of accurately identifying the key frequencies of leakage signals.

[0005] There is currently no effective solution to the above problems. Summary of the Invention

[0006] To address the problems existing in the prior art, this invention provides a method for identifying key frequencies of pipeline leakage acoustic signals based on MGrad-CAM (Multi-Channel Gradient-Weighted Class Activation Mapping), in order to at least solve the technical problem of low pipeline leakage detection accuracy caused by the difficulty in accurately identifying key frequencies of highly complex nonlinear leakage signals by relying on traditional signal processing methods in related technologies.

[0007] To achieve the objectives of this invention, the technical solution adopted is as follows:

[0008] A method for identifying key frequencies of pipe leakage acoustic signals based on MGrad-CAM, the method comprising the following steps:

[0009] Step S1: Collect time-domain acoustic signals of the target pipeline under both leaking and normal conditions, establish a pipeline time-domain acoustic signal dataset, and perform preprocessing operations on the time-domain signals to obtain input data for the pipeline leak detection model; specifically as follows:

[0010] Step S101: Collect the time-domain acoustic signal of the target pipeline when the water supply pipeline leaks, and use it as the leakage class data (data label is 1) in the pipeline time-domain acoustic signal dataset. Collect the time-domain acoustic signal of the repaired target pipeline, and use it as the normal class data (data label is 0) in the pipeline time-domain acoustic signal dataset.

[0011] Step S102: Filter all data in the pipeline time-domain acoustic signal dataset;

[0012] Step S103: Perform a fast Fourier transform on the filtered pipe time-domain acoustic signal to convert the time-domain signal into a spectral signal;

[0013] Step S104: Standardize the spectrum signal;

[0014] Step S105: Perform a slicing operation on the standardized spectrum signal, dividing the individual spectrum signal into K fixed frequency bands with the same frequency bandwidth to obtain the amplitude distribution, which serves as the input data for the pipeline leakage detection model.

[0015] Step S2: Input the amplitude distributions of different frequency bands of the time-domain acoustic signal data for leakage and normal categories obtained after preprocessing into the pipeline leakage detection model and train it to obtain the trained leakage detection model; the details are as follows:

[0016] The pipeline leak detection model uses a parallel multi-channel one-dimensional convolutional neural network model as its basic framework. By performing the operations described in step 1 on the pipeline's time-domain acoustic signal and inputting it into the model, it can be determined whether the signal is a leak signal; otherwise, it is considered a normal signal. Specifically, this basic framework consists of convolutional blocks built from multiple one-dimensional convolutional neural networks connected in parallel. The number of convolutional blocks is the same as the number K of the frequency band amplitude distributions obtained in step S105. Each convolutional block has the same network structure and corresponds to the amplitude distribution of a fixed frequency band obtained in step S105. Then, the feature maps obtained from the last layer of each convolutional block are aggregated along the channel direction, thus integrating different leak frequency band information at different resolutions. The aggregated feature maps are converted into one-dimensional tensors through global average pooling. Finally, the one-dimensional tensor is used as the input to a fully connected neural network layer. The scores for leak and normal categories are obtained through calculations in multiple hidden layers within the fully connected layer. Finally, the probability of the pipeline leak time-domain signal belonging to either a leak or normal signal is output through a softmax layer.

[0017] Step S3: Call the MGrad-CAM method on the leak detection model trained in step S2 to generate a frequency importance sequence for identifying key frequencies of pipeline leaks.

[0018] Step S4: Plot the spectrum signal obtained in step S103 and the frequency importance sequence obtained in step S3 on the same coordinate system. The frequency corresponding to the maximum value in the frequency importance sequence is the key frequency of the pipe leakage sound signal. Specifically, the horizontal axis of this coordinate system is the frequency of the pipe sound signal, the vertical axis 1 is the amplitude of the spectrum signal, and the vertical axis 2 is the value of the frequency importance sequence.

[0019] As an improvement of this invention, in step S1, time-domain acoustic signals of the target pipeline during and after a water supply pipeline leak are collected to establish a time-domain acoustic signal dataset. The time-domain signals are then preprocessed to obtain input data for the pipeline leak detection model. Specifically, in step 101, before identifying the key frequencies of the leak acoustic signal, this invention needs to obtain a pre-trained leak detection model to classify pipeline leak signals and normal signals. Therefore, two types of data need to be prepared in advance for the model. This invention collects the time-domain acoustic signal of the target pipeline during a water supply pipeline leak, using it as the leak-class data (labeled 1) in the pipeline time-domain acoustic signal dataset, and the time-domain acoustic signal of the target pipeline after repair, using it as the normal-class data (labeled 0) in the pipeline time-domain acoustic signal dataset, thus preparing the pipeline time-domain acoustic signal dataset for training the pipeline leak detection model. The labels of these data are verified through on-site investigation. Water departments discover suspected leak points during routine inspections and collect audio data using noise probes in nearby valve wells. After audio acquisition, maintenance personnel will investigate and confirm suspected leak points. If a leak is confirmed, the acquired audio is marked as leak audio; otherwise, it is marked as normal audio. In step 102, because pipeline acoustic signals are easily affected by ambient noise, all data in the pipeline time-domain acoustic signal dataset needs to be filtered to retain useful information within the leak frequency range (i.e., 100-2048Hz) and improve the signal-to-noise ratio of the pipeline time-domain acoustic signal. In step 103, a Fast Fourier Transform is performed on the filtered pipeline time-domain acoustic signal to convert it into a spectral signal. In step 104, the spectral signal is standardized to eliminate the influence of peak values ​​in the spectrum on the model training results and accelerate the convergence speed of the leak detection model training. In step 105, the standardized spectral signal is sliced, dividing a single spectral signal into K fixed frequency band amplitude distributions, which serve as input data for the pipeline leak detection model.

[0020] As an improvement of this invention, in step S2, the amplitude distributions of different frequency bands of the time-domain acoustic signal data for the leakage and normal classes, obtained through preprocessing, are input into the pipeline leakage detection model for training, resulting in a trained leakage detection model. Since Grad-CAM (Gradient-Weighted Class Activation Mapping) is a method for accurately locating feature regions highly correlated with specific categories in classification tasks, this invention cleverly utilizes the distinct amplitude distribution characteristics of the acoustic signal caused by leakage within a specific frequency band compared to the normal acoustic signal (i.e., ambient noise). In the leakage detection process, this invention introduces MGrad-CAM technology to identify regions where the leakage signal and the normal signal show significant differences in the frequency domain, i.e., key frequencies. This strategy enables this invention to successfully identify key frequencies using only a single leakage signal input to the model without the aid of traditional signal processing techniques.

[0021] Studies have shown that one-dimensional convolutional neural networks (CNNs) outperform two-dimensional CNNs when processing one-dimensional signals. Therefore, this invention uses a one-dimensional CNN as the basic network structure for the leak detection model. Since the sound signal from a pipe leak is a broadband sound wave, traditional one-dimensional CNN structures are likely to be affected by noise signals when processing broadband signal inputs because they focus on each frequency equally, leading to reduced detection accuracy. Therefore, this invention constructs a pipe leak detection model based on a parallel multi-channel one-dimensional CNN model after performing spectral slicing on the leak signal, enabling the model to analyze different frequency components of the signal in greater detail. Specifically, the construction process of the pipeline leakage detection model is as follows: First, convolutional blocks constructed from multiple one-dimensional convolutional neural networks are connected in parallel. The number of convolutional blocks is the same as the number K of frequency band amplitude distributions obtained in step S105. Each convolutional block has the same network structure, and each convolutional block corresponds to the amplitude distribution of a certain fixed frequency band obtained in step S105. Then, the feature maps obtained from the last layer of each convolutional block are aggregated according to the channel direction, thus integrating different leakage frequency band information at different resolutions. The aggregated feature maps are converted into one-dimensional tensors through global average pooling. Finally, the one-dimensional tensor is used as the input of a fully connected neural network. The scores of leakage and normal categories are obtained through calculations by multiple hidden layers inside the fully connected layer. Finally, the probability of the pipeline leakage time-domain signal belonging to leakage signal and normal signal is output through the softmax layer.

[0022] In the process of constructing the pipeline leak detection model, the pipeline time-domain acoustic signal dataset is divided into a training set and a test set in an 8:2 ratio. Cross-entropy loss is set as the loss function to enable the training leak detection model to achieve a higher recognition accuracy. The specific cross-entropy loss function value is shown in formula (1):

[0023]

[0024] Among them, y i This represents the true label of the i-th sample in the dataset, with 0 for normal samples and 1 for leaked samples; M represents the probability that the pipeline leak detection model predicts the i-th sample in the dataset as a leak; M represents the number of samples in the training set.

[0025] An early stopping mechanism is employed during model training. At the end of each iteration, a performance metric (such as loss function or accuracy) on the validation set is calculated, and the current iteration's validation set metric is compared to the previous best performance metric. If the current performance metric has not reached its optimal value, it is recorded, and it is checked whether there has been no improvement for several consecutive iterations. If so, the model is considered overfitted, training is stopped, and the optimal model parameters are returned, thus avoiding wasted time and computational resources. If not, model training continues until the set maximum number of iterations is reached.

[0026] As an improvement of this invention, in step S3, the MGrad-CAM method is called on the leak detection model trained in step S2 to generate a frequency importance sequence for identifying key frequencies of pipeline leaks. Since the resolution of the frequency importance sequence generated by MGrad-CAM decreases as the number of network layers in the convolutional block increases, this weakens the accuracy of identifying key frequencies of the leak sound signal. Therefore, this invention proposes an MGrad-CAM method that slices the input spectral signal, dividing a single spectral signal according to the same frequency bandwidth to obtain the amplitude distribution of K fixed frequency bands, each corresponding to the input data of the K convolutional block channels in the pipeline leak detection model. Each channel is analyzed independently before aggregation, which improves the resolution of the frequency importance sequence generated by the model and achieves accurate identification of key frequencies.

[0027] The specific calculation method of the MGrad-CAM method is as follows:

[0028] Step 3.1) First, the aggregated feature map A and the score y of the leaky category c before the softmax layer can be obtained through the forward propagation of the parallel multi-channel one-dimensional convolutional neural network model. c ;

[0029] Step 3.2) Next, through backpropagation, the leakage category c can be obtained for the feature map of the nth channel of the i-th spectral slice. The gradient is Feature map The importance of leakage category c is denoted as It can be calculated using formula (2):

[0030]

[0031] Where N is the number of channels in the aggregated feature map; i represents the number of the spectral slice.

[0032] After step 3.3), the feature maps obtained from the forward propagation in step 3.1) are weighted and summed, and the ReLU function is used to retain only the features that have a positive impact on the class score. For the leaked class c, the gradient-weighted class activation map Ω of the i-th spectral slice is... i c The calculation is shown in formula (3):

[0033]

[0034] Where, N ′ It is the number of channels in the feature map of the last convolutional layer after the operation of the parallel convolutional block for the i-th spectral slice.

[0035] Step 3.4) Finally, the frequency importance sequence of the leakage sound signal is obtained by gradient-weighted activation mapping of different spectral slices obtained through the above steps. The frequency importance sequences are combined according to frequency band order. To obtain a frequency importance sequence with the same size as the original model input, cubic spline interpolation is used. Finally, the frequency importance sequence corresponding to the pipe leakage acoustic spectrum signal input to the pipe leakage detection model is obtained. The calculation method is shown in formula (4):

[0036]

[0037] Where K is the total number of spectral slices, and f(·) is the cubic spline interpolation function.

[0038] As an improvement of this invention, in step S4, the spectral signal obtained in step S103 and the frequency importance sequence obtained in step S3 are plotted on the same coordinate system. The frequency corresponding to the maximum value in the frequency importance sequence is the critical frequency of the pipeline leakage acoustic signal. Specifically, the horizontal axis of this coordinate system represents the frequency of the pipeline acoustic signal, the vertical axis 1 represents the amplitude of the spectral signal, and the vertical axis 2 represents the value of the frequency importance sequence. This invention validates the model on a large dataset of pipeline leakage acoustic signals. By analyzing the power spectral density of the acoustic signals during and after pipeline leakage, the changes in frequency amplitude distribution caused by pipeline leakage can be clearly identified (regions with large differences in frequency amplitude distribution are the regions where critical frequencies are located). By comparing the frequency importance sequence obtained by calling the leakage detection model using the MGrad-CAM method (regions with high frequency importance are considered the regions where critical frequencies are located), the accuracy of critical frequency identification can be determined. Finally, the frequency corresponding to the maximum value in the frequency importance sequence is taken as the critical frequency of the leakage signal.

[0039] Compared with the prior art, the technical solution of the present invention has the following beneficial technical effects:

[0040] This invention proposes a key frequency identification method for pipeline leakage acoustic signals based on MGrad-CAM. This method can identify key frequencies of pipeline leakage acoustic signals without relying on traditional digital signal processing techniques and expert prior knowledge. Specifically, this invention employs parallel multi-channel convolutional blocks, allowing the leakage detection model to focus more on extracting local features. In each independent channel, the model can adaptively adjust learnable parameters; this fine-tuning enables the model to more accurately distinguish valuable frequency features in different frequency bands. Furthermore, by aggregating the output characteristic maps of multiple channels, this model enhances the resolution of MGrad-CAM, thereby solving the technical problem of low pipeline leakage detection accuracy caused by the difficulty in accurately identifying key frequencies of highly complex nonlinear leakage signals using traditional signal processing methods. Attached Figure Description

[0041] Figure 1 This is a flowchart of a method for identifying key frequencies of acoustic signals from water supply pipeline leaks according to an embodiment of the present invention;

[0042] Figure 2 This is a flowchart of a water supply pipeline leakage acoustic signal preprocessing method according to an embodiment of the present invention;

[0043] Figure 3 This is a structural diagram of the leak detection model and MGrad-CAM method in the key frequency identification method for water supply pipeline leakage acoustic signals according to an embodiment of the present invention;

[0044] Figure 4This is a power spectrum distribution and frequency importance distribution diagram of the sound signal from a water supply pipeline leakage and the normal sound signal, according to an embodiment of the present invention.

[0045] Figure 5 This is a distribution diagram of the spectrum and frequency importance sequence of the sound signal from a water supply pipeline leakage according to an embodiment of the present invention. Detailed Implementation

[0046] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0047] First, to facilitate understanding of the embodiments of the present invention, some terms or nouns involved in the present invention will be explained below:

[0048] The critical frequencies of a leak sound signal refer to frequencies within a specific frequency band of the sound waves generated when a pipeline leaks. Sound waves within these frequency ranges exhibit amplitude distribution characteristics significantly different from those under normal conditions (ambient noise). These frequencies carry crucial information about the occurrence of a leak and can directly reflect the state of the pipeline leak, making them essential for identifying whether a pipeline leak has occurred.

[0049] The frequency importance sequence, generated using the MGrad-CAM method, represents the importance of each frequency in the pipe leak acoustic signal for model leak identification. This sequence typically includes an importance score for each frequency point; a higher score indicates greater importance for leak identification. In this invention, the frequency importance sequence helps us determine which frequencies are critical frequencies in the leak acoustic signal.

[0050] Spectral slicing refers to dividing the spectrum of a pipe leak sound signal into multiple different frequency bands, with each band processed as a separate input. This is done to allow the model to analyze the signal's characteristics at different frequency components in greater detail, thereby better identifying frequency changes that occur when a leak occurs.

[0051] Parallel multi-channel one-dimensional convolutional neural networks (CNNs) are a deep learning model architecture and the basic framework for constructing the leakage detection model of this invention. They consist of multiple parallel one-dimensional CNN modules, each processing information from a specific frequency band within a spectral slice, thus enabling better capture of leakage characteristics across different frequency ranges. This structure helps improve the model's ability to handle the complexity of acoustic signals.

[0052] Multichannel gradient-weighted class activation mapping (MGrad-CAM) is a visualization technique based on deep learning models. In this invention, MGrad-CAM is used to analyze a trained leak detection model and generate a frequency importance sequence. By calculating the gradients of feature maps of different channels in the convolutional neural network with respect to a specific category (such as leak or normal), the importance of each frequency in each spectral slice to the classification result is evaluated. Finally, by aggregating these gradient-weighted feature maps, a high-resolution frequency importance sequence is generated, thereby helping to identify the key frequencies of the acoustic signal.

[0053] like Figure 1 As shown, Figure 1 This is a flowchart of a method for identifying key frequencies of acoustic signals from water supply and transmission pipelines according to an embodiment of the present invention. The method includes the following steps:

[0054] Step S1: Collect time-domain acoustic signals of the target pipeline under both leaking and normal conditions, establish a pipeline time-domain acoustic signal dataset, and perform preprocessing operations on the time-domain signals to obtain input data for the pipeline leak detection model. This invention addresses common problems in pipeline leak acoustic signals, such as... Figure 2 The preprocessing operations shown are as follows:

[0055] In step 101, before identifying the key frequencies of the leak sound signal, this invention requires a pre-trained leak detection model to classify pipeline leak signals and normal signals into two categories. Therefore, two types of data need to be prepared in advance for the model. This invention collects the time-domain sound signal of the target pipeline when a water supply pipeline leaks, using it as the leak class data (labeled as 1) and the repaired target pipeline time-domain sound signal as the normal class data (labeled as 0) in the pipeline time-domain sound signal dataset, thus preparing the pipeline time-domain sound signal dataset for training the pipeline leak detection model. Specifically, in this embodiment, the sampling frequency of the pipeline leak signal is 8192Hz, the time for a single sound signal sampling is 5 seconds, and the length of a single time-domain sound signal is 40960. Data collection is conducted between 2:00 AM and 4:00 AM to reduce environmental noise interference from traffic and water usage activities. The experiment lasted for 7 months, collecting a total of 1433 audio samples, including 518 leak audio samples and 915 normal audio samples. The labels on this data were verified through on-site excavation. During routine inspections, the water department identified suspected leak points and used noise probes to collect audio data from nearby valve wells. After the audio data collection was completed, maintenance personnel would excavate the suspected leak points to confirm them. If a leak was confirmed, the collected audio was labeled as leak audio; otherwise, it was labeled as normal audio.

[0056] In step 102, since the pipe acoustic signal is easily affected by ambient noise, it is necessary to filter all data in the pipe time-domain acoustic signal dataset to retain useful information within the leakage frequency range (i.e., 100-2048Hz) and improve the signal-to-noise ratio of the pipe time-domain acoustic signal. Specifically, since the sampling frequency of the pipe leakage acoustic signal is 8192Hz, and the main frequencies of pipe leakage are mainly distributed below 2kHz, this embodiment uses a Butterworth digital filter to filter the original time-domain acoustic signal, retaining the signal within the frequency range of 100-2048Hz.

[0057] In step 103, a Fast Fourier Transform (FFT) is performed on the filtered pipe time-domain acoustic signal to convert it into a spectral signal. Since the spectral signal of pipe leakage has higher interpretability than the original time-domain signal, this embodiment performs a FFT on the original time-domain signal while preserving the amplitude distribution within the frequency range of 100-2048Hz.

[0058] In step 104, the amplitude distribution within the 100-2048Hz frequency range obtained in step 3 is standardized to eliminate the influence of peak values ​​in the spectrum on the model training results and accelerate the convergence speed of the leakage detection model training. This embodiment calculates the mean and variance of the preprocessed spectral amplitudes and performs standardization on each spectral signal.

[0059] In step 105, the standardized spectrum signal is sliced, dividing the individual spectrum signal into K fixed frequency bands of amplitude distribution, which serve as input data for the pipeline leak detection model. In this embodiment, the processed amplitude distribution within the 100-2048Hz frequency range is sliced ​​into four parts, where K equals 4. Therefore, each amplitude distribution corresponds to a frequency band of 0-512Hz, 512-1024Hz, 1024-1536Hz, and 1536-2048Hz, respectively. These four distributions correspond to the inputs of the four parallel convolutional neural network modules of the subsequent leak detection model.

[0060] Step S2 involves inputting the amplitude distributions of different frequency bands of the time-domain acoustic signal data (obtained after preprocessing for leak and normal categories) into the pipeline leak detection model for training, resulting in a trained leak detection model. For example... Figure 3 As shown, Figure 3 This is a structural diagram of the leak detection model and the MGrad-CAM method in the key frequency identification method for water supply pipeline leakage acoustic signals according to an embodiment of the present invention.

[0061] Since Grad-CAM (Gradient-Weighted Class Activation Mapping) is a method for accurately locating feature regions highly correlated with specific categories in classification tasks, we cleverly utilize the distinct amplitude distribution characteristics of the acoustic signal caused by leakage within a specific frequency band compared to the normal acoustic signal (i.e., ambient noise). In the leak detection process, this invention introduces MGrad-CAM technology to identify regions where the leak signal and the normal signal show significant differences in the frequency domain, i.e., key frequencies. This strategy enables the invention to successfully identify key frequencies using only a single leak signal input to the model without the aid of traditional signal processing techniques. Research has shown that one-dimensional convolutional neural networks outperform two-dimensional convolutional neural networks when processing one-dimensional signals; therefore, this invention uses a one-dimensional convolutional neural network as the basic network structure of the leak detection model. Because the acoustic signal from a pipe leak is a broadband sound wave, the traditional one-dimensional convolutional neural network structure is likely to be interfered with by noise signals when processing broadband signal inputs, as it pays equal attention to each frequency, thus reducing the model's detection accuracy. Therefore, after performing spectral slicing on the leakage signal, this invention constructs a pipeline leakage detection model with a parallel multi-channel one-dimensional convolutional neural network model as its basic framework, enabling the model to analyze different frequency components of the signal in greater detail.

[0062] Specifically, such as Figure 3 As shown, the construction process of the pipeline leakage detection model is as follows: First, the pipeline leakage detection model in this embodiment consists of convolutional blocks built from four one-dimensional convolutional neural networks connected in parallel. The number of convolutional blocks is the same as the number of frequency band amplitude distributions obtained in step S105. Each convolutional block has the same network structure, and each convolutional block corresponds to the amplitude distribution of a certain fixed frequency band obtained in step S105. Then, the feature maps obtained from the last layer of each convolutional block are aggregated according to the channel direction, thus integrating different leakage frequency band information at different resolutions. The aggregated feature maps are converted into one-dimensional tensors through global average pooling. Finally, the one-dimensional tensor is used as the input of the fully connected layer neural network. The scores of leakage and normal categories are obtained through calculations by multiple hidden layers inside the fully connected layer. Finally, the probability of the pipeline leakage time-domain signal belonging to leakage signal and normal signal is output through the softmax layer. The parallel multi-channel one-dimensional convolutional neural network model is trained based on 1433 pipeline leakage time-domain acoustic signal data obtained in the above experiment. As shown in Table 1, Table 1 is an architecture diagram of the water supply pipeline leakage detection model according to this embodiment.

[0063] Table 1. Architecture diagram of the water supply pipeline leakage detection model according to an embodiment of the present invention.

[0064]

[0065] In the process of constructing the pipeline leak detection model, the pipeline time-domain acoustic signal dataset is divided into a training set and a test set in an 8:2 ratio. 20% of the training set is set as the validation set. Cross-entropy loss is set as the loss function to enable the training leak detection model to achieve a higher recognition accuracy. The specific cross-entropy loss function value is shown in formula (1):

[0066]

[0067] Among them, y i This represents the true label of the i-th sample in the dataset, with 0 for normal samples and 1 for leaked samples; M represents the probability that the pipeline leak detection model predicts the i-th sample in the dataset as a leak; M represents the number of samples in the training set.

[0068] Specifically, this embodiment of the invention uses Keras 2.7.0 and TensorFlow 2.7.0 to build the leak detection model, and trains these leak detection models using the Adam method. An early stopping mechanism is employed during model training. At the end of each iteration, the performance metrics (such as loss function or accuracy) on the validation set are calculated, and the current iteration's validation set metrics are compared with the previous best performance metrics. If the current performance metric has not reached its optimal value, it is recorded, and it is checked whether there has been no improvement for several consecutive iterations. If so, the model is considered overfitted, training is stopped, and the optimal model parameters are returned, thus avoiding wasted time and computational resources. If not, model training continues until the maximum set number of iterations is reached. This study primarily focuses on the loss function value on the validation set during model training. If the model performance does not improve for 30 consecutive iterations, model training is stopped, indicating that the model has converged. The maximum number of iterations is set to 1000.

[0069] Step S3 involves applying the MGrad-CAM method to the leak detection model trained in step S2 to generate a frequency importance sequence for identifying key frequencies in pipeline leak detection. Since the resolution of the frequency importance sequence generated by MGrad-CAM decreases as the number of network layers in the convolutional block increases, this weakens the accuracy of key frequency identification of the leak sound signal. Therefore, this invention proposes an MGrad-CAM method that slices the input spectral signal, dividing a single spectral signal according to the same frequency bandwidth to obtain K fixed-frequency band amplitude distributions, corresponding to the input data of the K convolutional block channels in the pipeline leak detection model. Each channel is analyzed independently before aggregation, which improves the resolution of the frequency importance sequence generated by the model and achieves accurate identification of key frequencies. Figure 3 As shown, Figure 3 It is implemented according to the present invention.

[0070]

[0071] Example: Leak detection model and MGrad-CAM method structure diagram in the key frequency identification method for sound signals of water supply pipeline leakage. Specific calculation method is as follows:

[0072] Step 3.1) First, the aggregated feature map A and the score y of the leaky category c before the softmax layer can be obtained through the forward propagation of the parallel multi-channel one-dimensional convolutional neural network model. c ;

[0073] Step 3.2) Next, through backpropagation, the leakage category c can be obtained for the feature map of the nth channel of the i-th spectral slice. The gradient is Feature map The importance of leakage category c is denoted as It can be calculated using formula (2):

[0074]

[0075] Where N is the number of channels in the aggregated feature map; i represents the number of the spectral slice.

[0076] After step 3.3), the feature maps obtained from the forward propagation in step 3.1) are weighted and summed, and the ReLU function is used to retain only the features that have a positive impact on the class score. For the leaked class c, the gradient-weighted class activation map of the i-th spectral slice is... The calculation is shown in formula (3):

[0077]

[0078] Where, N ′ It is the number of channels in the feature map of the last convolutional layer after the operation of the parallel convolutional block for the i-th spectral slice.

[0079] Step 3.4) Finally, the frequency importance sequence of the leakage sound signal is obtained by gradient-weighted activation mapping of different spectral slices obtained through the above steps. The frequency importance sequences are combined according to frequency band order. To obtain a frequency importance sequence with the same size as the original model input, cubic spline interpolation is used. Finally, the frequency importance sequence corresponding to the pipe leakage acoustic spectrum signal input to the pipe leakage detection model is obtained. The calculation method is shown in formula (4):

[0080]

[0081] Where K is the total number of spectral slices, and in this embodiment K = 4; f(·) is the cubic spline interpolation function.

[0082] Step S4: Plot the spectral signal obtained in step S103 and the frequency importance sequence obtained in step S3 on the same coordinate system. The frequency corresponding to the maximum value in the frequency importance sequence is the critical frequency of the pipeline leakage acoustic signal. Specifically, this invention validates the model on a large dataset of pipeline leakage acoustic signals. By analyzing the power spectral density of the acoustic signals during and after pipeline leakage, the changes in frequency amplitude distribution caused by pipeline leakage can be clearly identified (regions with large differences in frequency amplitude distribution are the regions where critical frequencies are located). By comparing the frequency importance sequence obtained by calling the leak detection model using the MGrad-CAM method (regions with high frequency importance are considered the regions where critical frequencies are located), the accuracy of critical frequency identification can be determined. Figure 4 As shown, Figure 4 This figure shows the power spectrum distribution and frequency importance distribution of a leaking acoustic signal and a normal acoustic signal in a water supply pipeline, according to an embodiment of the present invention. The upper curve in the figure represents the power spectral density distribution of the acoustic signal when a leak occurs, while the lower curve represents the power spectral density distribution of the acoustic signal after leak repair (i.e., normal signal). The difference between the two is due to the occurrence of the leak. The frequencies corresponding to the areas of large differences are the key frequencies for leak identification. The white areas corresponding to the lower color band represent the locations of the key frequencies identified by the present invention. It can be seen from the figure that the locations of the key frequencies identified by the present invention correspond to the locations of large differences in the power spectral density curves, indicating that the present invention can accurately identify the key frequencies of the pipeline leaking acoustic signal.

[0083] Furthermore, the acoustic spectrum of the pipeline leakage signal and the frequency importance sequence are plotted on the same coordinate system. The frequency corresponding to the maximum value in the frequency importance sequence is the critical frequency of the pipeline leakage acoustic signal. For example... Figure 5 As shown, Figure 5 This is a spectrum diagram and frequency importance sequence distribution diagram of the sound signal of water supply pipeline leakage according to an embodiment of the present invention. Figure 5 In the mid-coordinate system, the horizontal axis represents the frequency of the pipe acoustic signal, the vertical axis 1 represents the amplitude of the spectral signal, and the vertical axis 2 represents the numerical values ​​of the frequency importance sequence. From Figure 5 As can be seen, this invention generally focuses more on the frequency bands where peaks appear in the spectrum, which is consistent with human intuition. The key frequency of the pipe sound signal caused by this leakage event is 970Hz. Although the peak value is largest at 300Hz in the spectrum of pipe leakage sound signals, the frequency band with the highest frequency importance is close to the peak value at 970Hz. This is mainly because, under normal conditions, the frequency at which environmental noise peaks usually occurs is relatively low, and the appearance of high-frequency signal components is more likely to indicate that a leak has occurred.

[0084] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for identifying key frequencies of pipe leakage acoustic signals based on MGrad-CAM, characterized in that, The method includes the following steps: Step S1: Collect time-domain acoustic signals of the target pipeline under both leaking and normal conditions, establish a pipeline time-domain acoustic signal dataset, and perform preprocessing operations on the time-domain signals to obtain input data for the pipeline leak detection model; wherein, the spectral signal can be obtained during the preprocessing operation. Step S2: Input the amplitude distribution of different frequency bands of the time-domain acoustic signal data of the leakage type and normal type obtained by the preprocessing operation in step S1 into the pipeline leakage detection model and train it to obtain the trained leakage detection model. The pipeline leakage detection model adopts a parallel multi-channel one-dimensional convolutional neural network model as its basic framework. By inputting the pipeline time-domain acoustic signal processed in step 1 into the pipeline leakage detection model, it is determined whether the signal is a leakage signal; otherwise, it is a normal signal. Step S3: Call the MGrad-CAM method on the leak detection model trained in step S2 to generate a frequency importance sequence for identifying key frequencies of pipeline leaks; By slicing the input spectrum signal, a single spectrum signal is divided into K fixed frequency band amplitude distributions according to the same frequency bandwidth. These correspond to the input data of K convolutional block channels in the pipeline leakage detection model. Each channel is analyzed independently and then aggregated to improve the resolution of the frequency importance sequence generated by the model and achieve accurate identification of key frequencies. Step S4: Plot the spectrum signal from step S1 and the frequency importance sequence from step S3 on the same coordinate system. The frequency corresponding to the maximum value in the frequency importance sequence is the key frequency of the pipe leakage sound signal. In step 3, the specific calculation method of the MGrad-CAM method is as follows: Step 3.1) Obtain the aggregated feature map through forward propagation of a parallel multi-channel one-dimensional convolutional neural network model. and leakage categories Score before the softmax layer ; Step 3.2) The leakage category can be obtained through backpropagation. For the The spectral slice of the first Channel feature map The gradient is Feature map For leakage categories The importance is denoted as Calculate according to formula (2): (2) in, It is the number of channels in the aggregated feature map; Indicates the number of the spectrum slice; Step 3.3) Perform a weighted summation on the feature maps obtained from the forward propagation in Step 3.1), and use the ReLU function to retain only the features that have a positive impact on the class score. For leaked classes... , No. Gradient-weighted activation mapping for each spectral slice The calculation is shown in formula (3): (3) in, Is for the first The number of channels in the feature map of the last convolutional layer after each spectral slice has been processed by parallel convolutional blocks; Step 3.4) The frequency importance sequence of the leakage sound signal is obtained by gradient-weighted class activation mapping under different spectral slices through the above steps. The frequency importance sequences are combined according to frequency band order. To obtain a frequency importance sequence with the same size as the original model input, cubic spline interpolation is used. Finally, the frequency importance sequence corresponding to the pipe leakage acoustic spectrum signal input to the pipe leakage detection model is obtained. The calculation method is shown in formula (4): (4) in, The total number of spectral slices. It is a cubic spline interpolation function.

2. The method for identifying key frequencies of pipe leakage acoustic signals based on MGrad-CAM according to claim 1, characterized in that, The specific steps of S1 are as follows: Step S101: Collect the time-domain acoustic signal of the target pipeline when the water supply pipeline leaks, and use it as the leakage class data in the pipeline time-domain acoustic signal dataset. The repaired target pipeline time-domain acoustic signal is used as the normal class data in the pipeline time-domain acoustic signal dataset. The data label of the leakage class data is recorded as 1, and the data label of the normal class data is recorded as 0. Step S102: Filter all data in the pipeline time-domain acoustic signal dataset; Step S103: Perform a fast Fourier transform on the filtered pipe time-domain acoustic signal to convert the time-domain signal into a spectral signal; Step S104: Standardize the spectrum signal; Step S105: Perform a slicing operation on the standardized spectrum signal, dividing the individual spectrum signal into K fixed frequency bands with the same frequency bandwidth to obtain the amplitude distribution, which serves as the input data for the pipeline leakage detection model.

3. The method for identifying key frequencies of pipe leakage acoustic signals based on MGrad-CAM according to claim 1, characterized in that, The pipeline leakage detection model construction process in step 2 is as follows: Convolutional blocks, constructed from multiple one-dimensional convolutional neural networks, are connected in parallel. The number of convolutional blocks is the same as the number K of frequency band amplitude distributions obtained in step S105. Each convolutional block has the same network structure and corresponds to the amplitude distribution of a fixed frequency band obtained in step S105. Then, the feature maps obtained from the last layer of each convolutional block are aggregated along the channel direction to integrate different leakage frequency band information at different resolutions. The aggregated feature maps are converted into one-dimensional tensors through global average pooling. Finally, the one-dimensional tensor is used as the input of a fully connected neural network. The scores for leakage and normal categories are obtained through calculations by multiple hidden layers inside the fully connected layer. After passing through a softmax layer, the probability that the pipeline leakage time-domain signal belongs to the leakage signal or the normal signal is output.

4. The method for identifying key frequencies of pipe leakage acoustic signals based on MGrad-CAM according to claim 3, characterized in that, In the process of building the pipeline leak detection model, the pipeline time-domain acoustic signal dataset is divided into training set and test set according to the proportion, and cross-entropy loss is set as the loss function to enable the training leak detection model to achieve a higher recognition accuracy. An early stopping mechanism is used during model training.

Citation Information

Patent Citations

  • Pipe leak detection method and device

    CN109931506A

  • Convolutional neural network audio recognition method based on one-dimensional attention mechanism

    CN114187923A