Unsupervised water pipe network leakage detection method based on discrete time dynamic graph network

Through the discrete time dynamic graph network model, the problem of high hardware equipment cost in water pipe network leakage detection and supervision learning dependence on labeled data is solved, unsupervised and automated leakage detection is realized, detection speed and accuracy are improved, and water pipes are adapted to water pipes. Dynamic changes in the network.

CN119272450AActive Publication Date: 2025-01-07XIAN UNIV OF TECH +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411247623.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2025-01-07
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

The existing water pipeline leakage detection methods have problems such as high hardware equipment costs, limited application scope, and relying on supervised learning to mark data, making it difficult to achieve unsupervised and automated leakage detection.

Method used

Unsupervised method based on discrete time dynamic graph network is adopted to represent the water pipeline structure through the graph network model, unsupervised positive sample density estimation and leakage detection are used to dynamically update the graph model to capture the pipeline network Change of status.

Benefits of technology

The unsupervised water pipe network leakage detection without labeling data is realized, which reduces costs, improves detection speed and accuracy, and adapts to changes in complex water pipe network conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272450A_ABST
    Figure CN119272450A_ABST
Patent Text Reader

Abstract

The invention discloses an unsupervised water pipe network leakage detection method based on a discrete time dynamic graph network, and the method specifically comprises the following steps: firstly, defining a graph structure according to a pipe network node space topological structure; secondly, according to the time sequence length, data collected by the pressure sensors arranged in the water pipe network are subjected to graph snapshot division; next, graph embedding representation learning is carried out in the graph snapshots by adopting a graph attention network, graph embedding representation is sent into an SOS flow model to carry out unsupervised positive sample density estimation and online leakage detection, and graph parameter evolution is carried out between the graph snapshots by adopting an RNN model to realize dynamic updating of a graph model; according to the method provided by the invention, the structure of the water pipe network can be represented by using the graph network model, the change of the state of the pipe network is captured through dynamically updated graph information, and unsupervised detection of the leakage problem is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of pipe network leakage detection, and relates to an unsupervised water pipe network leakage detection method based on a discrete-time dynamic graph network. Background Art

[0002] In urban water supply systems, ensuring a stable supply of water quality and quantity is crucial. However, due to the large and complex water pipe network system, leakage problems may have a serious impact on the waste of water resources and the interruption of water supply services, which in turn brings negative social and economic consequences. Leakage problems may be caused by factors such as pipe aging, external environmental changes or construction damage, which pose a direct threat to the safety and efficiency of the water supply system. Therefore, effective leakage detection and location of water pipe networks is a key challenge facing water management departments.

[0003] There are several problems with existing technologies for leak detection in water pipe networks. Hardware-based methods, including in-pipe and out-pipe leak detection technologies, are non-invasive, but many devices are still in the research and development stage and can only be used as test prototypes. In addition, although out-pipe devices are easy to install, they are costly, time-consuming, and require professional operators to operate and infer the location of leaks. These devices may fail when detecting leaks in deeply buried underground pipes, limiting their scope of application. Model-driven methods in software-based methods rely on accurate pipe network models, including parameters such as the topology of the pipe network, age, pipe section material and pipe diameter. The calibration process of these parameters is complex and limited by data availability. Especially for large-scale and old water transmission pipe networks, the maintenance of hydraulic models becomes particularly difficult.

[0004] In contrast, data-driven methods demonstrate a strong ability to model the nonlinearity of pipe networks by deeply mining historical data patterns. This approach is less restrictive, more flexible, and more convenient than hardware-based and model-based methods. However, most existing methods rely on supervised learning and require a large amount of labeled data for training, which is often difficult to obtain in practical applications. Therefore, developing an unsupervised learning method that does not require labeled data is of great significance for improving the efficiency and accuracy of water pipe network leakage detection. Unsupervised methods can automatically learn patterns from data without human intervention, thereby reducing costs, increasing detection speed, and being able to adapt to changing pipe network conditions. Summary of the invention

[0005] The purpose of the present invention is to provide an unsupervised water pipe network leakage detection method based on a discrete-time dynamic graph network. The method can use a graph network model to represent the structure of the water pipe network, capture changes in the pipe network state through dynamically updated graph information, and achieve unsupervised detection of leakage problems.

[0006] The technical solution adopted by the present invention is an unsupervised water pipe network leakage detection method based on a discrete-time dynamic graph network, which specifically includes the following processes: first, a graph structure is defined according to the spatial topological structure of the pipe network nodes; second, the data collected by the pressure sensors arranged in the water pipe network are divided into graph snapshots according to the length of the time series; then, a graph attention network is used in the graph snapshot to learn the graph embedding representation, and the graph embedding representation is sent to the SOS flow model for unsupervised positive sample density estimation and online leakage detection, and an RNN model is used between the graph snapshots to evolve the graph parameters to realize the dynamic update of the graph model.

[0007] The present invention is also characterized in that:

[0008] The specific steps include:

[0009] Step 1: Download the water pipe network leakage test dataset LeakDB and divide the dataset into the non-leakage water pipe network pressure training set F and the non-leakage water pipe network pressure training set F according to m:n. train And there is leakage water pipe network pressure test set F test , the true value set of the test set is GTest, and the set of pressure sensors deployed in the water pipe network corresponding to the LeakDB dataset is V = {v1,v2,…,v n ,…,v N}, where v n Represents the sensor of the nth node, 1≤n≤N, N is the total number of pressure sensors, in, and F train and F test The nth pressure sensor v n The pressure value at time t, 1≤t≤T, T is the time series length of the pressure time series signal;

[0010] Step 2: Define a graph structure G = (V, E) according to the spatial topological structure of the pressure sensors arranged in the water pipe network, where V and E are the nodes and edges of the graph respectively, and E = {(v i ,v j )|1≤i≤N,1≤j≤N,i≠j}, the graph structure G is represented by the adjacency matrix A, δ i,j Indicates whether two nodes are connected;

[0011] Step 3: Calculate F according to the length of the time series. train Perform graph snapshot partitioning to obtain the graph snapshot set G train =[g1,g2,…,g k ,…,g K ], the signal length of each snapshot is ΔT, g kis the kth graph snapshot, 1≤k≤K, K is the total number of graph snapshots, K=int(T / ΔT), int(·) represents the floor function, g k =(F k ,A),F k is the kth graph snapshot g k The corresponding training set F train Medium pressure time series signal set,

[0012] Step 4, construct a discrete time dynamic graph network structure Net;

[0013] Step 5: training the network model;

[0014] Step 6, on the test set F test The model is tested on the network to obtain the unsupervised water network leakage detection results.

[0015] In step 4, the discrete time dynamic graph network structure is Net = {(NG1, NS1), RNN 1→2 ,…(NG k ,NS k ),RNN k→k+1 ,…(NG K ,NS K )}; where NG k NS k and RNN k→k+1 Represents a graph snapshot g k The graph attention network, SOS flow network, and g k and g k+1 RNNRNN between graph snapshots k-1→k ;

[0016] Graph Attention NetworkNG k Divided into graph space attention network NGS k and Graph Temporal Attention Network NGT k ;SOS flow network NS k Including SOS() forward transformation, SOS_inverse() reverse transformation and FNN subnetwork FNN k ;RNN k-1→k Includes two fully connected layers;

[0017] Graph Spatial Attention Network NGS k Consists of three fully connected layers, graph temporal attention network NGT k It consists of causal convolution, dilated convolution and 1D convolution;

[0018] The graph space attention network implements mutual attention calculation Attention() to enhance features after three layers of full connection. The graph time attention is enhanced by gated activation units after convolution operation to obtain graph embedding representation. The SOS stream network transforms the input data into a normal distribution through the SOS() forward transformation, and transforms the data in the normal distribution back to the input data space through the SOS_inverse() inverse transformation; RNN updates the graph attention network parameters between snapshots through full connection.

[0019] The specific steps of step 5 are as follows:

[0020] Step 5.1, define the number of graph snapshots variable k, initialize it to 1, and define the condition variable C k , define the overall network parameters as Model = {W1, WR1, ...W k ,WR k …,W K}, the kth snapshot g k Network parameters in and Represents the kth graph snapshot g respectively k Learnable graph parameters and flow parameters, WR k represents the snapshot-to-snapshot RNN, g k The flow distribution parameter is expressed as (μ k ,σ k ), randomly initialize g1 according to uniform distribution Initialize the flow distribution parameters of g1 μ1=0, σ1=1, and the network parameters Parameters of the graph space attention sub-network and graph temporal attention subnetwork parameters Composition, that is Initialize the network model Model, Model = W1;

[0021] Step 5.2, F train The k-th graph snapshot g in k As input, it is fed into the graph space attention network NG k and Graph Temporal Attention Network NS k , using the parameter and Forward calculation to get the graph embedding representation X k ;

[0022] Step 5.3, initialize the condition variable C1 = X1, and set X k With C k After being connected in series, they are sent to the kth SOS flow network NS k , perform SOS flow forward transformation, calculate flow model loss, and obtain the flow transformed data Zk ;

[0023] Step 5.4, from the conditional distribution Sample the data Z of length ΔT in k ' -1 , put Z k ' -1 Send to SOS stream network NS k , the inverse transformation is make Put C k+1 Send to FNN layer, output mean μ k+1 and variance σ k+1 ;

[0024] Step 5.5, set the graph network parameters Send it to the recurrent neural network RNN ​​and predict g k Graph network parameters

[0025] Step 5.6, update Model, determine whether k is equal to K, if so, Model = Model + W k , otherwise Model=Model+W k +WR k ;

[0026] Step 5.7, let k = k + 1, determine whether k is less than or equal to K, if so, proceed to step 5.2, otherwise, end training and output the network model Model.

[0027] The specific steps of step 5.2 are as follows:

[0028] Step 5.2.1, for snapshot g k =(F k ,A), extract g k Current node v n Neighborhood nodes Current node v n and neighboring nodes The features are represented as f n (t) and

[0029] Step 5.2.2, put f n (t) is used as input and transformed by the fully connected layer FC1 of the graph space attention network to obtain the mutual attention mechanism As shown in formula (1); As input, after the fully connected layer FC2 transformation of the graph space attention network, the open source torch library function transpose() function is called to obtain and As shown in formula (2); As input, after being transformed by the fully connected layer FC3 of the graph space attention network, we get As shown in formula (3); where Query k Represents the query vector, Key k Represents the key vector, Value k Represents a vector of values:

[0030] Queryk=FC1(f n (t)) (1)

[0031]

[0032]

[0033] Step 5.2.3, Query k 、Key k and Value k As input, the mutual attention calculation formula Attention() is used, as shown in formula (4), to enhance the current node feature, where d Key is the feature key k Dimension size; Softmax() is an open source torch data activation library function that calculates the current node v n The enhanced features (f n (t))':

[0034]

[0035] Step 5.2.4, the feature (f n (t))' is used as input and transformed by the fully connected FC3 layer of the graph space attention network to obtain the output feature of the graph space attention sub-network (f n (t))”=FC3((f n (t))');

[0036] Step 5.2.5, feature F' k ={(f n (t))”|t∈[(k-1)×ΔT,k×ΔT],n∈[1,N]} is taken as input, and the causal convolution layer CauConv of the temporal graph temporal attention network outputs the feature F k ″;

[0037] Step 5.2.6, define the total number of layers of the residual network as L, the number of residual layers as l, l is initialized to 1, i.e. l ​​= 1, and the characteristic variable of the lth residual layer is h l ,h 1 Initialize to F k ″, that is, h 1=F k ″;

[0038] Step 5.2.7, the l-th layer feature h l The hyperbolic tangent activation function tanh() and the sigmoid activation function σ() are respectively sent to the graph time attention network, and then sent to the unit gated linear unit to obtain h l Enhanced features (h l )';

[0039] (h l )'=GLU(tanh(h l ),σ(h l )) (5)

[0040] Step 5.2.8, enhance the feature (h l )' and the l-th layer feature h l Add together to get the l+1th layer input feature h l+1 ,h l+1 =(h l )'+h l ;

[0041] Step 5.2.9, let l = l + 1, determine whether l is less than L, if the condition is met, go to step 5.2.7;

[0042] Step 5.2.10, add the accumulated features h 1 +…+h l +…+h L After passing through the convolutional layers Conv4 and Conv5 of the graph time attention network, the reduced dimension feature X is obtained. k , as shown in formula (6):

[0043] X k =Conv5(Conv4((h 1 +…+h l +…+h L ))) (6).

[0044] The specific steps of step 5.3 are as follows:

[0045] Step 5.3.1, input X k With condition C k , sent to the SOS flow network NS k Get the data Z after the forward flow transformation k and the Jacobian matrix determinant logdet k , as shown in formula (7):

[0046] (Z k ,logdet k )=SOS(Xk ,C k ) (7)

[0047] Among them, SOS() represents the forward transformation of the flow model;

[0048] Step 5.3.2, calculate Z k With conditional distribution The maximum likelihood estimate of logprobs k , as shown in formula (8), calculate the loss Loss k As shown in formula (9);

[0049]

[0050] Loss k =-(logprobs k +logdet k ) (9).

[0051] The specific steps of step 5.4 are as follows:

[0052] Step 5.4.1, from the conditional distribution Randomly sample data Z of length ΔT k ′, and sent to the SOS stream for inverse transformation, we get As shown in formula (10), let

[0053]

[0054] Among them, SOS_inverse() represents the inverse transformation of the SOS stream;

[0055] Step 5.4.2, put C k+1 Send to FNN layer, output mean μ k+1 and variance σ k+1 , as shown in formula (11):

[0056] μ k+1 ,σ k+1 =FNN(C k+1 ) (11)

[0057] Among them, FNN() represents the fully connected transformation.

[0058] The specific steps of step 5.5 are as follows:

[0059] Step 5.5.1, input parameters of graph space attention network After RNN, we use the open source GRU to get the updated graph space attention network parameters As shown in formula (12);

[0060]

[0061] Step 5.5.2, input parameters of graph temporal attention network After GRU, the updated graph space attention network parameters are obtained As shown in formula (13);

[0062]

[0063] The specific steps of step 6 are as follows:

[0064] Step 6.1: Set the test set F test and the true value label GT test Input into the trained network model;

[0065] Step 6.2: Calculate F according to the length of the time series. test Perform graph snapshot partitioning to obtain the graph snapshot set G test =[g1,g2,…,g m ,…,g M ], the length of each snapshot signal is ΔT, g m is the mth graph snapshot, 1≤m≤M, M is the total number of graph snapshots, M=int(T / ΔT), int(·) represents the floor function, g m =(D m ,A),D m is the test set F corresponding to the mth graph snapshot test Medium pressure time series signal set, Define the snapshot number variable m, initialize m=1, and define snapshot g m The condition variable C m and flow distribution parameters (μ m ,σ m ), initialize μ1=0, σ1=0;

[0066] Step 6.3, take the mth test image snapshot g m Send to the trained graph attention network structure NG k , using the model Forward transformation obtains the graph embedding representation X m , initialize C1 = X1, and then C m and X m After concatenation, it is sent into the trained SOS flow network structure NS k , using the model Forward transform to get Z m , Jacobian matrix determinant logdet m , using the flow model Z m The inverse transformation is Otherwise, let Put C m+1 Send to FNN layer, output mean μ m+1 and variance σ m+1 ;

[0067] Step 6.4, use KL divergence to calculate snapshot g m In distribution The leakage anomaly fraction η under m , as shown in formula (14), η m Write the test result set PTest, that is, PTest = PTest + η m ;

[0068]

[0069] Step 6.5, set threshold θ, η m is greater than θ, then it is considered that g m , that is, leakage occurred during the time period t∈[(m-1)×ΔT,m×ΔT];

[0070] Step 6.6, let m = m + 1, determine whether m is less than or equal to M, if so, go to step 6.3, otherwise, end the test and output the anomaly score set PTest; call the function roc_auc_score in the open source library sklearn to calculate the AUC score and calculate PTest and GT test The difference between them is used to evaluate the model performance;

[0071] AUC = roc_auc_score(PTest,GT test ) (15).

[0072] The beneficial effect of the present invention is that the unsupervised water pipe network leakage detection method based on the discrete time dynamic graph network of the present invention, through the unbiased estimation of the conditional flow and SOS flow calculation graph embedding distribution, starts from the difference in the distribution of normal data and leakage data, and overcomes the disadvantage that the traditional detection method needs leakage labels for leakage detection. At the same time, in order to avoid the increase of model size with the increase of time length and reduce the influence of model size on reasoning delay, the unsupervised water pipe network leakage detection method based on the discrete time dynamic graph network adopts the model parameter evolution strategy to make the model suitable for the actual scene of dynamic evolution. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 It is an overall flow chart of the unsupervised water pipe network leakage detection method based on discrete time dynamic graph network of the present invention;

[0074] Figure 2 It is a training flow chart of the unsupervised water pipe network leakage detection method based on discrete time dynamic graph network of the present invention;

[0075] Figure 3 It is a test flow chart in the unsupervised water pipe network leakage detection method based on discrete time dynamic graph network of the present invention;

[0076] Figure 4 It is a schematic diagram of the spatial topological structure of a water supply network adopted by the unsupervised water pipe network leakage detection method based on a discrete-time dynamic graph network of the present invention;

[0077] Figure 5 It is a schematic diagram of normal water pipe network data without leakage collected by the unsupervised water pipe network leakage detection method based on discrete time dynamic graph network of the present invention;

[0078] Figure 6 It is a schematic diagram of water pipe network data with weak leakage collected by the unsupervised water pipe network leakage detection method based on discrete time dynamic graph network of the present invention;

[0079] Figure 7 It is a schematic diagram of water pipe network data with strong leakage collected by the unsupervised water pipe network leakage detection method based on discrete time dynamic graph network of the present invention;

[0080] Figure 8 It is the subjective result of the unsupervised water pipe network leakage detection method based on discrete-time dynamic graph network of the present invention. DETAILED DESCRIPTION

[0081] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0082] The present invention is based on the unsupervised water pipe network leakage detection method of discrete time dynamic graph network, the overall process is as follows Figure 1 As shown, the specific implementation steps are as follows:

[0083] Step 1: Download the water pipe network leakage test dataset LeakDB and divide the dataset into the non-leakage water pipe network pressure training set F and the non-leakage water pipe network pressure training set F according to m:n. train And there is leakage water pipe network pressure test set F test , the true value set of the test set is GTest, and the set of pressure sensors deployed in the water pipe network corresponding to the LeakDB dataset is V = {v1,v2,…,v n ,…,v N}, where v n Represents the sensor of the nth node, 1≤n≤N, N is the total number of pressure sensors, in, and F train and F test The nth pressure sensor v nThe pressure value at time t, 1≤t≤T, T is the time series length of the pressure time series signal;

[0084] Step 2: Define a graph structure G = (V, E) according to the spatial topological structure of the pressure sensors arranged in the water pipe network, where V and E are the nodes and edges of the graph respectively, and E = {(v i ,v j )|1≤i≤N,1≤j≤N,i≠j}, the graph structure G is represented by the adjacency matrix A, δ i,j Indicates whether two nodes are connected;

[0085] Step 3: Calculate F according to the length of the time series. train Perform graph snapshot partitioning to obtain the graph snapshot set G train =[g1,g2,…,g k ,…,g K ], the length of each snapshot signal is ΔT, g k is the kth graph snapshot, 1≤k≤K, K is the total number of graph snapshots, K=int(T / ΔT), int(·) represents the floor function, g k =(F k ,A),F k is the kth graph snapshot g k The corresponding training set F train Medium pressure time series signal set,

[0086] Step 4: Construct a discrete-time dynamic graph network structure Net. The discrete-time dynamic graph network structure is Net = {(NG1, NS1), RNN 1→2 ,…(NG k ,NS k ),RNN k→k+1 ,…(NG K ,NS K )}, where NG k NS k and RNN k→k+1 Represents a graph snapshot g k The graph attention network, SOS flow network, and g k and g k+1 RNN (Recurrent Neural Network) between graph snapshots k-1→k ;

[0087] Graph Attention NetworkNG k Divided into graph space attention network NGS k and Graph Temporal Attention Network NGT k ;

[0088] SOS Stream Network NSk Including SOS() forward transformation, SOS_inverse() reverse transformation and FNN (fully connected) subnetwork FNN k ;

[0089] RNN (Recurrent Neural Network) k-1→k Includes two fully connected layers

[0090] Graph Spatial Attention Network NGS k Consists of three fully connected layers, graph temporal attention network NGT k It consists of causal convolution, dilated convolution and 1D convolution;

[0091] The graph spatial attention network is fully connected through three layers to realize the mutual attention calculation Attention() to enhance the features. The graph temporal attention is convolutional and then activated by gated units to enhance the features to obtain graph embedding representation. The SOS stream network transforms the input data into a normal distribution through the SOS() forward transformation, and transforms the data in the normal distribution back to the input data space through the SOS_inverse() inverse transformation. The RNN (recurrent neural network) updates the graph attention network parameters between snapshots through full connection.

[0092] Step 5: train the network model Model; Figure 2 Shown is the training process of the entire network model;

[0093] The specific process of step 5 is:

[0094] Step 5.1, define the number of graph snapshots variable k, initialize it to 1, and define the condition variable C k The overall network parameters are defined as Model = {W1, WR1, ...W k ,WR k …,W K}, the kth snapshot g k Network parameters in and Represents the kth graph snapshot g respectively k Learnable graph parameters and flow parameters, WR k represents the snapshot-to-snapshot RNN (parameters of the recurrent neural network). g k The flow distribution parameter is expressed as (μ k ,σ k ), randomly initialize g1 according to uniform distribution Initialize the flow distribution parameters of g1 μ1=0, σ1=1, and the network parameters Parameters of the graph space attention sub-network and graph temporal attention subnetwork parameters Composition, that is Initialize the network model Model, Model = W1, The network layers and parameter settings involved are shown in Table 1. The network layers and parameter settings involved are shown in Table 2.

[0095] Table 1 Parameters of the graph space attention network

[0096]

[0097] Table 2 Parameters of the temporal attention network

[0098]

[0099] Snapshot Inter-Graph Network Parameters Through RNN (Gated Recurrent Unit) network update, the RNN network layer and parameter settings are shown in Table 3.

[0100] Table 3 RNN (Gated Recurrent Unit) network parameters

[0101]

[0102] Step 5.2, F train The k-th graph snapshot g in k As input, it is fed into the graph space attention network NG k and Graph Temporal Attention Network NS k , using the parameter and Forward calculation to get the graph embedding representation X k ; The specific process of step 5.2 is:

[0103] Step 5.2.1, for snapshot g k =(F k ,A), extract g k Current node v n Neighborhood nodes Current node v n and neighboring nodes The features are represented as f n (t) and

[0104] Step 5.2.2, put f n (t) is used as input and transformed by the fully connected layer FC1 of the graph space attention network to obtain the mutual attention mechanism As shown in formula (1); As input, after the fully connected layer FC2 transformation of the graph space attention network, the open source torch library function transpose() function is called to obtain and As shown in formula (2); As input, after being transformed by the fully connected layer FC3 of the graph space attention network, we get As shown in formula (3); where Query k Represents the query vector, Key k Represents the key vector, Value k Represents a vector of values:

[0105] Query k =FC1(f n (t)) (1)

[0106]

[0107]

[0108] Step 5.2.3, Query k 、Key k and Value k As input, the mutual attention calculation formula Attention() is used, as shown in formula (4), to enhance the current node feature, where d Key is the feature key k Dimension size; Softmax() is an open source torch data activation library function that calculates the current node v n The enhanced features (f n (t))':

[0109]

[0110] Step 5.2.4, the feature (f n (t))' is used as input and transformed by the fully connected FC3 layer of the graph space attention network to obtain the output feature of the graph space attention sub-network (f n (t))”=FC3((f n (t))');

[0111] Step 5.2.5, feature F' k ={(f n (t))”|t∈[(k-1)×ΔT,k×ΔT],n∈[1,N]} is taken as input, and the causal convolution layer CauConv of the temporal graph temporal attention network outputs the feature F k ″;

[0112] Step 5.2.6, define the total number of layers of the residual network as L, the number of residual layers as l, l is initialized to 1, i.e. l ​​= 1, and the characteristic variable of the lth residual layer is h l ,h 1 Initialize to Fk ″, that is, h 1 =F k ″;

[0113] Step 5.2.7, the l-th layer feature h l The hyperbolic tangent activation function tanh() and the sigmoid activation function σ() are respectively sent to the graph time attention network, and then sent to the unit gated linear unit (GLU) to obtain h l Enhanced features (h l )';

[0114] (h l )'=GLU(tanh(h l ),σ(h l )) (5)

[0115] Step 5.2.8, enhance the feature (h l )' and the l-th layer feature h l Add together to get the l+1th layer input feature h l+1 ,h l+1 =(h l )'+h l ;

[0116] Step 5.2.9, let l = l + 1, determine whether l is less than L, if the condition is met, go to step 5.2.7;

[0117] Step 5.2.10, add the accumulated features (h 1 +…+h l +…+h L ) passes through the convolutional layers Conv4 and Conv5 of the graph time attention network in turn to obtain the reduced dimension feature X k , as shown in formula (6):

[0118] X k =Conv5(Conv4((h 1 +…+h l +…+h L ))) (6)

[0119] Step 5.3, initialize the condition variable C1 = X1, and set X k With C k After being connected in series, they are sent to the kth SOS flow network NS k , perform SOS flow forward transformation, calculate flow model loss, and obtain the flow transformed data Z k ;

[0120] The specific process of step 5.3 is:

[0121] Step 5.3.1, input X k With condition C k , sent to the SOS flow network NS k Get the data Z after the forward flow transformation k and the Jacobian matrix determinant logdet k , as shown in formula (7):

[0122] (Z k ,logdet k )=SOS(X k ,C k ) (7)

[0123] Among them, SOS() represents the forward transformation of the flow model;

[0124] Step 5.3.2, calculate Z k With conditional distribution The maximum likelihood estimate of logprobs k , as shown in formula (8), calculate the loss Loss k As shown in formula (9);

[0125]

[0126] Loss k =-(logprobs k +logdet k ) (9)

[0127] Step 5.4, Step 5.4, from the conditional distribution Sample the data Z of length ΔT in k ' -1 , put Z k ' -1 Send to SOS stream network NS k , the inverse transformation is make Put C k+1 Send to FNN layer, output mean μ k+1 and variance σ k+1 The specific process of step 5.4 is:

[0128] Step 5.4.1, from the conditional distribution Randomly sample data Z of length ΔT k ′, and sent to the SOS stream for inverse transformation, we get As shown in formula (10), let

[0129]

[0130] Among them, SOS_inverse() represents the inverse transformation of the SOS stream;

[0131] Step 5.4.2, put C k+1 Send to FNN layer, output mean μ k+1 and variance σ k+1 , as shown in formula (11):

[0132] μ k+1 ,σ k+1 =FNN(C k+1 ) (11)

[0133] Among them, FNN() represents the fully connected transformation.

[0134] Step 5.5, set the graph network parameters Send it to the recurrent neural network RNN ​​and predict g k Graph network parameters The specific process of step 5.5 is:

[0135] Step 5.5.1, input parameters of graph space attention network After RNN (recurrent neural network), the open source GRU (gated recurrent unit) is used here to obtain the updated graph space attention network parameters As shown in formula (12);

[0136]

[0137] Step 5.5.2, input parameters of graph temporal attention network After GRU (Gated Recurrent Unit), the updated graph space attention network parameters are obtained As shown in formula (13);

[0138]

[0139] Step 5.6, update Model, determine whether k is equal to K, if so, Model = Model + W k , otherwise Model=Model+W k +WR k ;

[0140] Step 5.7, let k = k + 1, determine whether k is less than or equal to K, if so, proceed to step 5.2, otherwise, end training and output the network model Model.

[0141] Step 6, such as Figure 3 The figure shows the testing process of the network model. test The model is tested on the network to obtain the unsupervised water network leakage detection results.

[0142] The specific process of step 6 is:

[0143] Step 6.1: Set the test set F test and the true value label GT test Input into the trained network model;

[0144] Step 6.2: Calculate F according to the length of the time series. test Perform graph snapshot partitioning to obtain the graph snapshot set G test =[g1,g2,…,g m ,…,g M ], the signal length of each snapshot is ΔT, g m is the mth graph snapshot, 1≤m≤M, M is the total number of graph snapshots, M=int(T / ΔT), int(·) represents the floor function, g m =(D m ,A),D m is the test set F corresponding to the mth graph snapshot test Medium pressure time series signal set, Define the snapshot number variable m, initialize m=1, and define snapshot g m The condition variable C m and flow distribution parameters (μ m ,σ m ), initialize μ1=0, σ1=0;

[0145] Step 6.3, take the mth test image snapshot g m Send to the trained graph attention network structure NG k , using the model Forward transformation obtains the graph embedding representation X m , initialize C1 = X1, and then C m and X m After concatenation, it is sent into the trained SOS flow network structure NS k , using the model Forward transform to get Z m , Jacobian matrix determinant logdet m , using the flow model Z m The inverse transformation is Otherwise, let Put C m+1 Send to FNN layer, output mean μ m+1 and variance σ m+1 ;

[0146] Step 6.4, use KL divergence to calculate snapshot g m In distribution The leakage anomaly fraction η under m, as shown in formula (14), η m Write the test result set PTest, that is, PTest = PTest + η m ;

[0147]

[0148] Step 6.5, set threshold θ, η m is greater than θ, then it is considered that g m , that is, leakage occurred during the time period t∈[(m-1)×ΔT,m×ΔT];

[0149] Step 6.5, let m=m+1, determine whether m is less than or equal to M, if so, go to step 6.3, otherwise, end the test and output the anomaly score set PTest.

[0150] Step 6.6, call the function roc_auc_score in the open source library sklearn to calculate the AUC score and PTest and GT test The difference between them is used to evaluate the model performance;

[0151] AUC = roc_auc_score(PTest,GT test ) (15)

[0152] Example 1

[0153] The present invention is an unsupervised water pipe network leakage detection method based on discrete-time dynamic graph network, and a standard data set (LeakDB data set) is used to test the present invention.

[0154] The LeakDB dataset is simplified from the actual water pipeline network in Hanoi, Vietnam. The pipeline is 38.1 kilometers long and includes 32 nodes and 34 pipelines. Pressure sensors are arranged at each node. Figure 4 As shown in the figure, the numbers represent the node numbers. The data set samples sensor data every thirty minutes. The data set is divided into normal data and leakage data. There are 238 normal data scenarios as training samples; there are 762 leakage data scenarios, each of which may contain one or more leakage segments. Each scenario simulates one year of data collection, and the data length is 17520. Figure 5 , 6 ,7 show the pressure data of five nodes under normal data, short leakage data, and long leakage data in the LeakDB dataset, respectively. The subscripts in the figure represent the detection time.

[0155] Example 2

[0156] Objective evaluation index: The detection performance test of the unsupervised water pipe network leakage detection method based on discrete-time dynamic graph network constructed by the method of the present invention was conducted, and the detection results were objectively evaluated using the following indexes:

[0157] (1) Area Under Curve (AUC): It is defined as the area under the ROC curve and the coordinate axis. Obviously, the value of this area will not be greater than 1. The closer the AUC is to 1.0, the higher the authenticity of the detection method; when it is equal to 0.5, the authenticity is the lowest and has no application value. As a performance metric, AUC can be used to evaluate model performance by calculating the probability that the model ranks all positive samples before negative samples.

[0158] (2) TPR (true positive rate), also known as recall rate or sensitivity, refers to the proportion of samples that are actually positive that are correctly predicted as positive by the model. Its calculation formula is (16):

[0159]

[0160] Among them, TP is the number of true positives and FN is the number of false negatives. The higher the TPR, the more actual positive examples the model recognizes, and the stronger the recall ability of the model.

[0161] (3) FPR (false positive rate) refers to the proportion of samples that are actually negative examples that are incorrectly predicted as positive examples by the model. Its calculation formula is (17):

[0162]

[0163] Among them, FP is the number of false positives and TN is the number of true negatives. The lower the FPR, the less likely the model mistakenly predicts negative examples as positive examples, and the lower the false alarm rate of the model.

[0164] Objective evaluation: As shown in Table 4, the AUC, FPR and TPR results of the method of the present invention on the LeakDB dataset are shown, showing the objective experimental results of the method proposed by the present invention and other unsupervised leakage detection methods for water pipe networks on the LeakDB dataset. It can be seen from the data in the table that the method of the present invention achieved a TPR of 92.7%, an FPR of 9.5%, and an AUC of 0.901 on the LeakDB dataset. The TPR of the KNN-based leakage detection method was 30.7% and the FPR was 16.1%. Compared with this method, the TPR of the present method increased by 62.0% and the FPR decreased by 6.6%. The TPR of the GRU-based unsupervised detection method was 42.9% and the FPR was 25.0%. Compared with this method, the TPR of the present method was increased by 43.0% and the FPR decreased by 15.5%. The performance indicators of the unsupervised detection method based on LSTM+RNN are 90.4% in TPR, 13.7% in FPR, and 0.876 in AUC. Compared with this method, the method of the present invention has a TPR improvement of 2.3%, a FPR reduction of 4.2%, and an AUC improvement of 0.025. The performance indicators of the unsupervised leakage detection method LSTM-AE-WLDL for comparison are 91.3% in TPR, 11.8% in FPR, and 0.891 in AUC. The method of the present invention has a TPR improvement of 0.9%, a FPR reduction of 2.3%, and an AUC improvement of 0.010. It is proved that the unsupervised water pipe network leakage detection method based on graph attention network and conditional flow proposed in the present invention has better detection ability for water pipe network leakage on the LeakDB dataset.

[0165] Table 4 Detection results of the present invention on the LeakDB dataset

[0166] method TPR(%)↑ FPR(%)↓ AUC↑ KNN 30.7 16.1 / GRU 42.9 25.0 / LSTM+RNN 90.4 13.7 0.876 LSTM-AE-WLDL 91.3 11.8 0.891 The present invention 92.7 9.5 0.901

[0167] Example 3

[0168] Subjective evaluation: Figure 8 The subjective results of the unsupervised water pipe network leakage detection method based on discrete-time dynamic graph network are shown. The subscript indicates the number of input pressure data, the first line is the source data, the second line green area is the true value of the leakage area, and the third line red area is the detection result. It can be seen that the proposed method accurately detects the leakage period of the pipe network. The method realizes unsupervised detection of water pipe network leakage under the premise that the detection accuracy meets the requirements and does not require special collection or labeling of leakage data, reducing labor costs.

[0169] The present invention is based on an unsupervised water pipe network leakage detection method based on a discrete time dynamic graph network. Based on the problems that the water pipe network leakage detection tasks currently on the market require manual collaboration, complex and expensive instruments, and high labor costs, the present invention designs a detection method for unsupervised water pipe network leakage detection by arranging pressure sensors at key nodes in the water pipe network, so as to realize the graph structure construction, feature extraction and positive sample distribution modeling of non-leakage data of the water pipe network, and detect the leakage of the water pipe network by the difference with the positive sample distribution. Therefore, the present invention collects node pressure data through pressure sensors, constructs the spatial topological structure of the water pipe network, extracts water pipe network features and evolves graph network parameters, and detects and locates the positive sample distribution estimation of SOS flow. Compared with the traditional detection method, the present method proposes a water pipe network leakage detection method based on a graph neural network, divides the water pipe network data into graph snapshots, extracts node neighborhood features through graph space attention, and extracts node time series information graph features using graph time attention, thereby improving the leakage detection accuracy of the water pipe network graph snapshot. The unbiased estimation of the distribution of graph embedding is calculated by conditional flow and SOS flow, starting from the difference in the distribution of normal data and leakage data, which overcomes the disadvantage of requiring leakage labels for leakage detection. The model parameter evolution strategy is used to make the model suitable for the actual scenario of dynamic evolution.

Claims

1. An unsupervised water pipe network leakage detection method based on discrete-time dynamic graph network, characterized by: The specific process includes the following: first, the graph structure is defined according to the spatial topological structure of the pipeline nodes; second, the data collected by the pressure sensors arranged in the water pipe network are divided into graph snapshots according to the length of the time series; then, the graph attention network is used to learn the graph embedding representation in the graph snapshot, and the graph embedding representation is sent to the SOS flow model for unsupervised positive sample density estimation and online leakage detection. The RNN model is used to evolve the graph parameters between the graph snapshots to realize the dynamic update of the graph model.

2. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 1 is characterized in that: The specific steps include: Step 1: Download the water pipe network leakage test dataset LeakDB and divide the dataset into the non-leakage water pipe network pressure training set F and the non-leakage water pipe network pressure training set F according to m:n. train And there is leakage water pipe network pressure test set F test , the true value set of the test set is GTest, and the set of pressure sensors deployed in the water pipe network corresponding to the LeakDB dataset is V = {v1,v2,…,v n ,…,v N }, where v n Represents the sensor of the nth node, 1≤n≤N, N is the total number of pressure sensors, in, and F train and F test The nth pressure sensor v n The pressure value at time t, 1≤t≤T, T is the time series length of the pressure time series signal; Step 2: Define a graph structure G = (V, E) according to the spatial topological structure of the pressure sensors arranged in the water pipe network, where V and E are the nodes and edges of the graph respectively, and E = {(v i ,v j )1≤i≤N,1≤j≤N,i≠j}, the graph structure G is represented by the adjacency matrix A, δ i,j Indicates whether two nodes are connected; Step 3: Calculate F according to the length of the time series. train Perform graph snapshot partitioning to obtain the graph snapshot set G train =[g1,g2,…,g k ,…,g K ], the length of each snapshot signal is ΔT, g k is the kth graph snapshot, 1≤k≤K, K is the total number of graph snapshots, K=int(T / ΔT), int(·) represents the floor function, g k =(F k ,A),F k is the kth graph snapshot g k The corresponding training set F train Medium pressure time series signal set, Step 4, construct a discrete time dynamic graph network structure Net; Step 5: training the network model; Step 6, on the test set F test The model is tested on the network to obtain the unsupervised water network leakage detection results.

3. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 2 is characterized in that: In step 4, the discrete time dynamic graph network structure is Net = {(NG1, NS1), RNN 1→2 ,…(NG k ,NS k ),RNN k→k+1 ,…(NG K ,NS K )}; where NG k NS k and RNN k→k+1 Represents a graph snapshot g k The graph attention network, SOS flow network, and g k and g k+1 RNNRNN between graph snapshots k-1→k ; Graph Attention NetworkNG k Divided into graph space attention network NGS k and Graph Temporal Attention Network NGT k ;SOS flow network NS k Including SOS() forward transformation, SOS_inverse() reverse transformation and FNN subnetwork FNN k ;RNN k-1→k Includes two fully connected layers; Graph Spatial Attention Network NGS k Consists of three fully connected layers, graph temporal attention network NGT k It consists of causal convolution, dilated convolution and 1D convolution; The graph space attention network implements mutual attention calculation Attention() to enhance features after three layers of full connection. The graph time attention is enhanced by gated activation units after convolution operation to obtain graph embedding representation. The SOS stream network transforms the input data into a normal distribution through the SOS() forward transformation, and transforms the data in the normal distribution back to the input data space through the SOS_inverse() inverse transformation; RNN updates the graph attention network parameters between snapshots through full connection.

4. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 3 is characterized in that: The specific steps of step 5 are as follows: Step 5.1, define the number of graph snapshots variable k, initialize it to 1, and define the condition variable C k , define the overall network parameters as Model = {W1, WR1, ...W k ,WR k …,W K }, the kth snapshot g k Network parameters in and Represents the kth graph snapshot g respectively k Learnable graph parameters and flow parameters, WR k represents the snapshot-to-snapshot RNN, g k The flow distribution parameter is expressed as (μ k ,σ k ), randomly initialize g1 according to uniform distribution Initialize the flow distribution parameters of g1 μ1=0, σ1=1, and the network parameters Parameters of the graph space attention sub-network and graph temporal attention subnetwork parameters W t k Composition, that is Initialize the network model Model, Model = W1; Step 5.2, F train The k-th graph snapshot g in k As input, it is fed into the graph space attention network NG k and Graph Temporal Attention Network NS k , using the parameter and W t k , forward calculation to get the graph embedding representation X k ; Step 5.3, initialize the condition variable C1 = X1, and set X k With C k After being connected in series, they are sent to the kth SOS flow network NS k , perform SOS flow forward transformation, calculate flow model loss, and obtain the flow transformed data Z k ; Step 5.4, from the conditional distribution The data Z′ with a length of ΔT is sampled in k-1 , put Z′ k-1 Send to SOS stream network NS k , the inverse transformation is make Put C k+1 Send to FNN layer, output mean μ k+1 and variance σ k+1 ; Step 5.5, set the graph network parameters Send it to the recurrent neural network RNN ​​and predict g k Graph network parameters Step 5.6, update Model, determine whether k is equal to K, if so, Model = Model + W k , otherwise Model=Model+W k +WR k ; Step 5.7, let k = k + 1, determine whether k is less than or equal to K, if so, proceed to step 5.2, otherwise, end training and output the network model Model.

5. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 4 is characterized in that: The specific steps of step 5.2 are as follows: Step 5.2.1, for snapshot g k =(F k ,A), extract g k Current node v n Neighborhood nodes Current node v n and neighboring nodes The features are represented as f n (t) and Step 5.2.2, put f n (t) is used as input and transformed by the fully connected layer FC1 of the graph space attention network to obtain the mutual attention mechanism As shown in formula (1); As input, after the fully connected layer FC2 transformation of the graph space attention network, the open source torch library function transpose() function is called to obtain and As shown in formula (2); As input, after being transformed by the fully connected layer FC3 of the graph space attention network, we get As shown in formula (3); where Query k Represents the query vector, Key k Represents the key vector, Value k Represents a vector of values: Queryk=FC1(f n (t)) (1) Step 5.2.3, Query k 、Key k and Value k As input, the mutual attention calculation formula Attention() is used, as shown in formula (4), to enhance the current node feature, where d Key is the feature key k Dimension size; Softmax() is an open source torch data activation library function that calculates the current node v n The enhanced features (f n (t))': Step 5.2.4, the feature (f n (t))' is used as input and transformed by the fully connected FC3 layer of the graph space attention network to obtain the output feature of the graph space attention sub-network (f n (t))”=FC3((f n (t))'); Step 5.2.5, feature F' k ={(f n (t))”t∈[(k-1)×ΔT,k×ΔT],n∈[1,N]} as input, and the causal convolution layer CauConv of the temporal graph temporal attention network outputs the feature F k ″; Step 5.2.6, define the total number of layers of the residual network as L, the number of residual layers as l, l is initialized to 1, i.e. l ​​= 1, and the characteristic variable of the lth residual layer is h l ,h 1 Initialize to F″ k , that is, h 1 =F″ k ; Step 5.2.7, the l-th layer feature h l The hyperbolic tangent activation function tanh() and the sigmoid activation function σ() are respectively sent to the graph time attention network, and then sent to the unit gated linear unit to obtain h l Enhanced features (h l )'; (h l )'=GLU(tanh(h l ),σ(h l )) (5) Step 5.2.8, enhance the feature (h l )' and the l-th layer feature h l Add together to get the l+1th layer input feature h l+1 ,h l+1 =(h l )'+h l ; Step 5.2.9, let l = l + 1, determine whether l is less than L, if the condition is met, go to step 5.2.7; Step 5.2.10, add the accumulated features h 1 +…+h l +…+h L After passing through the convolutional layers Conv4 and Conv5 of the graph time attention network, the reduced dimension feature X is obtained. k , as shown in formula (6): X k =Conv5(Conv4((h 1 +…+h l +…+h L ))) (6)。 6. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 5 is characterized in that: The specific steps of step 5.3 are as follows: Step 5.3.1, input X k With condition C k , sent to the SOS flow network NS k Get the data Z after the forward flow transformation k and the Jacobian matrix determinant logdet k , as shown in formula (7): (Z k ,logdet k )=SOS(X k ,C k ) (7) Where SOS() represents the forward transformation of the flow model; Step 5.3.2, calculate Z k With conditional distribution The maximum likelihood estimate of logprobs k , as shown in formula (8), calculate the loss Loss k As shown in formula (9); Loss k =-(logprobs k +logdet k ) (9)。 7. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 6 is characterized in that: The specific steps of step 5.4 are as follows: Step 5.4.1, from the conditional distribution Randomly sample data Z of length ΔT k ′, and sent to the SOS stream for inverse transformation, we get As shown in formula (10), let Among them, SOS_inverse() represents the inverse transformation of the SOS stream; Step 5.4.2, put C k+1 Send to FNN layer, output mean μ k+1 and variance σ k+1 , as shown in formula (11): m k+1 ,s k+1 =FNN(C k+1 ) (11) Among them, FNN() represents the fully connected transformation.

8. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 7 is characterized in that: The specific steps of step 5.5 are as follows: Step 5.5.1, input parameters of graph space attention network After RNN, we use the open source GRU to get the updated graph space attention network parameters As shown in formula (12); Step 5.5.2, input the parameters W of the graph temporal attention network t k , after GRU, we get the updated graph space attention network parameters W t k+1 , as shown in formula (13); IN t k+1 =DEC(IN t k ) (13)。 9. The unsupervised water pipe network leakage detection method based on discrete time dynamic graph network according to claim 8 is characterized in that: The specific steps of step 6 are as follows: Step 6.1: Set the test set F test and the true value label GT test Input into the trained network model; Step 6.2: Calculate F according to the length of the time series. test Perform graph snapshot partitioning to obtain the graph snapshot set G test =[g1,g2,…,g m ,…,g M ], the length of each snapshot signal is ΔT, g m is the mth graph snapshot, 1≤m≤M, M is the total number of graph snapshots, M=int(T / ΔT), int(·) represents the floor function, g m =(D m ,A),D m is the test set F corresponding to the mth graph snapshot test Medium pressure time series signal set, Define the snapshot number variable m, initialize m=1, and define snapshot g m The condition variable C m and flow distribution parameters (μ m ,σ m ), initialize μ1=0, σ1=0; Step 6.3, take the mth test image snapshot g m Send to the trained graph attention network structure NG k , using the model Forward transformation obtains the graph embedding representation X m , initialize C1 = X1, and then C m and X m After concatenation, it is sent into the trained SOS flow network structure NS k , using the model Forward transform to get Z m , Jacobian matrix determinant logdet m , using the flow model Z m The inverse transformation is Otherwise, let Put C m+1 Send to FNN layer, output mean μ m+1 and variance σ m+1 ; Step 6.4, use KL divergence to calculate snapshot g m In distribution The leakage anomaly fraction η under m , as shown in formula (14), η m Write the test result set PTest, that is, PTest = PTest + η m ; Step 6.5, set threshold θ, η m is greater than θ, then it is considered that g m , that is, leakage occurred during the time period t∈[(m-1)×ΔT,m×ΔT]; Step 6.6, let m = m + 1, determine whether m is less than or equal to M, if so, go to step 6.3, otherwise, end the test and output the anomaly score set PTest; call the function roc_auc_score in the open source library sklearn to calculate the AUC score and calculate PTest and GT test The differences between them are used to evaluate the model performance. AUC=roc_auc_score(PTest,GT test ) (15)。

Citation Information

Patent Citations

  • Water supply pipeline leakage detection method based on graph neural network

    CN115654381A

  • Dynamic graph link generation method

    CN116306780A

  • Internet of Things signal anomaly detection method and system based on graph neural network

    CN117009900A

  • Point-level and segment-level prediction combined end-to-end water pipe network leakage period positioning method

    CN117435971A

  • Dynamic graph anomaly detection method based on dual self-attention

    WO2023130727A1