Pipeline leakage sound signal key frequency identification method based on MGrad-CAM
Through MGrad-CAM and parallel multi-channel one-dimensional convolutional neural network model, the key frequency of the pipeline leakage acoustic signals is identified, solving the problem of low recognition accuracy in complex environments by traditional methods, and achieving higher leakage detection accuracy.
Patent Information
- Application Number
- CN202411433157.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The prior art has low accuracy and difficulty in identifying the critical frequency of acoustic signals in pipeline leakage. Especially under environmental noise interference, traditional signal processing methods cannot accurately identify it, resulting in low leakage detection accuracy.
Using the MGrad-CAM-based multi-channel gradient weighted class activation mapping method, a frequency importance sequence is generated to identify the key to the pipeline leakage acoustic signal through a parallel multi-channel one-dimensional convolutional neural network model, combined with fast Fourier transform and standardized processing. frequency.
Without relying on traditional signal processing technology, it can accurately identify key frequencies in complex nonlinear signals, improving the accuracy and accuracy of leakage detection and reducing the dependence on expert prior knowledge.
Smart Images

Figure CN119084846A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of pipeline leakage detection and relates to a pipeline leakage sound signal key frequency identification method based on MGrad-CAM. Background Art
[0002] With the acceleration of urbanization, the scale and complexity of water supply systems are increasing, and pipeline leakage problems are becoming increasingly prominent, posing a major threat to the effective use of water resources and water supply safety. Traditional pipeline leakage detection methods, such as manual inspections and pressure tests, have disadvantages such as low efficiency, high cost, and poor real-time performance, which are 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 non-invasive, strong real-time performance, and relatively low cost.
[0003] When a pipeline leaks, the high-speed water jetting from the leak point collides and rubs violently with the pipe wall, which in turn excites broadband sound waves. These sound waves caused by the leak show amplitude distribution characteristics that are completely different from normal times (i.e., environmental noise) within a specific frequency band. These specific frequency bands are defined as the "critical frequencies" of the leakage sound signal, which are direct and important indicators for identifying the leakage status of the pipeline. Accurately identifying and grasping the critical frequencies of pipeline leakage sound signals can not only assist technicians in quickly and accurately identifying pipeline leaks; at the same time, it also provides a theoretical basis for the signal preprocessing of subsequent pipeline leakage locating methods; in addition, it can also provide guidance for the research and development of leak detection equipment, prompting the development of monitoring equipment that is more sensitive to the critical frequencies of leaks, so as to achieve earlier and more accurate pipeline leaks in practical applications.
[0004] In related technologies, the identification of key frequencies of leakage sound signals mostly 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 leakage when processing highly complex and nonlinear leakage signals, and often require operators to have considerable prior knowledge of signal characteristics, which invisibly raises the technical threshold. In addition, in the actual operating environment of water supply pipelines, interference from environmental noise is inevitable, resulting in a decrease in the signal-to-noise ratio and a complication of the signal spectrum, further increasing the difficulty of accurately identifying the key frequencies of leakage signals.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] In view of the problems existing in the prior art, the present invention provides a method for identifying the key frequencies of pipeline leakage acoustic signals based on MGrad-CAM (Multi-Channel Gradient-Weighted Class Activation Mapping), so as to at least solve the technical problem of low pipeline leakage detection accuracy caused by the difficulty in accurately identifying the key frequencies of highly complex nonlinear leakage signals by relying on traditional signal processing methods in the related art.
[0007] To achieve the purpose of the present invention, the technical solution adopted by the present invention is as follows:
[0008] A method for identifying key frequencies of pipeline leakage acoustic signals based on MGrad-CAM, the method comprising the following steps:
[0009] Step S1: Collect the time domain acoustic signals of the target pipeline in the water supply pipeline leakage and normal state, establish a pipeline time domain acoustic signal data set, and perform preprocessing operations on the time domain signals to obtain input data for the pipeline leakage detection model; the details are as follows:
[0010] Step S101: collecting the target pipeline time domain acoustic signal when the water supply pipeline leaks, and using it as the leakage class data in the pipeline time domain acoustic signal data set (the data label is recorded as 1) and the repaired target pipeline time domain acoustic signal, and using it as the normal class data in the pipeline time domain acoustic signal data set (the data label is recorded as 0);
[0011] Step S102: filtering all data in the pipeline time domain acoustic signal data set;
[0012] Step S103: performing fast Fourier transform on the filtered pipeline time domain acoustic signal to convert the time domain signal into a spectrum signal;
[0013] Step S104: performing a standardization operation on the spectrum signal;
[0014] Step S105: Slicing the spectrum signal after the standardization process, dividing the single spectrum signal according to the same frequency bandwidth, and obtaining amplitude distributions of K fixed frequency bands as input data of the pipeline leakage detection model.
[0015] Step S2: Inputting the amplitude distributions of different frequency bands of the time-domain acoustic signal data of the leakage class and the normal class obtained through the preprocessing operation into the pipeline leakage detection model and training them to obtain a trained leakage detection model; the details are as follows:
[0016] The pipeline leakage detection model adopts a parallel multi-channel one-dimensional convolutional neural network model as the basic framework. By performing the operation of step 1 on the pipeline time domain acoustic signal and inputting it into the pipeline leakage detection model, it can be determined whether the signal is a leakage signal, otherwise it is a normal signal. Specifically, the basic framework is connected in parallel by convolution blocks constructed by multiple one-dimensional convolutional neural networks. The number of convolution blocks is the same as the number K of frequency band amplitude distributions obtained in step S105. Each convolution block has the same network structure, and each convolution block corresponds to the amplitude distribution of a fixed frequency band obtained in step S105; then, the feature map obtained by the last layer of each convolution block is aggregated in the channel direction, so that different leakage frequency band information of different resolutions can be integrated, and the aggregated feature map is converted into a one-dimensional tensor through global average pooling; finally, the one-dimensional tensor is used as the input of the fully connected layer neural network, and the scores of the leakage and normal categories are obtained by calculation of multiple hidden layers inside the fully connected layer, and finally the probability of the pipeline leakage time domain signal belonging to the leakage signal and the normal signal is output through the softmax layer.
[0017] Step S3: calling the MGrad-CAM method on the leakage detection model trained in step S2 to generate a frequency importance sequence for identifying key frequencies of pipeline leakage.
[0018] Step S4: Plot the spectrum signal obtained in step S103 and the frequency importance sequence obtained in step S3 in the same coordinate system, and the frequency corresponding to the maximum value in the frequency importance sequence is the key frequency of the pipeline leakage sound signal. Specifically, the abscissa of the coordinate system is the frequency of the pipeline sound signal, the ordinate 1 is the amplitude of the spectrum signal, and the ordinate 2 is the value of the frequency importance sequence.
[0019] As an improvement of the present invention, in the step S1, the time domain acoustic signal of the target pipeline when the water supply pipeline leaks and after repair is collected, a time domain acoustic signal data set is established, and the time domain signal is preprocessed to obtain the input data of the pipeline leakage detection model. Specifically, in the step 101, the present invention needs to obtain a trained leakage detection model in advance before identifying the key frequency of the leakage acoustic signal, and classify the pipeline leakage signal and the normal signal into two categories, so it is necessary to prepare two types of data for the model in advance. The present invention collects the time domain acoustic signal of the target pipeline when the water supply pipeline leaks, and uses it as the leakage class data in the pipeline time domain acoustic signal data set (the data label is recorded as 1) and the time domain acoustic signal of the target pipeline after repair, and uses it as the normal class data in the pipeline time domain acoustic signal data set (the data label is recorded as 0), and prepares the pipeline time domain acoustic signal data set for training the pipeline leakage detection model. The labels of these data are verified by on-site mining. The suspected leakage points are found by the water department during daily inspections, and the noise probe is used in the nearby valve well for audio collection. After the audio collection is completed, the maintenance personnel will dig and confirm the suspected leakage point. If it is confirmed to be a leak, the collected audio is marked as leakage audio; if it is normal, it is marked as normal audio. In step 102, since the pipeline acoustic signal is easily disturbed by the surrounding environmental noise, it is necessary to filter all the data in the pipeline time domain acoustic signal data set to retain the useful information within the leakage frequency range (i.e., 100-2048Hz) and improve the signal-to-noise ratio of the pipeline time domain acoustic signal. In step 103, the pipeline time domain acoustic signal after filtering is subjected to a fast Fourier transform to convert the time domain acoustic signal into a spectrum signal. In step 104, the spectrum signal is standardized to eliminate the influence of the peak in the spectrum on the model training results and accelerate the convergence speed of the leakage detection model training. In step 105, the spectrum signal after standardization is sliced, and the single spectrum signal is sliced according to the same frequency bandwidth to obtain the amplitude distribution of K fixed frequency bands as the input data of the pipeline leakage detection model.
[0020] As an improvement of the present invention, in step S2, the different frequency band amplitude distributions of the time domain acoustic signal data of the leakage class and the normal class obtained through the preprocessing operation are respectively input into the pipeline leakage detection model and trained to obtain a trained leakage detection model. Since Grad-CAM (Gradient-Weighted Class Activation Mapping) is a method for accurately locating feature areas that are highly correlated with specific categories in classification tasks, the present invention cleverly utilizes the amplitude distribution characteristics of the acoustic signal caused by leakage in a specific frequency band that are completely different from the normal acoustic signal (i.e., environmental noise). In the leakage detection process, the present invention introduces MGrad-CAM technology, which aims to identify the area where the leakage signal and the normal signal have significant differences in the frequency domain, i.e., the critical frequency. This strategy enables the present invention to successfully identify the critical frequency by inputting a single leakage signal into the model without the assistance of traditional signal processing technology.
[0021] Studies have shown that when processing one-dimensional signals, one-dimensional convolutional neural networks are superior to two-dimensional convolutional neural networks. Therefore, the present invention uses a one-dimensional convolutional neural network as the basic network structure of the leakage detection model. Since the pipeline leakage acoustic signal is a broadband sound wave, the traditional one-dimensional convolutional neural network structure is likely to be interfered by noise signals when processing broadband signal inputs because it pays the same attention to each frequency, resulting in reduced detection accuracy of the model. Therefore, after performing spectrum slicing operations on the leakage signal, the present invention builds a pipeline leakage detection model with a parallel multi-channel one-dimensional convolutional neural network model as the basic framework, so that the model can analyze the different frequency components of the signal more carefully. Specifically, the construction process of the pipeline leakage detection model is as follows: first, convolution blocks constructed by multiple one-dimensional convolutional neural networks are connected in parallel, the number of convolution blocks is the same as the number K of frequency band amplitude distributions obtained in step S105, each convolution block has the same network structure, and each convolution block corresponds to the amplitude distribution of a fixed frequency band obtained in step S105; then, the feature map obtained by the last layer of each convolution block is aggregated in the channel direction, so that different leakage frequency band information with different resolutions can be integrated, and the aggregated feature map is converted into a one-dimensional tensor through global average pooling; finally, the one-dimensional tensor is used as the input of the fully connected layer neural network, and the scores of the leakage and normal categories are obtained by calculation of multiple hidden layers inside the fully connected layer, and finally the probability of the pipeline leakage time domain signal belonging to the leakage signal and the normal signal is output through the softmax layer.
[0022] In the process of constructing the pipeline leakage detection model, the pipeline time domain acoustic signal data set is divided into a training set and a test set according to an 8:2 ratio, and the cross entropy loss is set as the loss function to enable the training leakage 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 Represents the true label of the i-th sample in the dataset, the normal sample is 0 and the leakage sample is 1; represents the probability that the pipeline leakage detection model predicts the i-th sample in the dataset as a leak; M represents the number of samples in the training set.
[0025] The early stopping mechanism is used in the model training process. The performance indicators (such as loss function or accuracy) on the validation set are calculated at the end of each iteration, and the validation set indicator number of the current iteration is compared with the previous best performance indicator. If the current performance indicator does not reach the best value, it is recorded and checked whether it has not been improved for multiple consecutive iterations. If so, the model is considered to be overfitted, the training is stopped, and the best model parameters are returned to avoid wasting time and computing resources; if not, the model training continues until the maximum number of iterations set is reached.
[0026] As an improvement of the present invention, in step S3, the MGrad-CAM method is called for the leakage detection model trained in step S2 to generate a frequency importance sequence for identifying the key frequency of pipeline leakage. As the number of network layers in the convolution block increases, the resolution of the frequency importance sequence generated by Grad-CAM will decrease, which weakens the accuracy of identifying the key frequency of the leakage sound signal. Therefore, the present invention proposes a MGrad-CAM method, which slices the input spectrum signal, divides the single spectrum signal according to the same frequency bandwidth, and obtains the amplitude distribution of K fixed frequency bands, which respectively correspond to the input data of K convolution fast channels in the pipeline leakage detection model, and analyzes each channel independently and then aggregates it, which can improve the resolution of the frequency importance sequence generated by the model and realize accurate identification of key frequencies.
[0027] The specific calculation method of the MGrad-CAM method is:
[0028] Step 3.1) First, the aggregate feature map A and the score y of the leakage 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) Secondly, through back propagation, the leakage category c can be obtained for the nth channel feature map of the i-th spectrum slice The gradient of Feature Map The importance of leakage category c is denoted by It can be calculated according to formula (2):
[0030]
[0031] Where N is the number of channels in the aggregated feature map; i represents the number of the spectrum slice.
[0032] After step 3.3), the feature maps obtained by the forward propagation in step 3.1) are weighted summed, and the ReLU function is used to retain only the features that have a positive impact on the category score. For the leakage category c, the gradient weighted class activation map Ω of the i-th spectrum slice i c The calculation of is shown in formula (3):
[0033]
[0034] Among them, N ′ It is the number of channels of the last convolutional layer feature map after the i-th spectrum slice is operated by the parallel convolution block.
[0035] Step 3.4) Finally, the frequency importance sequence of the leakage sound signal is the gradient weighted class activation map obtained by the above steps under different spectrum slices The frequency bands are combined in order. In order to obtain a frequency importance sequence of the same size as the original model input size, the cubic spline difference method is used for processing. Finally, the frequency importance sequence corresponding to the pipeline leakage sound spectrum signal input by the pipeline leakage detection model is The calculation method is shown in formula (4):
[0036]
[0037] Where K is the total number of spectrum slices and f(·) is the cubic spline interpolation function.
[0038] As an improvement of the present invention, in the step S4, the spectrum signal obtained in step S103 and the frequency importance sequence obtained in step S3 are plotted in the same coordinate system, and the frequency corresponding to the maximum value in the frequency importance sequence is the key frequency of the pipeline leakage sound signal. Specifically, the horizontal coordinate of the coordinate system is the frequency of the pipeline sound signal, the vertical coordinate 1 is the amplitude of the spectrum signal, and the vertical coordinate 2 is the value of the frequency importance sequence. The present invention verifies the model in a large number of pipeline leakage sound signal data sets, and analyzes the sound signals when the pipeline leakage occurs and after the repair by power spectral density, which can clearly identify the changes in frequency amplitude distribution caused by pipeline leakage (the area with large frequency amplitude distribution difference is the area where the key frequency is located), and compares the frequency importance sequence obtained by calling the leakage detection model with the MGrad-CAM method (the area with large frequency importance is considered to be the area where the key frequency is located), so that the accuracy of key frequency identification can be judged. Finally, the frequency corresponding to the maximum value in the frequency importance sequence is used as the key 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] The present invention proposes a method for identifying the key frequencies of pipeline leakage acoustic signals based on MGrad-CAM. The method can realize the identification of the key frequencies of pipeline leakage acoustic signals without relying on traditional digital signal processing technology and expert prior knowledge. Specifically, in the present invention, by adopting parallel multi-channel convolution blocks, the leakage detection model can be more focused on the extraction of local features. In each independent channel, the model can adaptively adjust the learnable parameters. This fine-tuning enables the model to more accurately distinguish the valuable frequency features of different frequency bands. In addition, by aggregating the output characteristic diagrams of multiple channels, the model enhances the resolution of MGrad-CAM, thereby solving the technical problem of low pipeline leakage detection accuracy caused by the difficulty of accurately identifying the key frequencies of highly complex nonlinear leakage signals by relying on traditional signal processing methods in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 is a flow chart of a method for identifying key frequencies of water supply pipeline leakage sound signals according to an embodiment of the present invention;
[0042] Figure 2 is a flow chart of a method for preprocessing a water supply pipeline leakage sound signal according to an embodiment of the present invention;
[0043] Figure 3 is a structural diagram of a leakage detection model and a MGrad-CAM method in a method for identifying key frequencies of leakage acoustic signals of a water supply pipeline according to an embodiment of the present invention;
[0044] Figure 4is a power spectrum distribution and frequency importance distribution diagram of a water supply pipeline leakage sound signal and a normal sound signal according to an embodiment of the present invention;
[0045] Figure 5 3 is a distribution diagram of the frequency spectrum and frequency importance sequence of the water supply pipeline leakage sound signal according to an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work 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 are explained below:
[0048] The key frequencies of leakage sound signals refer to the frequencies within a specific frequency band of the sound waves generated when a pipeline leaks. The sound waves within these frequency ranges have amplitude distribution characteristics that are significantly different from those in normal conditions (environmental noise). These frequencies carry important information about the occurrence of leakage and can directly reflect the state of pipeline leakage, which is crucial for identifying whether a pipeline is leaking.
[0049] The frequency importance sequence is a weight sequence generated by the MGrad-CAM method, which indicates the importance of each frequency in the pipeline leakage sound signal for the model to identify the leak. This sequence usually contains the importance score of each frequency point, and the higher the score, the more important the frequency is for leak identification. In the present invention, the frequency importance sequence can help us determine which frequencies are the key frequencies of the leakage sound signal.
[0050] Spectrum slicing refers to dividing the spectrum of the pipeline leakage sound signal into multiple different frequency bands, and each frequency band is processed as a separate input. The purpose of this is to enable the model to analyze the characteristics of the signal at different frequency components more carefully, so as to better identify the frequency changes when the leakage occurs.
[0051] The parallel multi-channel one-dimensional convolutional neural network is a deep learning model structure and the basic framework for constructing the leakage detection model of the present invention. It contains multiple parallel one-dimensional convolutional neural network modules, each of which processes a specific frequency band information in the spectrum slice, so as to better capture the leakage characteristics in different frequency ranges. This structure helps to improve the model's ability to handle the complexity of acoustic signals.
[0052] Multi-channel gradient weighted class activation mapping (MGrad-CAM) is a visualization technology based on deep learning models. In the present invention, MGrad-CAM is used to analyze the trained leakage detection model and generate a frequency importance sequence. The importance of each frequency in each spectrum slice to the classification result is evaluated by calculating the gradient of the feature map of different channels in the convolutional neural network for a specific category (such as leakage or normal). Finally, by aggregating these gradient weighted feature maps, a high-resolution frequency importance sequence is generated, which helps to identify the key frequencies of the acoustic signal.
[0053] like Figure 1 As shown, Figure 1 : is a flow chart of a method for identifying key frequencies of a water supply pipeline leakage acoustic signal according to an embodiment of the present invention. The method comprises the following steps:
[0054] Step S1, collect the time domain acoustic signals of the target pipeline in the water supply pipeline leakage and normal state, establish the pipeline time domain acoustic signal data set, and perform preprocessing operations on the time domain signals to obtain the input data of the pipeline leakage detection model. The present invention is based on the common problems in the pipeline leakage acoustic signal, and performs preprocessing operations on the time domain signals. Figure 2 The preprocessing operations shown are:
[0055] In step 101, the present invention needs to obtain a trained leakage detection model in advance before identifying the key frequency of the leakage sound signal, and classify the pipeline leakage signal and the normal signal into two categories, so it is necessary to prepare two types of data for the model in advance. The present invention collects the time domain sound signal of the target pipeline when the water supply pipeline leaks, and uses it as the leakage class data in the pipeline time domain sound signal data set (the data label is recorded as 1) and the repaired target pipeline time domain sound signal, and uses it as the normal class data in the pipeline time domain sound signal data set (the data label is recorded as 0), and prepares the pipeline time domain sound signal data set for training the pipeline leakage detection model. Specifically, in this embodiment, the acquisition frequency of the pipeline leakage signal is 8192Hz, the time for a single acquisition of the sound signal is 5 seconds, and the length of a single time domain sound signal is 40960. The data collection work is selected to be carried out from 2:00 to 4:00 in the morning to reduce the environmental noise interference caused by activities such as traffic and water use. The experiment lasted for 7 months, and a total of 1433 audio samples were collected, including 518 leakage audio and 915 normal audio. The labels of these data are verified through on-site excavation. The water department finds suspected leaks during routine inspections and uses noise probes in nearby valve wells to collect audio. After the audio collection is completed, maintenance personnel will excavate and confirm the suspected leaks. If it is confirmed to be a leak, the collected audio is marked as leaking audio; if it is normal, it is marked as normal audio.
[0056] In step 102, since the pipeline acoustic signal is easily disturbed by the surrounding environmental noise, it is necessary to filter all the data in the pipeline time domain acoustic signal data set to retain the useful information within the leakage frequency range (i.e., 100-2048Hz) and improve the signal-to-noise ratio of the pipeline time domain acoustic signal. Specifically, since the acquisition frequency of the pipeline leakage acoustic signal is 8192Hz, and the main frequency of the pipeline leakage is basically distributed below 2KHz, the Butterworth digital filter is used in this embodiment to filter the original time domain acoustic signal to retain the signal within the frequency range of 100-2048Hz.
[0057] In step 103, the pipeline time domain acoustic signal after filtering is subjected to fast Fourier transformation to convert the time domain acoustic signal into a spectrum signal. Since the pipeline leakage spectrum signal has higher interpretability than the original time domain signal, the present embodiment performs fast Fourier transformation on the original time domain signal while retaining the amplitude distribution in the frequency range of 100-2048 Hz.
[0058] In step 104, the amplitude distribution in the frequency range of 100-2048 Hz obtained in step 3 is standardized to eliminate the influence of the peak value in the spectrum on the model training result and accelerate the convergence speed of the leakage detection model training. This embodiment calculates the mean and variance of the preprocessed spectrum amplitude and performs a standardization operation on each spectrum signal.
[0059] In step 105, the spectrum signal after the standardization processing is sliced, and the single spectrum signal is sliced according to the same frequency bandwidth to obtain the amplitude distribution of K fixed frequency bands as the input data of the pipeline leakage detection model. In this embodiment, the processed amplitude distribution in the frequency range of 100-2048Hz is sliced. In this embodiment, the processed amplitude distribution is divided into 4 parts, that is, K is equal to 4. Therefore, the frequency bands corresponding to each amplitude distribution obtained correspond to 0-512Hz, 512-1024Hz, 1024-1536Hz and 1536-2048Hz respectively. These four distributions correspond to the inputs of four parallel convolutional neural network modules of the subsequent leakage detection model.
[0060] Step S2, inputting the different frequency band amplitude distributions of the time domain acoustic signal data of the leakage type and the normal type obtained through the preprocessing operation into the pipeline leakage detection model and training them to obtain a trained leakage detection model. Figure 3 As shown, Figure 3 It is a structural diagram of a leakage detection model and a MGrad-CAM method in a key frequency identification method for a water supply pipeline leakage acoustic signal according to an embodiment of the present invention.
[0061] Since Grad-CAM (Gradient-Weighted Class Activation Mapping) is a method for accurately locating feature areas that are highly correlated with specific categories in classification tasks, we cleverly use the amplitude distribution characteristics of the acoustic signal caused by leakage in a specific frequency band, which is completely different from the normal acoustic signal (i.e., environmental noise). In the leak detection process, the present invention introduces the MGrad-CAM technology, which aims to identify the area where the leakage signal and the normal signal appear significantly different in the frequency domain, i.e., the key frequency. This strategy enables the present invention to successfully identify the key frequency by inputting a single leakage signal into the model without the assistance of traditional signal processing technology. Studies have shown that when processing one-dimensional signals, one-dimensional convolutional neural networks are superior to two-dimensional convolutional neural networks. Therefore, the present invention uses a one-dimensional convolutional neural network as the basic network structure of the leak detection model. Since the pipeline leakage acoustic signal is a broadband sound wave, the traditional one-dimensional convolutional neural network structure is likely to be interfered by noise signals when processing broadband signal input, because it pays the same attention to each frequency, resulting in a decrease in the detection accuracy of the model. Therefore, after performing spectrum slicing operation on the leakage signal, the present invention builds a pipeline leakage detection model with a parallel multi-channel one-dimensional convolutional neural network model as the basic framework, so that the model can analyze the different frequency components of the signal more carefully.
[0062] Specifically, Figure 3 As shown, the construction process of the pipeline leakage detection model is as follows: first, the pipeline leakage detection model in the embodiment of the present invention is connected in parallel by convolution blocks constructed by four one-dimensional convolutional neural networks, the number of convolution blocks is the same as the number of frequency band amplitude distributions obtained in step S105, each convolution block has the same network structure, and each convolution block corresponds to the amplitude distribution of a fixed frequency band obtained in step S105; then, the feature map obtained by the last layer of each convolution block is aggregated in the channel direction, so that different leakage frequency band information of different resolutions can be integrated, and the aggregated feature map is converted into a one-dimensional tensor by global average pooling; finally, the one-dimensional tensor is used as the input of the fully connected layer neural network, and the scores of the leakage and normal categories are obtained by calculation of multiple hidden layers inside the fully connected layer, and finally the probability of the pipeline leakage time domain signal belonging to the leakage signal and the normal signal is output through the softmax layer. The parallel multi-channel one-dimensional convolutional neural network model is trained based on the 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 an embodiment of the present invention.
[0063] Table 1: Architecture diagram of a water supply pipeline leakage detection model according to an embodiment of the present invention
[0064]
[0065] In the process of constructing the pipeline leakage detection model, the pipeline time domain acoustic signal data set is divided into a training set and a test set according to an 8:2 ratio. 20% of the training set is set as a validation set. The cross entropy loss is set as the loss function to enable the training leakage 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 Represents the true label of the i-th sample in the dataset, the normal sample is 0 and the leakage sample is 1; represents the probability that the pipeline leakage 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, the embodiment of the present invention uses Keras 2.7.0 and TensorFlow 2.7.0 tools to build the leakage detection model, and uses the Adam method to train these leakage detection models. An early stopping mechanism is used in the model training process. The performance indicators (such as loss function or accuracy) on the validation set at the end of each iteration are calculated, and the validation set indicator number of the current iteration is compared with the previous best performance indicator. If the current performance indicator does not reach the optimal value, it is recorded and checked whether it has not been improved for multiple consecutive iterations. If so, the model is considered to be overfitted, the training is stopped, and the optimal model parameters are returned to avoid wasting time and computing resources; if not, the model training is continued until the maximum number of iterations set is reached. This study mainly focuses on the loss function value of the validation set during the model training process. If the model performance does not improve after 30 consecutive iterations, the model training is stopped, that is, the model is considered to have converged, and the maximum number of iterations is set to 1000.
[0069] Step S3, calling the MGrad-CAM method on the leakage detection model trained in step S2, and generating a frequency importance sequence for identifying key frequencies of pipeline leakage. As the number of network layers in the convolutional fast increases, the resolution of the frequency importance sequence generated by Grad-CAM will decrease, which weakens the accuracy of identifying key frequencies of leakage sound signals. Therefore, the present invention proposes an MGrad-CAM method, which slices the input spectrum signal, divides the single spectrum signal according to the same frequency bandwidth, and obtains amplitude distributions of K fixed frequency bands, which respectively correspond to the input data of the K convolutional fast channels in the pipeline leakage detection model, and analyzes each channel independently and then aggregates it, which can improve the resolution of the frequency importance sequence generated by the model and achieve accurate identification of key frequencies. Figure 3 As shown, Figure 3 This is a structural diagram of the leakage detection model and the MGrad-CAM method in the key frequency identification method of the water supply pipeline leakage sound signal according to an embodiment of the present invention. The specific calculation method is:
[0072] Step 3.1) First, the aggregate feature map A and the score y of the leakage 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) Secondly, through back propagation, the leakage category c can be obtained for the nth channel feature map of the i-th spectrum slice The gradient of Feature Map The importance of leakage category c is denoted by It can be calculated according to formula (2):
[0074]
[0075] Where N is the number of channels in the aggregated feature map; i represents the number of the spectrum slice.
[0076] After step 3.3), the feature maps obtained by forward propagation in step 3.1) are weighted summed, and the ReLU function is used to retain only the features that have a positive impact on the category score. For the leakage category c, the gradient weighted class activation map of the i-th spectrum slice is The calculation of is shown in formula (3):
[0077]
[0078] Among them, N ′ It is the number of channels of the last convolutional layer feature map after the i-th spectrum slice is operated by the parallel convolution block.
[0079] Step 3.4) Finally, the frequency importance sequence of the leakage sound signal is the gradient weighted class activation map obtained by the above steps under different spectrum slices The frequency bands are combined in order. In order to obtain a frequency importance sequence of the same size as the original model input size, the cubic spline difference method is used for processing. Finally, the frequency importance sequence corresponding to the pipeline leakage sound spectrum signal input by the pipeline leakage detection model is The calculation method is shown in formula (4):
[0080]
[0081] Wherein, K is the total number of spectrum slices, and in this embodiment, K=4; f(·) is a cubic spline interpolation function.
[0082] Step S4, plotting the frequency spectrum signal obtained in step S103 and the frequency importance sequence obtained in step S3 in the same coordinate system, and the frequency corresponding to the maximum value in the frequency importance sequence is the key frequency of the pipeline leakage sound signal. Specifically, the present invention verifies the model in a large number of pipeline leakage sound signal data sets, and analyzes the sound signals when the pipeline leakage occurs and after the repair through power spectral density, so as to clarify the changes in frequency amplitude distribution caused by the pipeline leakage (the area with large difference in frequency amplitude distribution is the area where the key frequency is located), and compares the frequency importance sequence obtained by calling the leakage detection model with the MGrad-CAM method (the area with large frequency importance is considered to be the area where the key frequency is located), so as to judge the accuracy of the key frequency identification. Figure 4 As shown, Figure 4 It is a power spectrum distribution diagram and frequency importance distribution diagram of the water supply pipeline leakage sound signal and normal sound signal according to an embodiment of the present invention. The upper curve in the figure represents the power spectrum density distribution diagram of the sound signal when the pipeline leaks, and the lower curve is the power spectrum density distribution diagram of the pipeline sound signal after the leak is repaired (i.e., normal signal). The difference between the two is caused by the occurrence of the leakage time. The frequency corresponding to the area with large difference is the key frequency for leak identification, and the white area corresponding to the lower color band is the position of the key frequency identified by the present invention. It can be seen from the figure that the position of the key frequency considered by the present invention corresponds to the position with large difference in the power spectrum density curve, which shows that the present invention can accurately identify the key frequency of the pipeline leakage sound signal.
[0083] Furthermore, the pipeline leakage sound spectrum signal and the frequency importance sequence are plotted in the same coordinate system, and the frequency corresponding to the maximum value in the frequency importance sequence is the key frequency of the pipeline leakage sound signal. Figure 5 As shown, Figure 5 It is a spectrum diagram of a water supply pipe leakage sound signal and a frequency importance sequence distribution diagram according to an embodiment of the present invention. Figure 5 The horizontal axis of the coordinate system is the frequency of the pipeline 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. Figure 5 It can be seen that the present invention generally pays more attention to the frequency band where the peak appears in the spectrum, which is consistent with human intuitive cognition. The key frequency of the pipeline sound signal caused by the leakage event is 970Hz. Although the peak of 300Hz in the spectrum of the pipeline leakage sound signal is the largest, the frequency band with the highest frequency importance is close to the peak of 970Hz. This is mainly because under normal conditions, the frequency of the peak of environmental noise is usually low, and the appearance of high-frequency signal components is more likely to indicate a leakage.
[0084] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for identifying key frequencies of pipeline leakage acoustic signals based on MGrad-CAM, characterized in that: The method comprises the following steps: Step S1: collecting time domain acoustic signals of the target pipeline in the water supply pipeline leakage and normal state, establishing a pipeline time domain acoustic signal data set, and performing a preprocessing operation on the time domain signal to obtain input data of the pipeline leakage detection model; wherein a spectrum signal can be obtained during the preprocessing operation; Step S2: inputting the amplitude distributions of different frequency bands of the time-domain acoustic signal data of the leakage type and the normal type obtained through the preprocessing operation in step S1 into the pipeline leakage detection model and training them to obtain a trained leakage detection model; The pipeline leakage detection model adopts a parallel multi-channel one-dimensional convolutional neural network model as a basic framework, and inputs the pipeline time domain acoustic signal processed in step 1 into the pipeline leakage detection model to determine whether the signal is a leakage signal, otherwise it is a normal signal; Step S3: calling the MGrad-CAM method on the leakage detection model trained in step S2 to generate a frequency importance sequence for identifying key frequencies of pipeline leakage; By slicing the input spectrum signal, the single spectrum signal is divided according to the same frequency bandwidth to obtain the amplitude distribution of K fixed frequency bands, which correspond to the input data of K convolution fast 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 realize accurate identification of key frequencies. Step S4: Plot the frequency spectrum signal of step S1 and the frequency importance sequence of step S3 in the same coordinate system, and the frequency corresponding to the maximum value in the frequency importance sequence is the key frequency of the pipeline leakage sound signal.
2. The method for identifying key frequencies of pipeline leakage sound signals based on MGrad-CAM according to claim 1, characterized in that: The step S1 is specifically as follows: Step S101: collecting the time domain acoustic signal of the target pipeline when the water supply pipeline leaks, and using it as the leakage class data in the pipeline time domain acoustic signal data set, and the repaired target pipeline time domain acoustic signal, and using it as the normal class data in the pipeline time domain acoustic signal data set; wherein 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: filtering all data in the pipeline time domain acoustic signal data set; Step S103: performing fast Fourier transform on the filtered pipeline time domain acoustic signal to convert the time domain signal into a spectrum signal; Step S104: performing a standardization operation on the spectrum signal; Step S105: Slicing the spectrum signal after the standardization process, dividing the single spectrum signal according to the same frequency bandwidth, and obtaining amplitude distributions of K fixed frequency bands as input data of the pipeline leakage detection model.
3. The method for identifying key frequencies of pipeline leakage sound 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: The convolution blocks constructed by multiple one-dimensional convolutional neural networks are connected in parallel, the number of convolution blocks is the same as the number K of frequency band amplitude distributions obtained in step S105, each convolution block has the same network structure, and each convolution block corresponds to the amplitude distribution of a fixed frequency band obtained in step S105; then, the feature map obtained by the last layer of each convolution block is aggregated in the channel direction, and different leakage frequency band information of different resolutions is integrated, and the aggregated feature map is converted into a one-dimensional tensor through global average pooling; finally, the one-dimensional tensor is used as the input of the fully connected layer neural network, and the scores of the leakage and normal categories are obtained by calculation of multiple hidden layers inside the fully connected layer, and the probability of the leakage time domain signal belonging to the leakage signal and the normal signal is output through the softmax layer output pipeline.
4. The method for identifying key frequencies of pipeline leakage sound signals based on MGrad-CAM according to claim 3 is characterized in that: In the process of constructing the pipeline leakage detection model, the pipeline time-domain acoustic signal data set is divided into a training set and a test set according to a ratio, and the cross entropy loss is set as the loss function, so that the training leakage detection model can achieve a higher recognition accuracy; An early stopping mechanism is used during model training.
5. The method for identifying key frequencies of pipeline leakage sound signals based on MGrad-CAM according to claim 1, characterized in that: In step 3, the specific calculation method of the MGrad-CAM method is: Step 3.1) Obtain the aggregate feature map A and the score y of the leakage category c before the softmax layer through the forward propagation of the parallel multi-channel one-dimensional convolutional neural network model c ; Step 3.2) Through back propagation, the leakage category c can be obtained for the nth channel feature map of the i-th spectrum slice The gradient of Feature Map The importance of leakage category c is denoted by Calculate according to formula (2): Where N is the number of channels in the aggregated feature map; i represents the number of the spectrum slice; Step 3.3) Perform weighted summation on the feature maps obtained by forward propagation in step 3.1), and use the ReLU function to retain only the features that have a positive impact on the category score. For the leakage category c, the gradient weighted class activation map of the i-th spectrum slice The calculation of is shown in formula (3): Among them, N ′ is the number of channels of the last convolutional layer feature map after the i-th spectrum slice is operated by the parallel convolution block; Step 3.4) The frequency importance sequence of the leakage sound signal is the gradient weighted class activation map obtained by the above steps under different spectrum slices The frequency bands are combined in order. In order to obtain a frequency importance sequence of the same size as the original model input size, the cubic spline difference method is used for processing. Finally, the frequency importance sequence corresponding to the pipeline leakage sound spectrum signal input by the pipeline leakage detection model is The calculation method is shown in formula (4): Where K is the total number of spectrum slices and f(·) is the cubic spline interpolation function.
Citation Information
Patent Citations
Pipe leak detection method and device
CN109931506A
Convolutional neural network audio recognition method based on one-dimensional attention mechanism
CN114187923A
Heating pipeline leakage detection method based on AlexNet convolutional neural network
CN116428529A
Improved 1DCNN oil and gas pipeline information physical fusion system leakage detection method
CN116659767A
Structural health monitoring seismic event identification and abnormal data diagnosis method
CN116756503A
Cited By
Leakage diagnosis method and system for water supply network
CN121117643A
A method and system for leak diagnosis of a water supply network
CN121117643B
