Water supply network leakage detection method based on federal learning
By combining federated learning and USAD, the problem of insufficient data in water supply network leak detection was solved, enabling accurate leak detection under different data distribution conditions and improving the robustness and generalization ability of the detection.
Patent Information
- Application Number
- CN202411770194.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-01-28
AI Technical Summary
Existing technologies for leak detection in water supply networks suffer from limitations in the quality and quantity of datasets, which restricts the performance of machine learning algorithms. Furthermore, the lack of a reliable data asset rights confirmation scheme limits data exchange between different networks, making accurate leak detection difficult.
A federated learning-based method for detecting leaks in water supply networks is adopted. A global federated learning model is established on the server, while the client performs local training and data upload. The server optimizes weights and aggregates the model, and uses USAD input to reconstruct training and adversarial training to improve the model's generalization ability and robustness.
Despite limited available datasets, this study achieves accuracy and robustness in detecting leaks in water supply networks, enhances the dataset's ability to generalize anomalies, and improves the performance and adaptability of the detection framework.
Smart Images

Figure CN119374044A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of water supply network leakage detection, and in particular relates to a water supply network leakage detection method based on federated learning. Background Art
[0002] The water supply network is a complex system that is difficult to monitor and manage. Pipes in the water supply network may leak due to improper pipe materials, weak joints between pipes, internal and external corrosion, seasonal temperature changes, etc. When leaks occur, not only will they cause economic losses, but another worrying issue is the worldwide water shortage and the challenges brought by population growth, which will affect half of the world's population without access to safe drinking water to meet basic needs. The water supply network of a medium-sized city can have pipes spanning hundreds of kilometers connected to hundreds of nodes (pipeline joints or customers in the network). Water losses can be divided into two parts, one caused by reading errors, data processing errors and illegal water withdrawals, and the other includes leaks in system components and overflows of storage tanks. According to the standard water balance method proposed by IWA / AWWA (International Water Association / American Water Works Association), the losses due to leakage in many water projects are estimated to be as high as 27% of the water extracted. It is crucial to use advanced technology to detect leaks in WDNs in a timely and effective manner to minimize water losses.
[0003] The performance of machine learning algorithms will be significantly affected by the quality and quantity of data sets. In actual pipeline networks, due to the lack of leakage incidents, improper data collection, and high collection costs, the available real pipeline network data is insufficient in most cases. Data privacy requirements prevent data centers from providing data to third parties at will, and there is a lack of reliable data asset rights confirmation solutions in the process of processing data. Many government departments are also reluctant to share pipeline network data, which limits data exchange between different pipeline networks. Summary of the invention
[0004] The purpose of the present invention is to provide a water supply network leakage detection method based on federated learning, which can achieve accurate water supply network leakage detection when there are fewer available data sets.
[0005] The technical solution provided by the present invention is:
[0006] A water supply network leakage detection method based on federated learning includes the following steps:
[0007] Step 1: The server establishes a federated learning global model, initializes the federated learning global model parameters and the client weight distribution vector, and distributes the federated learning global model parameters;
[0008] Step 2: The client receives the federated learning global model parameters, and uses local data to perform local training based on USAD to obtain the federated learning local model parameters and upload them to the server;
[0009] Step 3: The server inputs the pipeline network data set to be detected into the federated learning local model parameters, and obtains the optimal weight update weight by minimizing the cross loss entropy; the server aggregates the federated learning local model parameters according to the weight to obtain updated federated learning global model parameters;
[0010] If the federated learning global model has not converged or has not reached a preset number of iterations, the server distributes the updated federated learning global model parameters to each of the clients; repeating steps 2 to 3 until the federated learning global model converges or reaches a preset number of iterations, thereby obtaining an optimized federated learning global model;
[0011] Step 4: The server inputs the pipeline network data set to be detected into the optimized federated learning global model to obtain an abnormality score in the detection phase, and determines whether a leak is detected according to the abnormality score in the detection phase.
[0012] Preferably, the client uses data sets from water supply networks in different regions or different systems as local data.
[0013] Preferably, the local training based on USAD includes: input reconstruction training and adversarial training; the overall training objectives of the two autoencoders are:
[0014]
[0015] in, is the loss function of the first autoencoder; is the loss function of the second autoencoder; n is the total number of training rounds; W is the input window; AE1(W) is the output value of the first autoencoder; AE2(W) is the output value of the second autoencoder.
[0016] Preferably, the input reconstruction training is that two autoencoders compress the input pressure data into a latent space, and then reconstruct it by two autoencoders; the training objectives of the two autoencoders in the input reconstruction training are:
[0017]
[0018] in, Loss function for training the first autoencoder for input reconstruction; Loss function for training the second autoencoder for input reconstruction.
[0019] Preferably, the adversarial training is to train the second autoencoder to distinguish between real data and data from the first autoencoder, and to train the first autoencoder to deceive the second autoencoder; the objective function is:
[0020] f(θ)=||W-AE2[AE1(W)]||2
[0021] Among them, f(θ) is the loss function; θ is the model parameter;
[0022] The training objectives are:
[0023] According to the objective function, the training objectives of the two autoencoders in the adversarial training are:
[0024]
[0025] in, Loss function for adversarial training of the first autoencoder; Loss function for adversarial training of the second autoencoder.
[0026] Preferably, the calculation formula of the cross loss entropy is:
[0027]
[0028] Among them, χ is the prediction result after weight allocation; ω is the label matrix of the pipeline network data set to be detected; J is the total data of the pipeline network data set to be detected; γ is the customer weight allocation vector; M is the prediction result matrix of all clients.
[0029] Preferably, the formula for updating the weights by minimizing the cross loss entropy is:
[0030]
[0031] Among them, γ * is the optimal weight; is the optimal weight of the kth client.
[0032] Preferably, the formula for the server to aggregate the parameters of the federated learning local model according to the weight is:
[0033]
[0034] Among them, θ i+1 is the global model parameter of federated learning after the i-th round of aggregation, is the federated learning local model parameter of the k-th client after the i-th round of training; K is the total number of clients.
[0035] Preferably, the calculation formula for the abnormality score in the detection stage is:
[0036]
[0037] in, is the anomaly score; α is the anomaly score coefficient for input reconstruction training; β is the anomaly score coefficient for adversarial training.
[0038] The beneficial effects of the present invention are:
[0039] The water supply network leakage detection method based on federated learning provided by the present invention can realize accurate water supply network leakage detection when there are fewer available data sets; the data set used for leakage detection is enhanced, so that the leakage detection framework has a stronger abnormal generalization ability, and the robustness of the detection framework is improved, which is helpful to accurately detect and identify leakage in various abnormal scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is an overall flow chart of the water supply network leakage detection method based on federated learning described in the present invention.
[0041] Figure 2 This is a flowchart of the local training based on USAD described in the present invention.
[0042] Figure 3 This is the pipeline layout diagram of the Anytown network.
[0043] Figure 4 This is the pipeline layout diagram of KY-1 and KY-3.
[0044] Figure 5 This is the pipeline network layout diagram for KY-2, KY-4, KY-5, KY-7 and KY-9.
[0045] Figure 6 This is the pipeline layout diagram of the New York tunnel system.
[0046] Figure 7 This is the pipe network layout diagram for the EPANET Net 2 system, EPANET Net 3 system, and EPANET Net 6 system.
[0047] Figure 8 This is a detection result diagram when the pipeline network to be detected described in the present invention cannot provide historical data to train the anomaly detection model.
[0048] Fig. 9 A graph of detection results when a small amount of historical data is provided to the pipe network to be detected in the present invention to train an anomaly detection model.
[0049] Fig.10This is the influence diagram of sensitivity threshold on detection results. DETAILED DESCRIPTION
[0050] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.
[0051] like Figure 1-2 As shown, the present invention provides a water supply network leakage detection method based on federated learning, and the specific implementation process is as follows:
[0052] Step 1: The server establishes a global federated learning model and initializes the global federated learning model parameters θ i and customer weight distribution vector γ = [q1,q2,...,q K ] (set all client weights to the same value) and distribute the federated learning global model parameters θ i .
[0053] Step 2: The client uses water supply networks from different regions or different systems (WDN1, WDN2,..., WDN K ) of the dataset (W1,W2,...,W K ) as local data input, breaking data silos through the federated learning mechanism, strengthening the generalization and robustness of the model, and improving the universality of leakage detection for complex pipe network systems; each of the above clients (Client1, Client2, ..., Client K ) receives the federated learning global model parameter θ i The client uses the local data to perform the USAD-based local training to obtain the federated learning local model parameters that match the local data characteristics. And upload it to the server to realize local knowledge extraction and sharing preparation.
[0054] Step 3: The server sends the pipe network dataset W to be detected s Input to the federated learning local model parameters The corresponding label matrix is obtained from , and then the cross loss entropy is calculated, and the optimal weight is obtained by minimizing the cross loss entropy, thereby obtaining an updated weight; the server aggregates the local model parameters of the federated learning according to the updated weight to obtain an updated global model parameter θ of the federated learning i+1 ; Effectively integrate global knowledge, improve detection performance, and enhance the prediction accuracy of the federated learning global model;
[0055] Among them, on the server side, the client's global loss function is defined as:
[0056]
[0057] Among them, q k is the weight of the kth client; θ i+1 is the global model parameter of federated learning after the i-th round of aggregation; The federated learning local model parameters of the k-th client after the i-th round of training is completed;
[0058] Most of the data in a single water supply network usually have similar characteristics. If there are many such network data, due to the negative impact of statistical heterogeneity and system heterogeneity on federated learning, according to q k The calculation formula of q is likely to result in poor aggregate model effect, so in the method we use k Modifications were made to adjust weights to minimize cross-loss entropy to optimize aggregation, so that the predicted local distribution is closest to the global distribution and the impact of heterogeneity on the global model is reduced; the global loss function of the client is calculated so that the server can comprehensively consider the performance of each client's model on the unified data set, and then perform subsequent weight optimization and model aggregation operations to improve the performance and generalization ability of the global model;
[0059] The server has the pipe network dataset W to be detected s The total amount of data is J, and each piece of data has a unique corresponding label L j , the matrix containing all data labels is recorded as ω=[L 1 ,L 2 ,...,L J ] T ; W j is the dataset W s A data sample in j Federated learning local model parameters input to the client The obtained label is recorded as Then W s All data is input to the client's local model parameters for federated learning The resulting label matrix is The above operation is performed on all the federated learning local model parameters uploaded to the server to obtain the label matrix of all client models as M = [M1, M2, ..., M k ];
[0060] The calculation formula of the cross loss entropy is:
[0061]
[0062] Among them, χ is the prediction result after weight allocation; ω is the label matrix of the pipeline network data set to be detected; J is the total amount of data in the pipeline network data set to be detected; γ is the customer weight allocation vector; M is the prediction result matrix of all clients;
[0063] H(χ,ω) reflects the prediction loss under the current weight distribution vector. The formula for the optimal weight can be obtained by minimizing the cross loss entropy:
[0064]
[0065] Among them, γ * is the optimal weight; is the optimal weight of the kth client. After optimizing the weight distribution, the client contribution is balanced, and the global model's adaptability to diverse data distribution and detection reliability are improved;
[0066] The server aggregates the federated learning local model parameters according to the updated weights to obtain updated federated learning global model parameters θ i+1 The formula is:
[0067]
[0068] Among them, θ i+1 is the global model parameter of federated learning after the i-th round of aggregation, and K is the total number of clients.
[0069] If the federated learning global model has not converged or has not reached a preset number of iterations, the server distributes the updated federated learning global model parameters to each of the clients; repeats steps 2 to 3 until the federated learning global model converges or reaches a preset number of iterations, thereby obtaining an optimized federated learning global model.
[0070] Step 4: The server inputs the pipe network data set to be detected into the optimized federated learning global model, obtains the detection phase anomaly score through calculation by the built-in scoring mechanism, and determines whether a leak is detected based on the detection phase anomaly score, which provides a key basis for pipe network operation and maintenance decision-making, and effectively ensures the stable and safe operation of the water supply pipe network system;
[0071] The server takes the data set of the pipe network to be detected as input based on the local training of USAD; the data set of the pipe network to be detected is:
[0072] W s = {P 1 ,P 2 ,...,P J}
[0073] Among them, W sis the data set of the pipeline network to be tested; J is the total amount of data in the pipeline network data set to be tested; P J is the pressure data matrix of the pipe network at time point J;
[0074] Assuming that the number of pressure sensors in the pipeline network to be tested is m, the pressure data of the pipeline network at time point j is expressed as a multivariate time series in the form of:
[0075] P j ={p 1j ,p 2j ,,...,p mj}
[0076] Among them, p mj is the pressure data measured by the mth sensor at time point j;
[0077] In order to fit the actual data, the dependency between the current time point and the previous time point is simulated, and the data set is converted into several time windows of length L as the input for local training based on USAD:
[0078]
[0079] Among them, W j is the jth window to be detected.
[0080] The architecture of local training based on USAD consists of three parts: an encoder E (Encoder) and two decoders D1 (Decoder1) and D2 (Decoder2), which constitute the first autoencoder AE1 and the second autoencoder AE2. AE1 (W) represents the output value of the first autoencoder; AE2 (W) represents the output value of the second autoencoder:
[0081]
[0082] For simplicity, we use W to represent the input window W. j The local training based on USAD is divided into two stages, namely input reconstruction training and adversarial training. First, the two autoencoders AE1 and AE2 learn to reconstruct normal inputs; secondly, the two autoencoders AE1 and AE2 are trained in an adversarial manner. The first autoencoder AE1 will try to deceive the second autoencoder AE2, and the goal of the second autoencoder AE2 is to learn to distinguish whether the data is real (directly from W) or reconstructed (from the first autoencoder AE1). The training process is as follows:
[0083] Phase 1: Input reconstruction training. In the first phase, the goal is to train each autoencoder AE1 and AE2 to reproduce the input. The input pressure data W is compressed by the encoder E to the latent space z and then reconstructed by the two decoders D1 and D2. The training goal of the input reconstruction training is:
[0084]
[0085] in, The loss function of the first autoencoder is trained for input reconstruction, focusing on minimizing its reconstruction error; The loss function for training the second autoencoder for input reconstruction measures the loss in reconstruction accuracy;
[0086] By minimizing the loss function, the autoencoder is forced to accurately learn the normal data encoding and reconstruction mode, and build an anomaly detection benchmark;
[0087] The second stage: adversarial training. In the second stage, the goal is to train the second autoencoder AE2 to distinguish between real data and data from the first autoencoder AE1, and to train the first autoencoder AE1 to deceive the second autoencoder AE2. The data from the first autoencoder AE1 is compressed to the latent space z by the encoder E again, and then reconstructed by the second autoencoder AE2. The goal of the first autoencoder AE1 is to minimize the difference between W and the output of the second autoencoder AE2. The goal of the second autoencoder AE2 is to maximize the difference between W and the output of the second autoencoder AE2. According to the purpose of adversarial training, the objective function is established as:
[0088] f(θ)=||W-AE2[AE1(W)]||2
[0089] Among them, f(θ) is the loss function and θ is the model parameter;
[0090] The training objectives are:
[0091]
[0092] According to the objective function, the training objectives of the two autoencoders in the adversarial training are:
[0093]
[0094] in, Loss function for adversarial training of the first autoencoder; The loss function for adversarial training of the second autoencoder;
[0095] The autoencoder has two functions in the local training based on USAD: the first autoencoder AE1 minimizes the reconstruction error of W in the first stage, and minimizes the difference between W and the reconstructed output of the second autoencoder AE2 in the second stage; while the second autoencoder AE2 minimizes the reconstruction error of W in the first stage, and maximizes the reconstruction error of the input data reconstructed by the first autoencoder AE1 in the second stage; the two work together to shape the model's excellent feature learning and abnormality discrimination capabilities; the overall training objectives of the two autoencoders AE1 and AE2 in the local training based on USAD are:
[0096]
[0097] in, is the loss function of the first autoencoder, summarizing its reconstruction error and adversarial interaction loss in each training sample; is the loss function of the second autoencoder, reflecting its overall loss in feature discrimination and adversarial game; n is the total number of training rounds.
[0098] The definition formula of the abnormality score in the detection stage is:
[0099]
[0100] in, is the anomaly score; α is the anomaly score coefficient for input reconstruction training; β is the anomaly score coefficient for adversarial training; α<β represents high detection sensitivity, and α>β represents low detection sensitivity; this parameterization scheme allows a set of different anomaly scores to be obtained by adjusting the sensitivity according to needs in the process of using a single training model; each window to be detected W is assigned a j A label y indicates that a leak is detected at time point t (y=1 at this time), or that no leak is detected (y=0).
[0101] like Figure 3-10 As shown, the water supply network leakage detection method based on federated learning provided by the present invention is compared with the traditional leakage detection method by experiment, which proves the effectiveness of federated learning in water supply network leakage detection.
[0102] Table 1: Experimental environment settings
[0103]
[0104] As shown in Table 1, all experimental methods for analyzing algorithm performance are trained using NVIDIA GeForce GTX 3090; the training epoch represents the number of times the network iterates on the same training data set, which is set to 100 by default in this experiment; in addition, the number of training rounds is set to 50 rounds, and in each round of training, a subset of networks is randomly selected as auxiliary networks. In this experiment, 11 auxiliary networks are used, and the proportion of clients participating in the calculation in each round is fixed to 0.5.
[0105] like Figure 3 As shown in Table 2, this paper uses Anytown (Walski et al. 1987) network as a small water supply network to illustrate the application of the proposed method and its performance under different settings; Anytown network has 1 reservoir, 1 water pump, 19 nodes, 42 pipelines with a total length of 22 miles, diameters of 200mm-400mm, and basic node demand of 12.5L / s-63.1L / s. It is assumed that the potential burst area is the entire pipeline network, that is, each pipeline in the pipeline network is a potential leak location.
[0106] Table 2: Pipeline parameters of Anytown network
[0107]
[0108] In the case of isomorphic data sets, data samples from Anytown are evenly and randomly distributed to the clients, while in the case of non-isomorphic data sets, the client data selected come from the following pipeline networks: KY-1 system, KY-2 system, KY-3 system, KY-4 system, KY-5 system, KY-7 system, KY-9 system, New York Tunnel system, EPANET Net 2 system, EPANET Net 3 system, and EPANETNet 6 system.
[0109] like Figure 4 As shown in Table 3, the KY-1 system and the KY-3 system are based on real water supply systems in Kentucky, originally created by Steven Hoagland in 2015. The KY-1 system serves approximately 6,422 customers with an average demand of 2.00 MGD, 1 reservoir, 2 overhead tanks, and 1 pump. KY-3 serves 2,142 customers with an average demand of 2.02 MGD, 3 reservoirs, 5 pumps, 3 overhead tanks, and 52.5 miles of pipeline.
[0110] Table 3: Pipeline network parameters of KY-1 and KY-3
[0111]
[0112] like Figure 5As shown in Table 4, the KY-2, KY-4, KY-5, KY-7, and KY-9 systems are based on real water distribution systems in Kentucky, which were originally created by Matthew Jolly and Amanda Lothes in 2012 as part of an article, “Water System Modeling Research Database,” published in the Journal of Water Resources Planning and Management in 2014. The KY-2 system serves approximately 5,010 customers with an average water demand of 2.09 MGD and has 1 reservoir, 1 pump, and 3 overhead storage tanks. The KY-4 system serves 9,020 customers with an average water demand of 1.51 MGD and has 1 reservoir, 2 pumps, 4 overhead storage tanks, and 162 miles of pipe. The KY-5 system serves 2,579 customers with an average water demand of 2.28 MGD and has 4 reservoirs, 9 pumps, 3 overhead storage tanks, and 52.3 miles of pipe. The KY-7 system has an average demand of 1.53 MGD, 1 reservoir, 1 pump, 3 overhead tanks, and 79.3 miles of pipe, with an estimated water loss of 29%. The KY-9 system serves 10,009 customers, with an average demand of 1.38 MGD, 4 reservoirs, 17 pumps, 15 overhead tanks, and 594 miles of pipe.
[0113] Table 4: Pipeline network parameters of KY-2, KY-4, KY-5, KY-7 and KY-9
[0114]
[0115] like Figure 6 As shown in Table 5, the New York Tunnel System represents the primary water supply transmission tunnels in New York City in 1969. The New York Tunnel System has an average demand of 1,305 MGD, with one original source called Hillview and two loops consisting of 21 tunnels with a total length of 69.2 miles. Schaake and Lai (1969) used this network as part of a design study to optimize duplication of the existing system to meet projected demand growth.
[0116] Table 5: Pipeline network parameters of New York tunnel system
[0117]
[0118] like Figure 7As shown in Table 6, the EPANET Net 2 system is based in the Cherry Hills / Brush Plains area, has a daily demand of 0.90 MGD, covers an area of 2.0 square miles, and includes 8-inch and 12-inch mains. This network was first published by Rossman et al. (1994). The EPANET Net 3 system is based in the North Marin Water District (NMWD) in Novato, California, has an average demand of 4.9 MGD, has 2 water sources, 2 water source pumping stations, and 3 overhead storage tanks. This network was first published by Clark et al. (1994). The EPANET Net 6 system is a network model used in the formulation and optimization of the robust sensor placement problem for the drinking water contamination early warning system. It has 1 water source and 61 pumping stations.
[0119] Table 6: Pipeline network parameters for EPANET Net 2, EPANET Net 3 and EPANET Net 6 systems
[0120]
[0121] As shown in Table 7, the effectiveness of the proposed method is demonstrated by calculating the precision and recall in each case and the F1 score as an evaluation indicator. Precision measures how many of the samples predicted as positive by the model are accurate; a high precision means that the model can reduce the probability of misjudgment. Recall also evaluates how many true positive samples the model can correctly identify; a high recall means that the model can better capture the true positive samples, but there may be more misjudgments. The F1 score is the harmonic mean of precision and recall, which takes into account the performance of both; the F1 score strikes a balance between precision and recall, which is very useful for unbalanced datasets or tasks. It can consider the accuracy and comprehensiveness of the model at the same time and can better evaluate the overall performance of the classification model. Using the three indicators of precision, recall and F1 score can provide a comprehensive evaluation to help understand the performance of the model in different aspects, so as to better judge the effectiveness and reliability of the model. The precision, recall and F1 score are calculated as follows:
[0122]
[0123]
[0124] Among them, P is the precision; R is the recall rate; TP is the true positive, that is, the number of samples predicted to be leaked and actually leaked, that is, the number of samples correctly judged to be leaked; FP is the false positive, the number of samples predicted to be leaked but actually not leaked; FN is the false negative, that is, the number of samples predicted not to be leaked but actually leaked; TN is the true negative, that is, the number of samples predicted to be not leaked and actually not leaked.
[0125] Table 7: Confusion matrix table
[0126]
[0127] like Figure 8-9 As shown, the present invention provides a water supply network leakage detection method based on federated learning, which solves the problem of poor machine learning effect caused by lack of data sets when detecting anomalies in new networks or recently renovated networks with limited available data. If the other water supply network structures match the target network to be detected, they are classified as IID, that is, the data distribution is independent and identically distributed; otherwise, they are regarded as non-IID. In order to verify the effectiveness of our proposed method, we conducted experiments in two different scenarios: the first scenario: the network to be detected cannot provide historical data to train the anomaly detection model; the second scenario: the network to be detected provides a small amount of historical data to train the anomaly detection model.
[0128] like Figure 8 As shown in the first scenario: the detection results when the pipeline network to be detected cannot provide historical data to train the anomaly detection model are as follows Figure 8 As shown, under the condition of independent and identically distributed data, the performance of the water supply network leakage detection method based on federated learning provided by the present invention is more effective in identifying true positive samples and reducing false negatives, emphasizing its reliability under such conditions; under the condition of non-independent and identically distributed data, the water supply network leakage detection method based on federated learning provided by the present invention may sacrifice the accuracy of predicting positives, but performs well in correctly identifying positive samples and improving overall evaluation. In contrast, under the condition of non-independent and identically distributed data, the prediction ability of the water supply network leakage detection method based on federated learning provided by the present invention will decrease due to the structural difference with the target network; under the condition of independent and identically distributed data, the water supply network leakage detection method based on federated learning provided by the present invention is significantly stronger in terms of prediction and evaluation results, and is closer to the actual situation of the target network.
[0129] like Fig. 9 As shown in the second scenario, the detection results when the pipeline network to be detected provides a small amount of historical data to train the anomaly detection model are as follows: Fig. 9 As shown, when there are fewer training sets available for training the leakage detection model in the pipeline network to be detected, three experiments were conducted. These experiments included directly using the local USAD for leakage detection, and using the water supply pipeline leakage detection method based on federated learning provided by the present invention for leakage detection in scenarios where data is independent and identically distributed and data is not independent and identically distributed.
[0130] The experimental results show that the model obtained only by local training (USAD) can obtain a higher recall rate (0.9999), thereby detecting almost all leaks in the target pipe network, but the precision is low, the accuracy is only 0.2501, the false alarm rate is high, and the overall performance of the leakage detection model is poor. From the substantial improvement of accuracy (0.9272) and F1 score (0.9622) and the consistency of recall rate (0.9999), it is obtained that the introduction of federated learning has advantages under the condition of independent and identically distributed data, which significantly improves the overall performance and accuracy of the model under relatively uniform data distribution conditions. From the improvement of accuracy rate (0.9999) and F1 score (0.9999 and 0.9097) and the slight decrease of recall rate (0.8343), the water supply pipe network leakage detection method based on federated learning provided by the present invention makes the model affected by non-independent and identically distributed data to a certain extent, however, the demand for non-independent and identically distributed data is low, allowing the use of various data sources for federated learning and extended data availability.
[0131] In summary, when the training data is insufficient, the local leakage detection model performs well in capturing leaks, but the overall performance is poor and there is a serious misjudgment problem; the water supply network leakage detection method based on federated learning provided by the present invention significantly improves the accuracy and comprehensive performance of the model, but the problem of non-independent and identically distributed data requires further research and optimization.
[0132] like Fig.10 As shown in the figure, after anomaly detection in the first scenario where the data is not independent and identically distributed, the impact of different α values on the overall model is as follows Fig.10 As shown in Figure 1, by adjusting the parameter α, it can be observed that the F1 score of leakage detection will be affected. When α is large, the anomaly score is more affected by the reconstruction error between AE1(W) and W. In this case, anomaly data that is very similar to normal data may be misclassified as normal data due to better reconstruction results, making it easier to correctly identify normal data. On the other hand, when α is small, the anomaly score is more dependent on the reconstruction error between the output AE2[AE1(W)] and W when AE1(W) is used as the input of AE2. This highlights the role of adversarial training, in which anomaly data that is very similar to normal data can be correctly identified due to poor reconstruction. In both cases, leakage detection achieves significant results.
[0133] In the specific experiments, an appropriate weight distribution method was adopted to make the model more robust under different data distributions and scenarios. The above experiments proved the effectiveness of federated learning in water supply network leakage detection in application scenarios where pipeline network data is scarce.
[0134] The water supply network leakage detection method based on federated learning provided by the present invention can realize accurate water supply network leakage detection when there are fewer available data sets; the water supply network leakage detection method based on federated learning provided by the present invention successfully integrates the federated learning framework with the traditional leakage detection method USAD, enhances the data set used for leakage detection, enables the leakage detection framework to have a stronger abnormal generalization ability, and improves the robustness of the detection framework; it is helpful to perform accurate leakage detection and identification in the face of various abnormal scenarios.
[0135] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.
Claims
1. A water supply network leakage detection method based on federated learning, characterized in that: The steps include: Step 1: The server establishes a federated learning global model, initializes the federated learning global model parameters and the client weight distribution vector, and distributes the federated learning global model parameters; Step 2: The client receives the federated learning global model parameters, and uses local data to perform local training based on USAD to obtain the federated learning local model parameters and upload them to the server; Step 3: The server inputs the pipeline network data set to be detected into the federated learning local model parameters, and obtains the optimal weight update weight by minimizing the cross loss entropy; the server aggregates the federated learning local model parameters according to the weight to obtain updated federated learning global model parameters; If the federated learning global model has not converged or has not reached a preset number of iterations, the server distributes the updated federated learning global model parameters to each of the clients; repeating steps 2 to 3 until the federated learning global model converges or reaches a preset number of iterations, thereby obtaining an optimized federated learning global model; Step 4: The server inputs the pipeline network data set to be detected into the optimized federated learning global model to obtain an abnormality score in the detection phase, and determines whether a leak is detected according to the abnormality score in the detection phase.
2. The water supply network leakage detection method based on federated learning according to claim 1 is characterized in that: The client uses data sets from water supply networks in different regions or different systems as local data.
3. The water supply network leakage detection method based on federated learning according to claim 1 is characterized in that: The local training based on USAD includes: input reconstruction training and adversarial training; the overall training objectives of the two autoencoders are: in, is the loss function of the first autoencoder; is the loss function of the second autoencoder; n is the total number of training rounds; W is the input window; AE1(W) is the output value of the first autoencoder; AE2(W) is the output value of the second autoencoder.
4. The water supply network leakage detection method based on federated learning according to claim 3 is characterized in that: The input reconstruction training is that two autoencoders compress the input pressure data into a latent space, and then reconstruct it by two autoencoders; the training objectives of the two autoencoders in the input reconstruction training are: in, Loss function for training the first autoencoder for input reconstruction; Loss function for training the second autoencoder for input reconstruction.
5. The water supply network leakage detection method based on federated learning according to claim 4 is characterized in that: The adversarial training is to train the second autoencoder to distinguish between real data and data from the first autoencoder, and to train the first autoencoder to deceive the second autoencoder; the objective function is: f(θ)=||W-AE2[AE1(W)]||2 Among them, f(θ) is the loss function; θ is the model parameter; The training objectives are: According to the objective function, the training objectives of the two autoencoders in the adversarial training are: in, Loss function for adversarial training of the first autoencoder; Loss function for adversarial training of the second autoencoder.
6. The water supply network leakage detection method based on federated learning according to claim 1 is characterized in that: The calculation formula of the cross loss entropy is: Among them, χ is the prediction result after weight allocation; ω is the label matrix of the pipeline network data set to be detected; J is the total data of the pipeline network data set to be detected; γ is the customer weight allocation vector; M is the prediction result matrix of all clients.
7. The water supply network leakage detection method based on federated learning according to claim 6 is characterized in that: The formula for updating the weights by minimizing the cross loss entropy is: Among them, γ * is the optimal weight; is the optimal weight of the kth client.
8. The water supply network leakage detection method based on federated learning according to claim 7 is characterized in that: The formula for the server to aggregate the parameters of the federated learning local model according to the weight is: Among them, θ i+1 is the global model parameter of federated learning after the i-th round of aggregation, is the federated learning local model parameter of the k-th client after the i-th round of training; K is the total number of clients.
9. The water supply network leakage detection method based on federated learning according to claim 5, characterized in that: The calculation formula of the abnormality score in the detection stage is: in, is the anomaly score; α is the anomaly score coefficient for input reconstruction training; β is the anomaly score coefficient for adversarial training.
Citation Information
Cited By
Health data enhancement and anomaly detection method based on GAN (Generative Adversarial Network)
CN120277590A
Mine water storage pressure prediction method based on deep learning
CN120278236A
Fault diagnosis method of federated learning based on dynamic weighted voting
CN121167378A
A fault diagnosis method based on federated learning of dynamic weighted voting
CN121167378B
Self-adaptive decision federal learning method for medical image recognition
CN122530718A