Water supply network leakage detection method and device, equipment and medium thereof
Through the self-supervised learning framework combined with the comparison learning and shadowing and completion pre-training tasks, the problem of scarce data and high labeling costs in the leakage detection of water supply pipeline networks is solved, efficient and accurate leakage detection and prediction are achieved, and the intelligent and automated development of leakage detection of water supply pipeline networks is promoted.
Patent Information
- Application Number
- CN202510438137.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-04-09
AI Technical Summary
The existing water supply pipeline leakage detection technology relies on a large amount of labeled data. The frequency of leakage events in actual scenarios is low, resulting in scarce data and high labeling cost, which seriously restricts the generalization ability of the model.
Using a self-supervised learning framework, through comparative learning and shading completion pre-training tasks, wavelet time-frequency diagrams are used for multi-resolution analysis, a water supply pipeline leakage detection model is constructed, so as to reduce dependence on labeled data, and improve the model's adaptability and generalization ability in different scenarios.
It improves the detection accuracy and efficiency of leakage signals, reduces manual labeling costs, enhances the robustness and adaptability of the model, adapts to diverse practical scenarios, and realizes the intelligence and automation of leakage detection of water supply pipelines.
Smart Images

Figure CN120296428A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of pipeline leakage detection, and particularly to a water supply network leakage detection method, a corresponding device, an electronic device, and a computer-readable storage medium. Background Art
[0002] As an important part of urban infrastructure, the water supply network undertakes the key task of delivering clean water to users. With the rapid growth of residents' water demand and the exacerbation of pipeline network aging problems, pipeline network leakage detection has become a prominent problem in the operation and maintenance of water supply networks. Leakage not only causes water resource waste, but also may lead to problems such as insufficient water supply and water quality pollution, affecting the public's water use efficiency and water use safety. Therefore, developing accurate and efficient leakage detection technology has important practical significance.
[0003] At present, researchers have proposed a variety of technical solutions for water supply network leakage detection, mainly including transient wave method, mass balance method, ground penetrating radar method, acoustical method, fiber optic sensing method, etc. Among them, the acoustical method has become the mainstream technical direction due to its advantages such as high sensitivity, accuracy, and reliability. In recent years, by introducing machine learning algorithms to extract features and recognize patterns from leakage sound signals, the detection efficiency has been further improved. For example, Patent CN119393688A extracts Mel-frequency cepstral coefficients (MFCC) from sound signals as input features; Patent CN119123338A uses a spectral heat map as input features. However, the existing methods still have obvious limitations: firstly, the existing sound signal extraction methods are limited by the fixed window resolution and are difficult to capture the non-stationary characteristics of leakage signals; secondly, the training of machine learning models depends on a large amount of labeled data, and the occurrence frequency of leakage events in actual scenarios is low, resulting in scarce leakage data and high labeling costs, which seriously restricts the generalization ability of the models.
[0004] In summary, in view of the problems in the prior art that the training of machine learning models depends on a large amount of labeled data, and the occurrence frequency of leakage events in actual scenarios is low, resulting in scarce leakage data and high labeling costs, which seriously restricts the generalization ability of the models, the applicant has made corresponding explorations to solve this problem. Summary of the Invention
[0005] The purpose of the present application is to solve the above problems and provide a water supply network leakage detection method, a corresponding device, an electronic device, and a computer-readable storage medium.
[0006] To achieve the various purposes of the present application, the following technical solutions are adopted:
[0007] A water supply network leakage detection method proposed for one of the purposes of the present application includes:
[0008] Obtain a sample training set, where the sample training set includes a plurality of training samples, and the training samples include wavelet time-frequency diagrams corresponding to the vibration sound signals of the water supply pipeline and their corresponding sample labels. The sample labels represent the leakage states corresponding to the water supply pipeline, and the wavelet time-frequency diagrams include core wavelet time-frequency diagrams and non-core wavelet time-frequency diagrams;
[0009] Intercept two wavelet time-frequency diagrams from the same training sample as a positive sample pair, and intercept wavelet time-frequency diagrams of the same size as the positive sample pair from different training samples as a negative sample pair. Use the positive sample pair and the negative sample pair to perform contrast learning self-supervised training on the contrast learning pre-training model of the preset water supply network leakage detection model, so that the contrast learning pre-training model pre-trained to convergence is suitable for generating an equivalent wavelet time-frequency diagram of the negative sample pair according to the positive sample pair;
[0010] Replace the corresponding non-core wavelet time-frequency diagram in the wavelet time-frequency diagram of the training sample with the equivalent wavelet time-frequency diagram and cover a part of the core wavelet time-frequency diagram in the wavelet time-frequency diagram as a training sample, and use the core wavelet time-frequency diagram as a supervision label to perform pre-training on the masking and completion pre-training model of the water supply network leakage detection model until it converges;
[0011] Use the wavelet time-frequency diagram in the training sample as a training sample, and use the sample label corresponding to the wavelet time-frequency diagram as a supervision label to perform fine-tuning training on the fine-tuning model of the water supply network leakage detection model until it converges, so as to complete the training of the water supply network leakage detection model;
[0012] Input the vibration sound signal of the water supply pipeline to be detected into the water supply network leakage detection model that has been trained to converge to determine whether the water supply pipeline to be detected is in a leaking state or a non-leaking state, so as to complete the leakage detection of the water supply network.
[0013] Optionally, the basic network architecture of the water supply network leakage detection model is a self-supervised learning model, and the self-supervised learning model includes a contrast learning pre-training model, a masking and completion pre-training model, and a fine-tuning model.
[0014] Optionally, the contrast learning pre-training model includes a first encoder and a first decoder. The first encoder includes a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer, and three residual blocks. A self-attention mechanism layer is connected behind each residual block; the first decoder is constructed by a global average pooling layer and a fully connected layer.
[0015] Optionally, the occlusion completion pre-training model includes a second encoder and a second decoder, where the second encoder includes a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer, and three residual blocks, and a self-attention mechanism layer is connected after each residual block; the first decoder is constructed by multiple transposed convolutional layers.
[0016] Optionally, freeze the weights of the first encoder of the contrastive learning pre-training model and the weights of the second encoder of the occlusion completion pre-training model, and connect two convolutional blocks, two fully connected layers, and a Sigmoid activation function to construct a fine-tuning model of the water supply network leakage detection model.
[0017] Optionally, taking the wavelet time-frequency diagram in the training samples as the training samples and the sample labels corresponding to the wavelet time-frequency diagram as the supervision labels, the steps of fine-tuning the fine-tuning model of the water supply network leakage detection model to a convergence state include:
[0018] Use the sample data set without the sample labels to train the contrastive learning pre-training model and the occlusion completion pre-training model, and use error backpropagation to transmit the loss values of the first encoder and the second encoder back to the water supply network leakage detection model, and adjust the parameters of the encoder in the water supply network leakage detection model structure until the water supply network leakage detection model converges;
[0019] Taking the wavelet time-frequency diagram in the training samples as the training samples and the sample labels corresponding to the wavelet time-frequency diagram as the supervision labels, perform fine-tuning training on the fine-tuning model to a convergence state.
[0020] Optionally, the steps of obtaining the sample training set include:
[0021] Collect the vibration sound signals of each water supply pipe in the water supply network, and mark the leakage state of the water supply pipe to determine the sample labels, where the sample labels are characterized as having a leakage state or no leakage state;
[0022] Perform normalization processing on the vibration sound signals of the water supply pipe to determine the normalized vibration sound signals of the water supply pipe, and perform continuous wavelet transform on the normalized vibration sound signals of the water supply pipe using the Morlet wavelet basis function to determine the wavelet time-frequency diagram corresponding to the vibration sound signals of the water supply pipe;
[0023] Construct the sample training set according to the wavelet time-frequency diagram corresponding to the vibration sound signals of the water supply pipe and its corresponding sample labels.
[0024] A water supply network leakage detection device provided for another purpose of this application includes:
[0025] A training set acquisition module, configured to acquire a sample training set, wherein the sample training set includes a plurality of training samples, and each training sample includes a wavelet time-frequency diagram corresponding to a vibration sound signal of a water supply pipe and a corresponding sample label, the sample label characterizing the leakage state corresponding to the water supply pipe, and the wavelet time-frequency diagram includes a core wavelet time-frequency diagram and a non-core wavelet time-frequency diagram;
[0026] A contrastive learning training module, configured to intercept two segments of wavelet time-frequency diagrams from the same training sample as a positive sample pair, and intercept wavelet time-frequency diagrams of the same size as the positive sample pair from different training samples as a negative sample pair, and use the positive sample pair and the negative sample pair to perform contrastive learning self-supervised training on a contrastive learning pre-training model of a preset water supply network leakage detection model, so that the contrastive learning pre-training model pre-trained to convergence is adapted to generate an equivalent wavelet time-frequency diagram of the negative sample pair according to the positive sample pair;
[0027] A masking and completion training module, configured to replace the corresponding non-core wavelet time-frequency diagram in the wavelet time-frequency diagram of the training sample with the equivalent wavelet time-frequency diagram and cover a part of the core wavelet time-frequency diagram in the wavelet time-frequency diagram as a training sample, and use the core wavelet time-frequency diagram as a supervision label to perform pre-training on a masking and completion pre-training model of the water supply network leakage detection model until a convergence state;
[0028] A fine-tuning model training module, configured to use the wavelet time-frequency diagram in the training sample as a training sample and the sample label corresponding to the wavelet time-frequency diagram as a supervision label to perform fine-tuning training on a fine-tuning model of the water supply network leakage detection model until a convergence state, so as to complete the training of the water supply network leakage detection model;
[0029] A pipeline leakage detection module, configured to input a vibration sound signal of a water supply pipe to be detected into a water supply network leakage detection model that has been trained to a convergence state, so as to determine whether the water supply pipe to be detected is in a leakage state or a non-leakage state, so as to complete the leakage detection of the water supply network.
[0030] An electronic device provided to meet another object of the present application, including a central processing unit and a memory, and the central processing unit is configured to call and run a computer program stored in the memory to execute the steps of the water supply network leakage detection method described in the present application.
[0031] A computer-readable storage medium provided to meet another object of the present application, which stores a computer program implemented according to the water supply network leakage detection method in the form of computer-readable instructions, and when the computer program is called and run by a computer, it executes the steps included in the corresponding method.
[0032] Compared with the prior art, in view of the problems in the prior art that the training of machine learning models relies on a large amount of labeled data, while the occurrence frequency of leakage events in actual scenarios is relatively low, resulting in scarce leakage data and high labeling costs, which severely restricts the generalization ability of the models, the present application includes but is not limited to the following beneficial effects:
[0033] First, the present application improves the signal capture ability through multi-resolution time-frequency analysis. Traditional leakage signal detection methods (such as acoustic methods) often face the limitation of fixed window resolution and cannot effectively capture the high-frequency transient features and low-frequency continuous modes in leakage signals. However, the present application uses continuous wavelet transform (CWT) to perform multi-resolution time-frequency analysis on the vibration sound signals of water supply pipe networks, enabling more accurate identification of leakage signals. This method can not only capture the high-frequency transient changes during the leakage process but also track the continuous features of leakage in the low-frequency band, thus comprehensively improving the detection accuracy of leakage signals.
[0034] Second, the present application greatly reduces the dependence on labeled data and improves the generalization ability. Existing leakage detection methods often rely on a large amount of labeled data for training. However, the occurrence frequency of leakage events in the actual environment is relatively low, resulting in scarce data and high labeling costs. To address this issue, the present application proposes using unlabeled data for self-supervised learning. Specifically, a self-supervised learning framework is constructed through two pre-training tasks: contrastive learning and masked completion, enabling the model to learn the time-frequency correlation characteristics of leakage signals from unlabeled data, significantly reducing the dependence on manually labeled data. This approach not only reduces labor costs but also improves the adaptability and generalization ability of the leakage detection system in different scenarios.
[0035] Third, the present application innovatively combines the dual pre-training tasks of masked completion and contrastive learning, enabling the model to self-learn the characteristics of leakage signals during the pre-training stage. Through contrastive learning, the model can learn the similarities and differences between positive and negative samples, which helps improve the model's ability to distinguish leakage signals; while through the masked completion task, the model can learn to fill in the missing parts of the signals, thereby improving its robustness and accuracy. This self-supervised learning framework enhances the model's adaptive ability, especially in the case of a lack of a large amount of labeled data, and still enables effective learning and identification.
[0036] Fourth, due to the relatively low occurrence frequency of leakage events in actual scenarios and the difficulty in obtaining leakage data, the labeling workload is large and the cost is high. By introducing self-supervised learning with unlabeled data, the present application significantly reduces the need for manually labeled data, making leakage detection more efficient. Even in the case of scarce labeled data, the model can still be accurately trained and identified, improving the working efficiency of water supply pipe network leakage detection.
[0037] Fifthly, this application significantly improves the model generalization ability and adapts to diverse actual scenarios. By combining different types of training data (including signal data under different pipe materials, pipe ages, and water pressure scenarios), and through the design of a self-supervised learning framework, the generalization ability of the model in diverse actual environments is enhanced. Whether it is a newly built pipe network, an aging pipe network, or a water supply pipe network under different water pressure environments, the trained model can effectively identify leakage signals, ensuring that the leakage detection technology can adapt to more complex actual scenarios.
[0038] Sixthly, this application finally establishes an intelligent identification model for leakage sound signals in water supply pipe networks, which can effectively improve the automation level of leakage detection in water supply pipe networks. Such an intelligent detection system can not only monitor the leakage situation of water supply pipe networks in real time, but also predict potential pipeline failures (such as safety accidents like water pipe bursts) in advance, thus greatly reducing the occurrence probability of safety accidents. This will effectively reduce maintenance costs, enhance water supply security, and avoid greater disasters and economic losses caused by the failure to detect leakage in a timely manner.
[0039] In summary, this application can effectively improve the accuracy and efficiency of leakage detection in water supply pipe networks, reduce the dependence on manually labeled data, enhance the generalization ability of the model in different pipe network scenarios, and at the same time promote the development of leakage detection in water supply pipe networks towards the direction of intelligence and automation. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and / or additional aspects and advantages of this application will become apparent and be readily understood from the following description of the embodiments in conjunction with the drawings, where:
[0041] Figure 1 is a schematic flowchart of the method for detecting leakage in a water supply pipe network according to an embodiment of this application;
[0042] Figure 2 is a schematic diagram of extracting the characteristics of leakage sound signals in a water supply pipe network by continuous wavelet transform according to an embodiment of this application;
[0043] Figure 3 is a schematic diagram of the contrastive learning pre-training task according to an embodiment of this application;
[0044] Figure 4 is a schematic diagram of the masked completion pre-training task according to an embodiment of this application;
[0045] Figure 5 is an exemplary network structure of the self-supervised learning model according to an embodiment of this application;
[0046] Figure 6 is an exemplary network structure of the encoder structure of the pre-trained model and the fine-tuning model according to an embodiment of this application;
[0047] Figure 7This is a schematic diagram of the principle of the water supply network leakage detection device in the embodiments of the present application;
[0048] Figure 8 This is a schematic structural diagram of the computer device in the embodiments of the present application. Detailed implementation manners
[0049] The embodiments of the present application will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary only for explaining the present application and should not be construed as limiting the present application.
[0050] Those skilled in the art of the present technology can understand that unless specifically stated otherwise, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present application means the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or their groups. It should be understood that when we say that an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The phrase "and / or" used herein includes all or any unit and all combinations of one or more related listed items.
[0051] Those skilled in the art of the present technology can understand that unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as the general understanding of those of ordinary skill in the art to which the present application belongs. It should also be understood that terms such as those defined in a general dictionary should be understood to have a meaning consistent with the meaning in the context of the prior art, and will not be interpreted with an idealized or overly formal meaning unless specifically defined as here.
[0052] Those skilled in the art can understand that the "client", "terminal", and "terminal device" used herein include both devices with a wireless signal receiver that only has the ability to receive and no ability to transmit, and devices with receiving and transmitting hardware that can perform two-way communication on a two-way communication link. Such devices may include: cellular or other communication devices such as personal computers, tablet computers, etc., which have a single-line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which can combine voice, data processing, fax, and / or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, pager, Internet / intranet access, web browser, notepad, calendar, and / or GPS (Global Positioning System) receiver; conventional laptop and / or palm computers or other devices, which are conventional laptop and / or palm computers or other devices with and / or including a radio frequency receiver. The "client", "terminal", and "terminal device" used herein can be portable, transportable, installed in a vehicle (air, sea, and / or land), or suitable for and / or configured to run locally, and / or run in a distributed manner at any other location on the earth and / or in space. The "client", "terminal", and "terminal device" used herein can also be a communication terminal, an Internet access terminal, a music / video playback terminal, for example, it can be a PDA, MID (Mobile Internet Device), and / or a mobile phone with music / video playback function, or it can also be a smart TV, a set-top box, etc.
[0053] The hardware referred to by names such as "server", "client", and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer, and is a hardware device with the necessary components disclosed by the von Neumann principle, including a central processing unit (including an arithmetic unit and a controller), a memory, an input device, and an output device. The computer program is stored in its memory, and the central processing unit loads the program stored in the external memory into the memory for execution, executes the instructions in the program, and interacts with the input / output devices to complete specific functions.
[0054] It should be noted that the concept of "server" referred to in this application can similarly be extended to apply to server clusters. According to the network deployment principles understood by those skilled in the art, the various servers should be logically divided. Physically, these servers can either be independent of each other but can be invoked through interfaces, or integrated into a single physical computer or a set of computer clusters. Those skilled in the art should understand this flexibility and should not be restricted by this when implementing the network deployment method of this application.
[0055] One or several technical features of this application, unless expressly specified, can either be deployed on the server and accessed by the client remotely invoking the online service interface provided by the server, or directly deployed and run on the client for access.
[0056] The neural network models cited or possibly cited in this application, unless expressly specified, can either be deployed on a remote server and remotely invoked on the client, or deployed on a client with sufficient device capabilities for direct invocation. In some embodiments, when it runs on the client, its corresponding intelligence can be obtained through transfer learning to reduce the requirements for the client's hardware operation resources and avoid excessive consumption of the client's hardware operation resources.
[0057] All kinds of data involved in this application, unless expressly specified, can either be remotely stored on the server or stored on the local terminal device, as long as it is suitable for being invoked by the technical solution of this application.
[0058] Those skilled in the art should be aware that although the various methods of this application are described based on the same concept and thus show commonality with each other, unless otherwise specified, these methods can be executed independently. Similarly, for the various embodiments disclosed in this application, they are all proposed based on the same inventive concept. Therefore, for concepts with the same expression, as well as concepts that are only appropriately transformed for convenience although the concept expressions are different, they should be equally understood.
[0059] For the various embodiments to be disclosed in this application, unless expressly pointed out that there is a mutually exclusive relationship between them, the relevant technical features involved in each embodiment can be cross-combined to flexibly construct new embodiments, as long as this combination does not deviate from the creative spirit of this application and can meet the needs in the prior art or solve certain deficiencies in the prior art. Those skilled in the art should be aware of this flexibility.
[0060] As an important part of urban infrastructure, the water supply network undertakes the key task of delivering clean water to users. With the rapid growth of residents' water demand and the exacerbation of pipeline aging problems, pipeline leakage has become a prominent problem in the operation and maintenance of the water supply network. Leakage not only causes waste of water resources, but also may lead to problems such as insufficient water supply and water quality pollution, affecting the public's water use efficiency and water use safety. Therefore, the development of accurate and efficient leakage detection technology has important practical significance.
[0061] Based on the reference of the above exemplary scenarios, please refer to Figure 1 , in one embodiment of the water supply network leakage detection method of the present application, it includes:
[0062] Step S10, obtaining a sample training set, where the sample training set includes a plurality of training samples, the training samples include wavelet time-frequency diagrams corresponding to the vibration sound signals of the water supply pipeline and their corresponding sample labels, the sample labels characterize the leakage states corresponding to the water supply pipeline, and the wavelet time-frequency diagrams include core wavelet time-frequency diagrams and non-core wavelet time-frequency diagrams;
[0063] The water supply network leakage detection system in the terminal device can obtain a sample training set. Among them, the sample training set includes multiple training samples. The training sample includes the wavelet time-frequency diagram corresponding to the vibration sound signal of the water supply pipeline and its corresponding sample label. The sample label represents the leakage state corresponding to the water supply pipeline. The wavelet time-frequency diagram includes a core wavelet time-frequency diagram and a non-core wavelet time-frequency diagram. Specifically, the vibration sound signal of the water supply pipeline is caused by factors such as water flow, pressure change, pipeline damage or leakage in the pipeline. These vibration signals can be collected by sensors (such as accelerometers or microphones). The sound signals captured by the sensors can reflect the health status of the pipeline. By analyzing these vibration sound signals, the system can identify whether there are abnormalities (such as leakage) in the pipeline. The wavelet time-frequency diagram is the time-frequency representation obtained after processing the vibration sound signal of the water supply pipeline by wavelet transform. The time-frequency diagram can simultaneously display the characteristics of the signal in the time domain and the frequency domain, and can capture the instantaneous frequency change of the signal, which helps to identify leakage or other abnormal events. In the leakage detection of the water supply network, the wavelet time-frequency diagram helps to analyze the frequency components of the vibration sound signal and reveals the characteristic changes that may be caused by leakage. The core wavelet time-frequency diagram refers to the main or significant frequency components extracted from the signal. It usually represents the most important features in the signal and may include frequency information directly related to leakage. The time-frequency diagram of the core part occupies the most critical components in the entire signal and is usually the key area for analyzing and detecting leakage. The non-core wavelet time-frequency diagram contains other frequency components in the signal. These components may not be directly related to leakage or are less critical information for leakage detection. The sample label refers to the annotation information of each training sample and is usually used in supervised learning tasks. In this system, the sample label represents the leakage state of the water supply pipeline. For example, the label can be "leakage" or "no leakage", that is, each training sample will tell the model whether the given vibration sound signal is related to leakage. In this way, the model learns how to predict the health status of the pipeline according to the input signal. The leakage state refers to the current health status of the water supply pipeline, especially whether there is a phenomenon of water pipe leakage. By analyzing the wavelet time-frequency diagram, the system will be able to judge whether there is leakage in the pipeline.
[0064] In some embodiments, the step of obtaining the sample training set includes:
[0065] Step S101, collect the vibration sound signals of the water supply pipelines corresponding to each water supply pipeline in the water supply network, and mark the leakage state of the water supply pipeline to determine the sample label, where the sample label is characterized as a leakage state or a non-leakage state;
[0066] Step S102: Normalize the vibration sound signal of the water supply pipeline to determine the normalized vibration sound signal of the water supply pipeline, and perform continuous wavelet transform on the normalized vibration sound signal of the water supply pipeline using the Morlet wavelet basis function to determine the wavelet time-frequency diagram corresponding to the vibration sound signal of the water supply pipeline;
[0067] Step S103: Construct the sample training set according to the wavelet time-frequency diagram corresponding to the vibration sound signal of the water supply pipeline and its corresponding sample label.
[0068] Specifically, the vibration sound signals generated by each water supply pipeline in the water supply network can be collected, and the pipeline leakage states corresponding to the water supply pipelines are marked. The pipeline leakage states include leakage state or non-leakage state; more specifically, an appropriate number of leakage sound signal recognition devices can be arranged in the water supply pipelines in the target area. Collect the leakage sound signals of water supply pipelines such as ductile iron pipes and PE pipes during a relatively quiet period (after 22:00 every day). During the process of collecting sound signal data, a pressure regulating valve is used on the main pipe to regulate the pressure, and the pressure regulating range is 0.15 Mpa to 0.32 Mpa. Each time, a small amplitude of pressure regulation (for example, 0.05 MPa) is performed to simulate different sizes of leakage. The duration of each sound signal is 5.46 seconds, and the signal sampling frequency is 8000 Hz. Finally, the sound signal data is saved in the waveform audio file format (WAV), and these sound signal data will be marked as having leakage or no leakage. In this embodiment, the Z-score adaptive threshold algorithm is used to remove the sound signals affected by obvious noise, and finally 2364 sound signal data are retained, among which 1836 sound signals are marked as having leakage and 528 sound signals are marked as having no leakage.
[0069] Further, normalize the collected original vibration sound signal of the water supply pipeline to determine the normalized vibration sound signal of the water supply pipeline, and perform continuous wavelet transform processing on the normalized vibration sound signal of the water supply pipeline using the Morlet wavelet basis function to obtain the wavelet time-frequency diagram corresponding to the vibration sound signal of the water supply pipeline, so as to establish a wavelet time-frequency diagram data set;
[0070] Further, the collected original sound signal is processed by the maximum-minimum normalization method, and the maximum-minimum normalization formula is expressed as:
[0071]
[0072] where x is the original vibration sound signal of the water supply pipeline; min(x) is the minimum value of the vibration sound signal of the water supply pipeline; max(x) is the maximum value of the vibration sound signal of the water supply pipeline; and x' is the normalized vibration sound signal of the water supply pipeline.
[0073] Further, please refer toFigure 2 , the continuous wavelet transform is performed on the normalized vibration sound signal of the water supply pipeline using the Morlet wavelet basis function to obtain the wavelet time-frequency diagram corresponding to the vibration sound signal of the water supply pipeline. The formula for the continuous wavelet transform is as follows:
[0074]
[0075] where f(t) is the time-domain signal of the input vibration sound signal of the water supply pipeline; is the wavelet function; a is the scale parameter, controlling the scaling of the wavelet function; b is the translation parameter, controlling the position of the wavelet on the time axis; is the wavelet function is the function generated by scaling and translation; is the inner product of the time-domain signal and the wavelet function; W f (a, b) is the wavelet transform coefficient of the time-domain signal at the scale a and the translation position b.
[0076] The expression of the Morlet wavelet basis function is:
[0077]
[0078] where, is the Morlet wavelet basis function; π -1 / 4 is the normalization factor to ensure wavelet energy normalization; is the complex exponential term; is the Gaussian decay term, restricting the duration of the wavelet in the time domain.
[0079] Among them, the selection of the scale parameter a determines the sensitive range of the wavelet function to the signal frequency. The smaller the scale, the narrower the wavelet function, and the more effectively it can extract the high-frequency components in the signal; the larger the scale, the wider the wavelet function, and the more effectively it can extract the low-frequency components in the signal. In this embodiment, the scale parameter setting range is selected from 1 to 32. A feature matrix of [32, 8000] can be obtained.
[0080] Furthermore, the bilinear interpolation formula is used to scale the feature matrix extracted by the continuous wavelet transform; the bilinear interpolation formula can reduce the data volume while ensuring that the data quality is not affected, thereby accelerating the training time of the self-supervised learning model. The final obtained feature matrix has a shape of [32, 1000], and the bilinear interpolation formula is expressed as follows:
[0081] I′(x′, y′) = (1 - α)(1 - β)I(x1, y1) + α(1 - β)I(x2, y1) + (1 - α)β(x1, y2) + αβ(x2, y2).
[0082] Step S20, intercepting two wavelet time-frequency graphs from the same training sample as a positive sample pair, and intercepting wavelet time-frequency graphs of the same size as the positive sample pair from different training samples as a negative sample pair, using the positive sample pair and the negative sample pair, performing contrastive learning self-supervised training on a contrastive learning pre-training model of a preset water supply network leakage detection model, so that the contrastive learning pre-training model pre-trained to convergence is suitable for generating an equivalent wavelet time-frequency graph of the negative sample pair according to the positive sample pair;
[0083] Step S30, replacing the corresponding non-core wavelet time-frequency graph in the wavelet time-frequency graph in the training sample with the equivalent wavelet time-frequency graph and covering part of the core wavelet time-frequency graph in the wavelet time-frequency graph as the training sample, using the core wavelet time-frequency graph as the supervision label, and pre-training the masking completion pre-training model of the water supply network leakage detection model until convergence;
[0084] Step S40, using the wavelet time-frequency graph in the training sample as the training sample, using the sample label corresponding to the wavelet time-frequency graph as the supervision label, and performing fine-tuning training on the fine-tuning model of the water supply network leakage detection model until a convergence state is reached, so as to complete the training of the water supply network leakage detection model;
[0085] After obtaining the sample training set, two wavelet time-frequency graphs are intercepted from the same training sample as a positive sample pair, and wavelet time-frequency graphs of the same size as the positive sample pair are intercepted from different training samples as negative sample pairs. The positive sample pairs and the negative sample pairs are used to perform contrastive learning self-supervised training on the contrastive learning pre-training model of the preset water supply network leakage detection model, so that the contrastive learning pre-training model pre-trained to convergence is suitable for generating equivalent wavelet time-frequency graphs of the negative sample pair according to the positive sample pair; please refer to Figure 3 ,Specifically, two wavelet time-frequency graphs can be intercepted from each training sample as ,positive sample pairs, and wavelet time-frequency graphs of the same size as the ,positive sample pairs can be randomly intercepted from five training samples as ,negative sample pairs.
[0086] The equivalent wavelet time-frequency graph is used to replace the corresponding non-core wavelet time-frequency graph in the wavelet time-frequency graph in the training sample and to cover part of the core wavelet time-frequency graph in the wavelet time-frequency graph as the training sample, and the core wavelet time-frequency graph is used as the supervision label to pre-train the masking completion pre-training model of the water supply network leakage detection model until the convergence state; please refer to Figure 4, specifically, the traversal method can be used to find the 15 columns with the largest amplitudes in the wavelet time-frequency diagram. Taking the selected 15 columns as the center, randomly cover 3 to 7 columns around the central column to cover a part of the core wavelet time-frequency diagram in the wavelet time-frequency diagram as a training sample; using the wavelet time-frequency diagram in the training sample as a training sample and the sample label corresponding to the wavelet time-frequency diagram as a supervision label, perform fine-tuning training on the fine-tuning model of the water supply network leakage detection model until it converges to complete the training of the water supply network leakage detection model;
[0087] In some embodiments, please refer to Figure 5 , the basic network architecture of the water supply network leakage detection model is a self-supervised learning model, and the self-supervised learning model includes a contrastive learning pre-training model, a masked completion pre-training model, and a fine-tuning model.
[0088] In a further embodiment, the contrastive learning pre-training model includes a first encoder and a first decoder. Among them, the first encoder includes a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer, and three residual blocks. Among them, each residual block is followed by a self-attention mechanism layer; the first decoder is constructed by a global average pooling layer and a fully connected layer.
[0089] Specifically, the first encoder first performs feature extraction through a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer. Subsequently, the first encoder passes through three residual blocks, and the number of feature channels is sequentially increased from 16 to 32, 64, and 128. Among them, each residual block is followed by a self-attention mechanism layer;
[0090] The output of the convolutional layer can be expressed by the following formula:
[0091] O conv =(I·K)+b,
[0092] where, O conv is the output of the convolutional layer; I is the input wavelet time-frequency diagram; K is the convolutional kernel; b is the bias term.
[0093] The batch normalization layer normalizes the output of the convolutional layer, and the formula is as follows:
[0094]
[0095] where, O conv is the output of the convolutional layer; O BN is the output of the batch normalization layer; μ is the mean of the batch data; σ 2 is the variance of the batch data; γ is the scaling parameter (learnable); β is the offset parameter (learnable); ∈ is a constant to prevent division by zero.
[0096] The formula of the ReLU activation function is:
[0097] O ReLU = max(0, O BN ),
[0098] where O ReLU is the output of the ReLU activation function; max(0, O BN ) is the ReLU activation function, which will set negative values to 0 and retain positive values.
[0099] The max pooling layer downsamples the feature map, and the formula is:
[0100] O pool (i,j) = max[O ReLU (i + k,j + l)]; (k,l) ∈ window,
[0101] where O pool (i,j) is the output value at the position (i,j) after the pooling operation; window is the pooling window size (3×3); (i,j) is the position of the output feature map; (k,l) is the position within the pooling window.
[0102] The residual block consists of a convolutional layer, a batch normalization layer, and a ReLU activation function. The input X passes through multiple functions to obtain F(X), and the final output of the residual block is X + F(X).
[0103] The formula of the self-attention mechanism is as follows:
[0104]
[0105] where W Q is the query weight matrix; W K is the key weight matrix; W V is the value weight matrix; X is the input matrix.
[0106] For the contrastive learning pre-training model, a first decoder is constructed. The structure of the first decoder consists of a global average pooling layer and a fully connected layer. In this embodiment, the contrastive loss is used as the loss function of the decoder. Among them, the formula of the contrastive loss is expressed as follows:
[0107]
[0108] where z i and z jis the feature representation of positive sample pairs; sim is the similarity function, using cosine similarity; exp is the natural exponential function, converting the similarity into exponential form; τ is the temperature parameter, used to adjust the scale of similarity; N is the number of negative samples.
[0109] In a further embodiment, the masked completion pre-training model includes a second encoder and a second decoder, wherein the second encoder includes a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer, and three residual blocks, and a self-attention mechanism layer is connected behind each residual block; the first decoder is constructed by multiple transposed convolutional layers.
[0110] Specifically, the second encoder first extracts features through a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer. Subsequently, the second encoder passes through three residual blocks, increasing the number of feature channels from 16 to 32, 64, and 128 in sequence, and a self-attention mechanism layer is connected behind each residual block;
[0111] The output of the convolutional layer can be expressed by the following formula:
[0112] O conv =(I·K)+b,
[0113] where, O conv is the output of the convolutional layer; I is the input wavelet time-frequency map; K is the convolutional kernel; b is the bias term.
[0114] The batch normalization layer normalizes the output of the convolutional layer, and the formula is as follows:
[0115]
[0116] where, O conv is the output of the convolutional layer; O BN is the output of the batch normalization layer; μ is the mean of the batch data; σ 2 is the variance of the batch data; γ is the scaling parameter (learnable); β is the offset parameter (learnable); ε is a constant to prevent division by zero.
[0117] The formula of the ReLU activation function is:
[0118] OReLU(i,j)=max(0,O BN ),
[0119] where, O ReLU is the output of the ReLU activation function; max(0,O BN ) is the ReLU activation function, and the ReLU activation function will set negative values to 0 and retain positive values.
[0120] The max pooling layer downsamples the feature map, and the formula is as follows:
[0121] O pool (i,j) = max[O ReLU (i + k,j + l)]; (k,l) ∈ window,
[0122] where, O pool (i,j) is the output value at the position (i,j) after the pooling operation; window is the pooling window size (3×3); (i,j) is the position of the output feature map; O ReLU (i + k,j + l) is the input feature map after being activated by the ReLU function, and the activation value at the position (i + k,j + l); (k,l) is the position within the pooling window.
[0123] The residual block consists of a convolutional layer, a batch normalization layer, and a ReLU activation function. The input X passes through multiple functions to obtain F(X), and the final output of the residual block is X + F(X).
[0124] The formula for the self-attention mechanism is as follows:
[0125]
[0126] where, W Q is the query weight matrix; W K is the key weight matrix; W V is the value weight matrix; X is the input matrix; is the scaling factor, which suppresses the vanishing gradient caused by too large dot product values; softmax is the normalization function, which normalizes the attention score matrix along the row direction to obtain the probability distribution; SelfAttention(X) is the self-attention result.
[0127] For the masked completion pre-training model, a second decoder is constructed. The second decoder consists of multiple transposed convolutional layers. The transposed convolutional layer is the inverse process of the convolutional layer. In this embodiment, the transposed convolutional layers of the decoder gradually reduce the number of feature channels from 128 to 64, 32, 16, and finally to 1. The mean squared error loss is used as the loss function of the decoder. Among them, the formula for the mean squared error loss is expressed as:
[0128]
[0129] where, N is the number of samples; Model is the combination of the second encoder and the second decoder; x masked is the masked feature matrix; x original is the original complete feature matrix.
[0130] In a further embodiment, taking the wavelet time-frequency diagram in the training samples as the training samples and the sample labels corresponding to the wavelet time-frequency diagrams as the supervision labels, the steps of fine-tuning and training the fine-tuning model of the water supply network leakage detection model to a convergence state include:
[0131] Step S401: Train the contrastive learning pre-trained model and the masked completion pre-trained model using the sample data set with the sample labels removed. Use error backpropagation to send the loss values of the first encoder and the second encoder back to the water supply network leakage detection model, and adjust the parameters of the encoder in the water supply network leakage detection model structure until the water supply network leakage detection model converges;
[0132] Step S402: Take the wavelet time-frequency diagram in the training samples as the training samples and the sample labels corresponding to the wavelet time-frequency diagrams as the supervision labels, and perform fine-tuning training on the fine-tuning model until it reaches a convergence state.
[0133] Specifically, please refer to Figure 6 , use the data set with labels removed to train the pre-trained model, use error backpropagation to send the loss values of the two encoders back to the model, and adjust the parameters in the model structure until the model converges; freeze the weights of the first encoder of the contrastive learning pre-trained model and the weights of the second encoder of the masked completion pre-trained model, and connect two convolutional blocks, two fully connected layers, and a Sigmoid activation function to construct the fine-tuning model of the water supply network leakage detection model. Use the labeled sample data set to fine-tune the fine-tuning model, use the cross-entropy function as the loss function, and use error backpropagation to optimize the parameters of the model;
[0134] The calculation formula of the cross-entropy function is expressed as follows:
[0135]
[0136] where y is the actual label; is the probability that the model predicts that the sample belongs to the positive class (no leakage).
[0137] During the training process, five performance metrics, namely accuracy, precision, recall, F1-score, and Matthews correlation coefficient (MCC), can be used to evaluate the detection accuracy and performance of the model to ensure that the model can accurately identify the leakage state;
[0138] The performance evaluation metric formulas are as follows:
[0139]
[0140] where TP is true positive; TN is true negative; FP is false positive; FN is false negative.
[0141] In summary, the contrastive learning pre-training model and the masked completion pre-training model are trained using the sample dataset with the sample labels removed. The loss values of the first encoder and the second encoder are propagated back to the water supply network leakage detection model using error backpropagation to adjust the parameters of the encoders in the water supply network leakage detection model structure until the water supply network leakage detection model converges. Using the wavelet time-frequency diagram in the training samples as the training samples and the sample labels corresponding to the wavelet time-frequency diagrams as the supervision labels, the fine-tuning model is fine-tuned until it converges. After the water supply network leakage detection model is fine-tuned to the convergence state, it can be used to detect whether the water supply pipeline is in a leaking state or a non-leaking state.
[0142] Step S50: Input the vibration sound signal of the water supply pipeline to be detected into the water supply network leakage detection model that has been trained to the convergence state to determine whether the water supply pipeline to be detected is in a leaking state or a non-leaking state, so as to complete the leakage detection of the water supply network.
[0143] After the water supply network leakage detection model is fine-tuned to the convergence state, input the vibration sound signal of the water supply pipeline to be detected into the water supply network leakage detection model that has been trained to the convergence state to determine whether the water supply pipeline to be detected is in a leaking state or a non-leaking state, so as to complete the leakage detection of the water supply network.
[0144] Specifically, collect the vibration sound signals of the water supply pipeline to be detected and perform wavelet transform on these signals to generate corresponding wavelet time-frequency diagrams. These time-frequency diagrams show the distribution of the signals in time and frequency, providing key information for subsequent detection tasks. Use the generated wavelet time-frequency diagrams as input and input them into the water supply network leakage detection model that has been trained and fine-tuned to the convergence state. This model has learned on a large amount of labeled training data and can automatically judge whether the pipeline is in a leaking state based on the input time-frequency diagrams. After the forward inference process of the model, the model will output a binary classification result: leaking or non-leaking. This judgment is based on the mapping relationship between the feature representations learned during the training process and the leaking state. According to the result output by the model, the system can make corresponding decisions. For example: if the model judges "non-leaking", the system will record it as the normal state and continue to monitor the operation of the pipeline. If the model judges "leaking", the system will trigger an alarm to prompt relevant personnel to conduct further inspections and maintenance. In addition, the detection results can be combined with the data of other monitoring devices (such as pressure sensors, flow meters, etc.) to further verify the accuracy of the leakage and the specific location of the leakage. In practical applications, the system will continuously collect new data and periodically retrain or fine-tune the model to adapt to changes in the pipeline network conditions and new leakage patterns, ensuring the accuracy and reliability of the water supply network leakage detection model.
[0145] As can be seen from the above embodiments, compared with the prior art, in view of the problems in the prior art that the training of machine learning models relies on a large amount of labeled data, while the occurrence frequency of leakage events in actual scenarios is relatively low, resulting in scarce leakage data and high labeling costs, which severely restricts the generalization ability of the models, the present application includes but is not limited to the following beneficial effects:
[0146] First, the present application improves the signal capture ability through multi-resolution time-frequency analysis. Traditional leakage signal detection methods (such as acoustic methods) often face the limitation of fixed window resolution and cannot effectively capture the high-frequency transient features and low-frequency continuous modes in leakage signals. However, the present application uses continuous wavelet transform (CWT) to perform multi-resolution time-frequency analysis on the vibration sound signals of water supply pipe networks, enabling more accurate identification of leakage signals. This method can not only capture the high-frequency transient changes during the leakage process but also track the continuous features of leakage in the low-frequency band, thus comprehensively improving the detection accuracy of leakage signals.
[0147] Second, the present application greatly reduces the dependence on labeled data and improves the generalization ability. Existing leakage detection methods often rely on a large amount of labeled data for training. However, the occurrence frequency of leakage events in the actual environment is relatively low, resulting in scarce data and high labeling costs. To address this issue, the present application proposes using unlabeled data for self-supervised learning. Specifically, a self-supervised learning framework is constructed through two pre-training tasks: contrastive learning and masked completion, enabling the model to learn the time-frequency correlation characteristics of leakage signals from unlabeled data, significantly reducing the dependence on manually labeled data. This approach not only reduces labor costs but also improves the adaptability and generalization ability of the leakage detection system in different scenarios.
[0148] Third, the present application innovatively combines the dual pre-training tasks of masked completion and contrastive learning, enabling the model to self-learn the characteristics of leakage signals during the pre-training stage. Through contrastive learning, the model can learn the similarities and differences between positive and negative samples, which helps improve the model's ability to distinguish leakage signals; while through the masked completion task, the model can learn to fill in the missing parts of the signals, thereby improving its robustness and accuracy. This self-supervised learning framework enhances the model's adaptive ability, especially in the case of a lack of a large amount of labeled data, and still enables effective learning and identification.
[0149] Fourth, due to the relatively low occurrence frequency of leakage events in actual scenarios and the difficulty in obtaining leakage data, the labeling workload is large and the cost is high. By introducing self-supervised learning with unlabeled data, the present application significantly reduces the need for manually labeled data, making leakage detection more efficient. Even in the case of scarce labeled data, the model can still be accurately trained and identified, improving the work efficiency of water supply pipe network leakage detection.
[0150] Fifthly, the present application significantly improves the model generalization ability and adapts to diverse actual scenarios. By combining different types of training data (including signal data under different pipe materials, pipe ages, and water pressure scenarios), and through the design of a self-supervised learning framework, the present application enhances the generalization ability of the model in diverse actual environments. Whether it is a newly built pipe network, an aging pipe network, or a water supply pipe network under different water pressure environments, the trained model can effectively identify leakage signals, ensuring that the leakage detection technology can adapt to more complex actual scenarios.
[0151] Sixthly, the present application finally establishes an intelligent identification model for leakage sound signals in water supply pipe networks, which can effectively improve the automation level of leakage detection in water supply pipe networks. Such an intelligent detection system can not only monitor the leakage situation of water supply pipe networks in real time, but also predict potential pipeline failures (such as safety accidents like water pipe bursts) in advance, thereby greatly reducing the occurrence probability of safety accidents. This will effectively reduce maintenance costs, improve water supply security, and avoid greater disasters and economic losses caused by the failure to detect leakage in a timely manner.
[0152] In summary, the present application can effectively improve the accuracy and efficiency of leakage detection in water supply pipe networks, reduce the dependence on manually labeled data, enhance the generalization ability of the model in different pipe network scenarios, and at the same time promote the development of leakage detection in water supply pipe networks towards intelligence and automation.
[0153] Please refer to Figure 7, A water supply pipeline leakage detection device provided to meet one of the purposes of the present application, including a training set acquisition module 1100, a contrast learning training module 1200, a masking and completion training module 1300, a fine-tuning model training module 1400, and a pipeline leakage detection module 1500. Among them, the training set acquisition module 1100 is configured to acquire a sample training set, where the sample training set includes a plurality of training samples, and the training samples include wavelet time-frequency diagrams corresponding to the vibration sound signals of the water supply pipeline and their corresponding sample labels. The sample labels represent the leakage states corresponding to the water supply pipeline, and the wavelet time-frequency diagrams include core wavelet time-frequency diagrams and non-core wavelet time-frequency diagrams; the contrast learning training module 1200 is configured to intercept two segments of wavelet time-frequency diagrams from the same training sample as a positive sample pair, and intercept wavelet time-frequency diagrams of the same size as the positive sample pair from different training samples as a negative sample pair. Using the positive sample pair and the negative sample pair, perform contrast learning self-supervised training on the contrast learning pre-training model of the preset water supply pipeline leakage detection model, so that the contrast learning pre-training model pre-trained to convergence is suitable for generating an equivalent wavelet time-frequency diagram of the negative sample pair according to the positive sample pair; the masking and completion training module 1300 is configured to replace the corresponding non-core wavelet time-frequency diagram in the wavelet time-frequency diagram in the training sample with the equivalent wavelet time-frequency diagram and cover a part of the core wavelet time-frequency diagram in the wavelet time-frequency diagram as a training sample, and use the core wavelet time-frequency diagram as a supervision label to perform pre-training on the masking and completion pre-training model of the water supply pipeline leakage detection model until it converges; the fine-tuning model training module 1400 is configured to use the wavelet time-frequency diagram in the training sample as a training sample, and use the sample label corresponding to the wavelet time-frequency diagram as a supervision label to perform fine-tuning training on the fine-tuning model of the water supply pipeline leakage detection model until it converges to complete the training of the water supply pipeline leakage detection model; the pipeline leakage detection module 1500 is configured to input the vibration sound signal of the water supply pipeline to be detected into the water supply pipeline leakage detection model that has been trained to convergence to determine whether the water supply pipeline to be detected is in a leakage state or a non-leakage state, so as to complete the leakage detection of the water supply pipeline.
[0154] Based on any embodiment of the present application, please refer to FIG. 8. Another embodiment of the present application further provides an electronic device, which can be implemented by a computer device, such as Figure 8As shown in the figure, it is a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected by a system bus. Among them, the computer-readable storage medium of the computer device stores an operating system, a database, and computer-readable instructions. The database can store a control information sequence. When the computer-readable instructions are executed by the processor, the processor can implement a water supply network leakage detection method. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device can store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the water supply network leakage detection method of this application. The network interface of the computer device is used to connect and communicate with the terminal. Those skilled in the art can understand that Figure 8 The structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0155] In this embodiment, the processor is used to execute Figure 7 the specific functions of each module in the figure. The memory stores the program code and various types of data required to execute the above modules or sub-modules. The network interface is used for data transmission between the user terminal and the server. The memory in this embodiment stores the program code and data required to execute all modules in the water supply network leakage detection device of this application. The server can call the program code and data of the server to execute the functions of all modules.
[0156] This application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors are caused to execute the steps of the water supply network leakage detection method described in any embodiment of this application.
[0157] This application also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by one or more processors, the steps of the water supply network leakage detection method described in any embodiment of this application are implemented.
[0158] Those of ordinary skill in the art can understand that all or part of the processes in the above-described embodiments of the present application can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-described methods. Among them, the aforementioned storage medium can be a computer-readable storage medium such as a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM), etc.
[0159] The above are only some embodiments of the present application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.
Claims
1. A method for detecting water leakage in a water supply network, characterized in that, Including: Obtain a sample training set, where the sample training set includes a plurality of training samples, and each training sample includes a wavelet time-frequency diagram corresponding to the vibration sound signal of the water supply pipe and its corresponding sample label. The sample label represents the leakage state corresponding to the water supply pipe, and the wavelet time-frequency diagram includes a core wavelet time-frequency diagram and a non-core wavelet time-frequency diagram; Intercept two segments of wavelet time-frequency diagrams from the same training sample as a positive sample pair, and intercept wavelet time-frequency diagrams of the same size as the positive sample pair from different training samples as a negative sample pair. Use the positive sample pair and the negative sample pair to perform contrastive learning self-supervised training on a contrastive learning pre-training model of a preset water supply network leakage detection model, so that the contrastive learning pre-training model pre-trained to convergence is suitable for generating an equivalent wavelet time-frequency diagram of the negative sample pair according to the positive sample pair; Replace the corresponding non-core wavelet time-frequency diagram in the wavelet time-frequency diagram of the training sample with the equivalent wavelet time-frequency diagram and cover a part of the core wavelet time-frequency diagram in the wavelet time-frequency diagram as a training sample, and use the core wavelet time-frequency diagram as a supervision label to perform pre-training on the masking and completion pre-training model of the water supply network leakage detection model until it converges; Use the wavelet time-frequency diagram in the training sample as a training sample, and use the sample label corresponding to the wavelet time-frequency diagram as a supervision label to perform fine-tuning training on the fine-tuning model of the water supply network leakage detection model until it converges, so as to complete the training of the water supply network leakage detection model; Input the vibration sound signal of the water supply pipe to be detected into the water supply network leakage detection model that has been trained to converge to determine whether the water supply pipe to be detected is in a leakage state or a non-leakage state, so as to complete the leakage detection of the water supply network.
2. The water supply network leakage detection method according to claim 1, characterized in that The basic network architecture of the water supply network leakage detection model is a self-supervised learning model, and the self-supervised learning model includes a contrastive learning pre-training model, a masking and completion pre-training model, and a fine-tuning model.
3. The water supply network leakage detection method according to claim 2, characterized in that, The contrastive learning pre-training model includes a first encoder and a first decoder. The first encoder includes a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer, and three residual blocks. A self-attention mechanism layer is connected behind each residual block; the first decoder is constructed by a global average pooling layer and a fully connected layer.
4. The method for detecting water leakage in a water supply network according to claim 2, wherein, The masking and completion pre-training model includes a second encoder and a second decoder. The second encoder includes a convolutional block constructed by a convolutional layer, a batch normalization layer, a ReLU activation function, and a max pooling layer, and three residual blocks. A self-attention mechanism layer is connected behind each residual block; the first decoder is constructed by a plurality of transposed convolutional layers.
5. The water supply network leakage detection method according to any one of claims 2 to 4, characterized in that, Freeze The weights of the first encoder of the contrastive learning pre-training model and the weights of the second encoder of the masking and completion pre-training model, and connect two convolutional blocks, two fully connected layers, and a Sigmoid activation function to construct the fine-tuning model of the water supply network leakage detection model.
6. The method for detecting leakage in a water supply pipe network according to claim 5, wherein Taking the wavelet time-frequency diagram in the training samples as the training samples and the sample labels corresponding to the wavelet time-frequency diagrams as the supervision labels, the steps of fine-tuning the fine-tuning model of the water supply network leakage detection model until it converges include: Training the contrastive learning pre-training model and the masked completion pre-training model using the sample data set with the sample labels removed, and using error backpropagation to transmit the loss values of the first encoder and the second encoder back to the water supply network leakage detection model, and adjusting the parameters of the encoder in the water supply network leakage detection model structure until the water supply network leakage detection model converges; Taking the wavelet time-frequency diagram in the training samples as the training samples and the sample labels corresponding to the wavelet time-frequency diagrams as the supervision labels, and performing fine-tuning training on the fine-tuning model until it converges.
7. The water supply network leakage detection method according to claim 1, characterized in that, The steps of obtaining the sample training set include: Collecting the vibration sound signals of each water supply pipeline in the water supply network and marking the leakage states of the water supply pipelines to determine the sample labels, where the sample labels are characterized as having a leakage state or no leakage state; Normalizing the vibration sound signals of the water supply pipelines to determine the normalized vibration sound signals of the water supply pipelines, and performing continuous wavelet transform on the normalized vibration sound signals of the water supply pipelines using the Morlet wavelet basis function to determine the wavelet time-frequency diagrams corresponding to the vibration sound signals of the water supply pipelines; Constructing the sample training set according to the wavelet time-frequency diagrams corresponding to the vibration sound signals of the water supply pipelines and their corresponding sample labels.
8. A water supply network leakage detection device, characterized in that, Including: A training set acquisition module configured to acquire a sample training set, where the sample training set includes a plurality of training samples, the training samples include the wavelet time-frequency diagrams corresponding to the vibration sound signals of the water supply pipelines and their corresponding sample labels, the sample labels characterize the leakage states corresponding to the water supply pipelines, and the wavelet time-frequency diagrams include core wavelet time-frequency diagrams and non-core wavelet time-frequency diagrams; A contrastive learning training module configured to intercept two segments of wavelet time-frequency diagrams from the same training sample as a positive sample pair, and intercept wavelet time-frequency diagrams of the same size as the positive sample pair from different training samples as a negative sample pair, and using the positive sample pair and the negative sample pair to perform contrastive learning self-supervised training on the contrastive learning pre-training model of the preset water supply network leakage detection model, so that the contrastive learning pre-training model pre-trained to convergence is adapted to generate an equivalent wavelet time-frequency diagram of the negative sample pair according to the positive sample pair; A masked completion training module configured to replace the corresponding non-core wavelet time-frequency diagrams in the wavelet time-frequency diagrams in the training samples with the equivalent wavelet time-frequency diagrams and cover part of the core wavelet time-frequency diagrams in the wavelet time-frequency diagrams as the training samples, and using the core wavelet time-frequency diagrams as the supervision labels, and performing pre-training on the masked completion pre-training model of the water supply network leakage detection model until it converges; The fine-tuning model training module is configured to use the wavelet time-frequency diagram in the training samples as the training samples, and the sample labels corresponding to the wavelet time-frequency diagrams as the supervision labels, and perform fine-tuning training on the fine-tuning model of the water supply network leakage detection model until it converges, so as to complete the training of the water supply network leakage detection model; The pipeline leakage detection module is configured to input the vibration sound signal of the water supply pipeline to be detected into the water supply network leakage detection model that has been trained to a convergent state, so as to determine whether the water supply pipeline to be detected is in a leakage state or a non-leakage state, so as to complete the leakage detection of the water supply network.
9. An electronic device, comprising a central processing unit and a memory, characterized in that, The central processing unit is used to call and run the computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program implemented according to the method according to any one of claims 1 to 7 in the form of computer-readable instructions. When the computer program is called and run by the computer, it executes the steps included in the corresponding method.
Citation Information
Patent Citations
Transformer composite fault diagnosis method, device and equipment and storage medium
CN115792729A
Image invisible area completion method based on non-modal instance segmentation
CN117115445A
Multi-source remote sensing image classification method based on spatial continuous view contrast learning
CN117765313A
Self-supervised learning driver distraction behavior detection method
CN118570779A
Method, device and equipment for detecting series arc fault of low-voltage power distribution network and medium
CN118641896A