Electricity consumption anomaly detection method based on fusion of learnable temporal graph and periodic convolution

CN122528002APending Publication Date: 2026-08-07SOUTHEAST UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTHEAST UNIV
Filing Date
2026-07-09
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]本申请实施例提供了一种基于可学习时序图与周期卷积融合的用电异常检测方法、装置、终端设备及存储介质,可以解决当前方法存在难以同时刻画用户用电行为中的非连续时间关联关系与周期局部模式,导致在复杂用电场景下对隐蔽性窃电行为的识别能力不足的问题

Benefits of technology

[0063]Beneficial Effects: This application achieves accurate detection of abnormal electricity consumption by fusing learnable time-series graphs with periodic convolutions, offering the following benefits: First, by setting trainable embedding vectors for time nodes and constructing a Mahalanobis metric matrix to adaptively learn node similarity relationships to build a weighted time graph, it effectively characterizes potential electricity consumption correlations between non-adjacent time nodes, overcoming the limitations of fixed graph structures and improving the ability to identify intermittent electricity theft and concealed anomalies. Second, by reconstructing a one-dimensional electricity consumption sequence into a periodic two-dimensional matrix according to a preset period length, it utilizes two-dimensional convolutions to simultaneously extract cross-period changes and intra-period local patterns, explicitly modeling the periodicity of electricity consumption behavior. Third, by employing collaborative modeling with graph convolution branches and periodic convolution branches, it fuses temporal correlation features with periodic local features, enabling the model to simultaneously possess global temporal awareness and local periodic modeling capabilities. Fourth, by performing missing data completion, outlier suppression, and normalization processing on the data before inputting it into the model, it reduces interference from data collection anomalies and differences in user scale, improving model robustness. This application can be widely applied to scenarios such as abnormal electricity consumption screening, line loss management, and electricity marketing audits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122528002A_ABST
    Figure CN122528002A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of electric power data analysis, and provides an electricity abnormality detection method based on learning time series graph and cycle convolution fusion, comprising the following steps: first, obtaining user historical electricity data and preprocessing to obtain standardized electricity sequence; then, reconstructing the standardized electricity sequence into a cycle two-dimensional electricity matrix according to a preset cycle length, and setting a trainable embedding vector for each time node, constructing a Mahalanobis metric matrix based on the trainable matrix to calculate the distance between nodes and constructing a weighted time graph. Then, inputting the standardized electricity sequence into a graph convolution network to extract time series correlation features, and inputting the cycle two-dimensional matrix into a two-dimensional convolution network to extract cycle local features; finally, inputting the two types of features into a classifier after fusion to output the user abnormal electricity probability, and completing the abnormal electricity detection. The application can learn the non-continuous correlation of the time series graph, extract the cycle mode in combination with the cycle convolution, and fuse the features to enhance the hidden electricity stealing identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of power data analysis technology, and in particular relates to a method for detecting power consumption anomalies based on the fusion of learnable time series graphs and periodic convolution. Background Technology

[0002] With the continuous advancement of smart grid construction, smart meters are widely used on the distribution network side, enabling power companies to collect massive amounts of historical load data from users, providing a data foundation for detecting electricity anomalies and investigating electricity theft. Currently, commonly used methods for detecting electricity anomalies include: traditional rule-based screening methods based on indicators such as sudden changes in electricity consumption and abnormal line losses; classification methods based on machine learning models such as support vector machines, random forests, and gradient boosting trees; and time-series feature extraction methods based on deep learning models such as convolutional neural networks and graph convolutional networks.

[0003] However, current methods have the problem of failing to simultaneously characterize the non-continuous temporal correlations and periodic local patterns in users' electricity consumption behavior, resulting in insufficient ability to identify covert electricity theft in complex electricity consumption scenarios. Summary of the Invention

[0004] This application provides a method, apparatus, terminal device, and storage medium for detecting abnormal electricity consumption based on the fusion of learnable temporal graphs and periodic convolutions. This can solve the problem that current methods have difficulty simultaneously depicting the non-continuous temporal correlations and periodic local patterns in users' electricity consumption behavior, resulting in insufficient ability to identify covert electricity theft in complex electricity consumption scenarios.

[0005] In a first aspect, embodiments of this application provide a method for detecting abnormal electricity consumption based on the fusion of learnable time series graphs and periodic convolution, comprising: S1, acquiring historical electricity consumption data of multiple users and constructing user electricity consumption sequences; S2, performing missing value completion, outlier suppression, and normalization processing on the user electricity consumption sequences to obtain standardized electricity consumption sequences; S3, periodically reconstructing the standardized electricity consumption sequences according to a preset period length to obtain a periodic two-dimensional electricity consumption matrix; S4, setting trainable time node embedding vectors for each time node in the time series, constructing a Mahalanobis metric matrix based on the trainable matrix, and calculating the time nodes according to the Mahalanobis metric matrix. S5. The electricity consumption value of each time node in the standardized electricity consumption sequence is used as the initial feature of the corresponding graph node, and the weighted time graph is used as the graph structure input into the graph convolutional network to extract the temporal correlation features of user electricity consumption behavior; S6. The periodic two-dimensional electricity consumption matrix is ​​input into the two-dimensional convolutional network to extract the periodic local features of user electricity consumption behavior; S7. The temporal correlation features and the periodic local features are fused to obtain fused features, and the fused features are input into the classifier to obtain the probability of abnormal user electricity consumption, and the abnormal electricity consumption detection result is determined according to the probability of abnormal user electricity consumption.

[0006] In one possible implementation of the first aspect, the user electricity consumption sequence of the i-th user is: The above S2 process involves performing missing value completion, outlier suppression, and normalization on the user's electricity consumption sequence to obtain a standardized electricity consumption sequence, specifically including:

[0007] When the electricity consumption value at any time point t is missing, but valid values ​​exist at all the adjacent time points before and after it, the missing position is filled in based on the valid electricity consumption values ​​of the adjacent time points:

[0008] ;

[0009] in, Let be the electricity consumption value of the i-th user at the t-th time point;

[0010] When at least one position in an adjacent time node does not have a valid value, the missing position is filled according to a preset value;

[0011] Let the mean of the electricity consumption sequence of the i-th user be... The standard deviation is The upper bound for outlier truncation is determined as follows:

[0012]

[0013] when At that time, Cut off as ;

[0014] Normalize the user's electricity consumption sequence:

[0015]

[0016] Obtain the standardized electricity consumption sequence of the i-th user. .

[0017] Optionally, in another possible implementation of the first aspect, S3 above, periodically reconstructing the standardized electricity consumption sequence according to a preset period length to obtain a periodic two-dimensional electricity consumption matrix, specifically includes:

[0018] Determine whether the length of the standardized electricity consumption sequence is divisible by the preset cycle length;

[0019] When the length of the standardized electricity consumption sequence cannot be divided by the preset period length, a preset value is added to the end of the standardized electricity consumption sequence so that the length of the added sequence can be divided by the preset period length.

[0020] The supplemented standardized electricity consumption sequence is rearranged according to a preset period length to construct a periodic two-dimensional electricity consumption matrix; where each row of the periodic two-dimensional electricity consumption matrix corresponds to a complete period, and each column of the periodic two-dimensional electricity consumption matrix corresponds to a fixed time position within the period.

[0021] Optionally, in another possible implementation of the first aspect, S4 above involves setting trainable time node embedding vectors for each time node in the time series, constructing a Mahalanobis metric matrix based on the trainable matrix, calculating the distance between time nodes based on the Mahalanobis metric matrix, determining the adjacency relationship and edge weights between time nodes based on the distance, and constructing a weighted time graph, specifically including:

[0022] Let the embedding vector of the p-th time node be... The embedding vector of the q-th time node is Construct a positive semidefinite metric matrix using a trainable matrix A: ;

[0023] Calculate the Mahalanobis distance between time nodes p and q:

[0024]

[0025] Where d(p,q) represents the Mahalanobis distance between the p-th time node and the q-th time node;

[0026] For each time node, select the k time nodes with the smallest distance as its nearest neighbors and establish edge connections between the time nodes.

[0027] For the connected time nodes p and q, the edge weights are determined using a negative exponential function of the distance:

[0028]

[0029] Among them, w pq Let represent the edge weight between the p-th time node and the q-th time node;

[0030] Based on the nearest neighbor nodes and edge weights, a weighted time graph is obtained. Where V represents the set of time nodes, E represents the set of edges obtained based on k nearest neighbors, and W represents the set of edge weights.

[0031] Optionally, in another possible implementation of the first aspect, S5 above uses the electricity consumption value of each time node in the standardized electricity consumption sequence as the initial feature of the corresponding graph node, and uses a weighted time graph as the graph structure input to the graph convolutional network to extract the temporal correlation features of user electricity consumption behavior, specifically including:

[0032] For the standardized electricity consumption sequence of the i-th user, each time node on its time axis is considered as a node in a weighted time graph. The electricity consumption value at each time node in the standardized electricity consumption sequence is used as the initial feature of the corresponding graph node. Then, the initial graph node feature matrix of the i-th user can be expressed as: Where T is the number of time points. This indicates that the matrix is ​​a real number matrix with dimensions of T rows and 1 column, that is, the one-dimensional electricity consumption value is directly used as the initial feature of the graph node;

[0033] The edge weights of the weighted temporal graph are normalized, and self-loop connections are added to the weighted temporal graph to obtain the normalized weighted adjacency matrix. ;

[0034] The graph convolutional network consists of two graph convolutional layers. The first graph convolutional layer maps the one-dimensional electricity consumption value at each time point to a 16-dimensional implicit representation. The computation process is as follows:

[0035]

[0036] in This is the feature matrix output by the convolutional layer of the first image; It is a linear rectified nonlinear activation function, used to introduce the nonlinear expressive power of the network; This represents the feature aggregation and forward propagation operations of the convolutional layer in the first graph;

[0037] The second convolutional layer continues to propagate and aggregate features on the weighted temporal graph, obtaining a higher-order temporal correlation representation. Its computation process is as follows:

[0038]

[0039] in, This is the high-order temporal correlation feature matrix output by the second convolutional layer after further propagation and aggregation on the weighted temporal graph. This represents the feature aggregation and forward propagation operations of the second convolutional layer.

[0040] Will After performing a dimensionality transformation, the temporal dimension is pooled using a max-pooling layer with a kernel size of 2. The pooled features are then unfolded into a one-dimensional vector, input into a fully connected layer, and mapped to 32-dimensional temporal correlation features.

[0041]

[0042] in, The weight matrix of the fully connected layer at the end of the graph convolutional branch is used to linearly map the unfolded one-dimensional vector to fixed-length temporal correlation features. The bias term Bias parameter is used for the fully connected layer at the end of the convolutional branch in the graph. This is a flattening function used to expand multidimensional pooling features into a one-dimensional vector; This is the graph pooling feature matrix output after dimensionality reduction processing by the max pooling layer, and , Max pooling function, This is the feature tensor obtained by dimensionality transformation of the output of the second-layer graph convolution.

[0043] Optionally, in another possible implementation of the first aspect, S6 above, inputting the periodic two-dimensional electricity consumption matrix into a two-dimensional convolutional network to extract periodic local features of user electricity consumption behavior, specifically includes:

[0044] A two-dimensional periodic electricity consumption matrix It is extended to a single-channel input, where H represents the number of cycles, P represents the preset cycle length, the row direction of the matrix corresponds to cross-cycle changes, and the column direction corresponds to the power consumption differences at different time positions within the cycle;

[0045] The expanded periodic two-dimensional power consumption matrix is ​​input into a two-dimensional convolutional network. This network comprises two two-dimensional convolutional layers and two two-dimensional max-pooling layers. The first two-dimensional convolutional layer has 1 input channel, 8 output channels, and a 2×2 kernel size. The second two-dimensional convolutional layer has 8 input channels, 16 output channels, and a 2×2 kernel size. Specifically, it includes:

[0046] The first convolution feature is obtained by performing convolution operation on the periodic two-dimensional electricity consumption matrix and extracting the local joint change pattern between adjacent periods and adjacent time positions within the period.

[0047] The first convolutional feature is downsampled using a 2×2 two-dimensional max pooling process to obtain the first pooled feature.

[0048] The first pooling feature is convolved to extract the composite periodic pattern of cross-cycle load evolution, intra-cycle electricity consumption pattern change and local load shape change, thus obtaining the second convolution feature;

[0049] The second convolutional features are downsampled using a 2×2 two-dimensional max pooling process to obtain the second pooled features;

[0050] The second pooling feature is unfolded into a one-dimensional vector and input into the fully connected layer, mapping it to periodic local features of fixed dimension. .

[0051] Optionally, in another possible implementation of the first aspect, S7 above, fusing the temporal correlation features and periodic local features to obtain fused features, inputting the fused features into a classifier to obtain the probability of abnormal power consumption by the user, and determining the abnormal power consumption detection result based on the probability of abnormal power consumption by the user, specifically includes:

[0052] Temporal correlation features and periodic local features By splicing the data, the fused features are obtained. ;

[0053] The fused features are input into a fully connected classifier to obtain a classification score. :

[0054]

[0055] in, This is the weight parameter matrix of the fully connected classifier; These are the bias parameters for the fully connected classifier;

[0056] The classification score is mapped to the probability of abnormal electricity consumption using the Sigmoid probability mapping function:

[0057]

[0058] in, Represents a probability mapping function;

[0059] when When the electricity consumption exceeds a preset threshold, the corresponding user will be identified as an abnormal electricity user or a suspected electricity thief; when If the value is less than or equal to the preset threshold, the user is considered a normal electricity user.

[0060] Secondly, embodiments of this application provide an electricity consumption anomaly detection device based on the fusion of learnable time series graphs and periodic convolution, comprising: a first construction module for acquiring historical electricity consumption data of multiple users and constructing user electricity consumption sequences; a standardization processing module for performing missing value completion, outlier suppression, and normalization processing on the user electricity consumption sequences to obtain standardized electricity consumption sequences; a reconstruction module for periodically reconstructing the standardized electricity consumption sequences according to a preset period length to obtain a periodic two-dimensional electricity consumption matrix; and a second construction module for setting trainable time node embedding vectors for each time node in the time series, constructing a Mahalanobis metric matrix based on the trainable matrix, and calculating the time based on the Mahalanobis metric matrix. The distance between time nodes is used to determine the adjacency relationship and edge weight between time nodes, and a weighted time graph is constructed. The first extraction module is used to take the electricity consumption value of each time node in the standardized electricity consumption sequence as the initial feature of the corresponding graph node, and use the weighted time graph as the graph structure to input the graph convolutional network to extract the temporal correlation features of user electricity consumption behavior. The second extraction module is used to input the periodic two-dimensional electricity consumption matrix into the two-dimensional convolutional network to extract the periodic local features of user electricity consumption behavior. The fusion classification module is used to fuse the temporal correlation features and the periodic local features to obtain fused features, and input the fused features into a classifier to obtain the probability of abnormal user electricity consumption, and determine the abnormal electricity consumption detection result based on the probability of abnormal user electricity consumption.

[0061] Thirdly, embodiments of this application provide a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the aforementioned method for detecting abnormal power consumption based on the fusion of learnable time sequence graphs and periodic convolution.

[0062] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the aforementioned method for detecting abnormal power consumption based on the fusion of a learnable timing graph and periodic convolution.

[0063] Beneficial Effects: This application achieves accurate detection of abnormal electricity consumption by fusing learnable time-series graphs with periodic convolutions, offering the following benefits: First, by setting trainable embedding vectors for time nodes and constructing a Mahalanobis metric matrix to adaptively learn node similarity relationships to build a weighted time graph, it effectively characterizes potential electricity consumption correlations between non-adjacent time nodes, overcoming the limitations of fixed graph structures and improving the ability to identify intermittent electricity theft and concealed anomalies. Second, by reconstructing a one-dimensional electricity consumption sequence into a periodic two-dimensional matrix according to a preset period length, it utilizes two-dimensional convolutions to simultaneously extract cross-period changes and intra-period local patterns, explicitly modeling the periodicity of electricity consumption behavior. Third, by employing collaborative modeling with graph convolution branches and periodic convolution branches, it fuses temporal correlation features with periodic local features, enabling the model to simultaneously possess global temporal awareness and local periodic modeling capabilities. Fourth, by performing missing data completion, outlier suppression, and normalization processing on the data before inputting it into the model, it reduces interference from data collection anomalies and differences in user scale, improving model robustness. This application can be widely applied to scenarios such as abnormal electricity consumption screening, line loss management, and electricity marketing audits. Attached Figure Description

[0064] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0065] Figure 1 This is a flowchart illustrating a power consumption anomaly detection method based on the fusion of learnable timing graphs and periodic convolution, provided in an embodiment of this application.

[0066] Figure 2 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application;

[0067] Figure 3 This is a schematic diagram of the structure of an abnormal power consumption detection device based on the fusion of learnable timing graphs and periodic convolution, provided in an embodiment of this application. Detailed Implementation

[0068] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0069] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0070] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0071] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0072] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0073] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0074] The following description, with reference to the accompanying drawings, details a method, apparatus, terminal device, and storage medium for detecting power consumption anomalies based on the fusion of learnable timing graphs and periodic convolutions, provided in this application.

[0075] Figure 1 The illustration shows a flowchart of a power consumption anomaly detection method based on the fusion of learnable timing graphs and periodic convolution provided in an embodiment of this application.

[0076] like Figure 1 As shown, the power consumption anomaly detection method based on the fusion of learnable temporal graphs and periodic convolution includes the following steps:

[0077] S1. Obtain historical electricity consumption data from multiple users and construct user electricity consumption sequences;

[0078] Because user electricity consumption sequences may be affected by communication interruptions, equipment failures, acquisition delays, or metering errors during actual data collection, missing values, abnormal spikes, and amplitude scale differences between different users may exist in the user electricity consumption sequences. To reduce the impact of data quality issues on subsequent detection models, this application performs uniform preprocessing on the user electricity consumption sequences of each user.

[0079] S2. Perform missing value completion, outlier suppression, and normalization on the user's electricity consumption sequence to obtain a standardized electricity consumption sequence;

[0080] Furthermore, in this embodiment of the application, let the user electricity consumption sequence of the i-th user be... The above S2 process involves performing missing value completion, outlier suppression, and normalization on the user's electricity consumption sequence to obtain a standardized electricity consumption sequence, specifically including:

[0081] When the electricity consumption value at any time point t is missing, but valid values ​​exist at all the adjacent time points before and after it, the missing position is filled in based on the valid electricity consumption values ​​of the adjacent time points:

[0082] ;

[0083] in, Let be the electricity consumption value of the i-th user at the t-th time point;

[0084] When at least one position in an adjacent time node does not have a valid value, the missing position is filled according to a preset value;

[0085] Let the mean of the electricity consumption sequence of the i-th user be... The standard deviation is The upper bound for outlier truncation is determined as follows:

[0086]

[0087] when At that time, Cut off as ;

[0088] Normalize the user's electricity consumption sequence:

[0089]

[0090] Obtain the standardized electricity consumption sequence of the i-th user. .

[0091] It should be noted that upper bound suppression is applied to abnormally high electricity consumption values. This treatment can reduce the interference of extreme abnormal spikes on the model training process.

[0092] As one possible implementation, when When this happens, the user's normalized sequence can be set as the zero vector.

[0093] Electricity consumption behavior typically exhibits a clear periodicity. For example, residential users may consume electricity differently on weekdays and weekends, while commercial users may show regular variations on different days of the week. If electricity consumption data is only used as a one-dimensional sequence input model, it is difficult to explicitly represent this periodic structure. Therefore, this application reconstructs the standardized one-dimensional electricity consumption sequence into a periodic two-dimensional electricity consumption matrix.

[0094] S3. Reconstruct the standardized electricity consumption sequence according to the preset cycle length to obtain a two-dimensional cycle electricity consumption matrix;

[0095] Furthermore, in this embodiment, the above-mentioned S3, reconstructing the standardized electricity consumption sequence according to a preset period length to obtain a periodic two-dimensional electricity consumption matrix, specifically includes:

[0096] Determine whether the length of the standardized electricity consumption sequence is divisible by the preset cycle length;

[0097] When the length of the standardized electricity consumption sequence cannot be divided by the preset period length, a preset value is added to the end of the standardized electricity consumption sequence so that the length of the added sequence can be divided by the preset period length.

[0098] The supplemented standardized electricity consumption sequence is rearranged according to a preset period length to construct a periodic two-dimensional electricity consumption matrix; where each row of the periodic two-dimensional electricity consumption matrix corresponds to a complete period, and each column of the periodic two-dimensional electricity consumption matrix corresponds to a fixed time position within the period.

[0099] In one embodiment, the preset period length is P. For daily electricity consumption data, P can be 7, representing 7 days a week. When the sequence length T is not divisible by P, r preset values ​​are padded to the end of the sequence, such that... .and It is divisible by P. Then, the length... The sequence is rearranged into a two-dimensional matrix. ,in .matrix Each row of the matrix represents a complete cycle, and each column of the matrix represents a fixed time position within the cycle.

[0100] In another embodiment, the original user daily electricity consumption sequence has a length of 1035. Since 1035 is not divisible by 7, this invention adds a preset value to the end of the sequence, making the sequence length 1036, and then rearranges it into a 148×7148 two-dimensional weekly-daily electricity consumption matrix. The 148 rows of this matrix correspond to 148 weekly cycles, and the 7 columns correspond to the 7 days of each week. This process is consistent with the process in the code of constructing the CNN input matrix after padding the one-dimensional sequence.

[0101] To characterize the potential similarity of electricity consumption behavior between different time points, this application does not directly use a fixed adjacent time map, but instead constructs a trainable embedding vector for each time point on the time axis and uses Mahalanobis metric to adaptively learn the correlation between time points.

[0102] S4. Set a trainable time node embedding vector for each time node in the time series, construct a Mahalanobis metric matrix based on the trainable matrix, calculate the distance between time nodes according to the Mahalanobis metric matrix, determine the adjacency relationship and edge weight between time nodes according to the distance, and construct a weighted time graph.

[0103] Furthermore, in this embodiment, S4 above, setting a trainable time node embedding vector for each time node in the time series, constructing a Mahalanobis metric matrix based on the trainable matrix, calculating the distance between time nodes based on the Mahalanobis metric matrix, determining the adjacency relationship and edge weight between time nodes based on the distance, and constructing a weighted time graph, specifically includes:

[0104] Let the embedding vector of the p-th time node be... The embedding vector of the q-th time node is Construct a positive semidefinite metric matrix using a trainable matrix A: ;

[0105] Calculate the Mahalanobis distance between time nodes p and q:

[0106]

[0107] Where d(p,q) represents the Mahalanobis distance between the p-th time node and the q-th time node;

[0108] It should be noted that this distance is used to measure the similarity between different time points in the learnable latent space. The smaller the distance, the more similar the electricity consumption behavior patterns between the two time points.

[0109] For each time node, select the k time nodes with the smallest distance as its nearest neighbors and establish edge connections between the time nodes.

[0110] For the connected time nodes p and q, the edge weights are determined using a negative exponential function of the distance:

[0111]

[0112] Among them, w pq Let represent the edge weight between the p-th time node and the q-th time node;

[0113] Based on the nearest neighbor nodes and edge weights, a weighted time graph is obtained. Where V represents the set of time nodes, E represents the set of edges obtained based on k nearest neighbors, and W represents the set of edge weights.

[0114] As a possible implementation, to enhance the numerical stability of graph convolution computation, the edge weights can be further normalized, and self-loop connections can be added to the time graph.

[0115] In this embodiment, the temporal graph is shared for samples from the same batch of users. That is, the graph structure between time nodes is determined by the time node embedding vector and the Mahalanobis metric matrix, rather than by a single user. This allows the model to learn a temporal correlation structure applicable to the overall detection task.

[0116] S5. The electricity consumption values ​​at each time point in the standardized electricity consumption sequence are used as the initial features of the corresponding graph nodes, and the weighted time graph is used as the graph structure input graph convolutional network to extract the temporal correlation features of user electricity consumption behavior.

[0117] Furthermore, in this embodiment, S5 above, using the electricity consumption value of each time node in the standardized electricity consumption sequence as the initial feature of the corresponding graph node, and using a weighted time graph as the graph structure input to the graph convolutional network, extracts the temporal correlation features of user electricity consumption behavior, specifically including:

[0118] For the standardized electricity consumption sequence of the i-th user, each time node on its time axis is considered as a node in a weighted time graph. The electricity consumption value at each time node in the standardized electricity consumption sequence is used as the initial feature of the corresponding graph node. Then, the initial graph node feature matrix of the i-th user can be expressed as: Where T is the number of time points. This indicates that the matrix is ​​a real number matrix with dimensions of T rows and 1 column, that is, the one-dimensional electricity consumption value is directly used as the initial feature of the graph node;

[0119] The edge weights of the weighted temporal graph are normalized, and self-loop connections are added to the weighted temporal graph to obtain the normalized weighted adjacency matrix. ;

[0120] The graph convolutional network consists of two graph convolutional layers. The first graph convolutional layer maps the one-dimensional electricity consumption value at each time point to a 16-dimensional implicit representation. The computation process is as follows:

[0121]

[0122] in This is the feature matrix output by the convolutional layer of the first image; It is a linear rectified nonlinear activation function, used to introduce the nonlinear expressive power of the network; This represents the feature aggregation and forward propagation operations of the convolutional layer in the first graph;

[0123] The second convolutional layer continues to propagate and aggregate features on the weighted temporal graph, obtaining a higher-order temporal correlation representation. Its computation process is as follows:

[0124]

[0125] in, This is the high-order temporal correlation feature matrix output by the second convolutional layer after further propagation and aggregation on the weighted temporal graph. This represents the feature aggregation and forward propagation operations of the second convolutional layer.

[0126] Will After performing a dimensionality transformation, the temporal dimension is pooled using a max-pooling layer with a kernel size of 2. The pooled features are then unfolded into a one-dimensional vector, input into a fully connected layer, and mapped to 32-dimensional temporal correlation features.

[0127]

[0128] in, The weight matrix of the fully connected layer at the end of the graph convolutional branch is used to linearly map the unfolded one-dimensional vector to fixed-length temporal correlation features. The bias term Bias parameter is used for the fully connected layer at the end of the convolutional branch in the graph. This is a flattening function used to expand multidimensional pooling features into a one-dimensional vector; This is the graph pooling feature matrix output after dimensionality reduction processing by the max pooling layer, and , Max pooling function, This is the feature tensor obtained by dimensionality transformation of the output of the second-layer graph convolution.

[0129] In this embodiment, by using the graph convolution branch described above, the implicit relationships between time nodes can be introduced into the user electricity consumption behavior modeling process. Compared with methods that only perform convolution or recursive modeling along the original time sequence, this branch can utilize a learnable graph structure to characterize the similarity relationships between non-adjacent time nodes, thereby enhancing the ability to identify complex and abnormal electricity consumption patterns.

[0130] S6. Input the periodic two-dimensional electricity consumption matrix into a two-dimensional convolutional network to extract the periodic local features of user electricity consumption behavior;

[0131] Furthermore, in this embodiment, S6, inputting the periodic two-dimensional electricity consumption matrix into a two-dimensional convolutional network to extract periodic local features of user electricity consumption behavior, specifically includes:

[0132] A two-dimensional periodic electricity consumption matrix It is extended to a single-channel input, where H represents the number of cycles, P represents the preset cycle length, the row direction of the matrix corresponds to cross-cycle changes, and the column direction corresponds to the power consumption differences at different time positions within the cycle;

[0133] The expanded periodic two-dimensional power consumption matrix is ​​input into a two-dimensional convolutional network. This network comprises two two-dimensional convolutional layers and two two-dimensional max-pooling layers. The first two-dimensional convolutional layer has 1 input channel, 8 output channels, and a 2×2 kernel size. The second two-dimensional convolutional layer has 8 input channels, 16 output channels, and a 2×2 kernel size. Specifically, it includes:

[0134] The first convolution feature is obtained by performing convolution operation on the periodic two-dimensional electricity consumption matrix and extracting the local joint change pattern between adjacent periods and adjacent time positions within the period.

[0135] The first convolutional feature is downsampled using a 2×2 two-dimensional max pooling process to obtain the first pooled feature.

[0136] The first pooling feature is convolved to extract the composite periodic pattern of cross-cycle load evolution, intra-cycle electricity consumption pattern change and local load shape change, thus obtaining the second convolution feature;

[0137] The second convolutional features are downsampled using a 2×2 two-dimensional max pooling process to obtain the second pooled features;

[0138] The second pooling feature is unfolded into a one-dimensional vector and input into the fully connected layer, mapping it to periodic local features of fixed dimension. .

[0139] In one embodiment, a periodic two-dimensional power consumption matrix is ​​used. Expanded to single-channel input:

[0140]

[0141] in, The input matrix is ​​used to reshape the original periodic sequence into a two-dimensional "image". The two-dimensional convolution kernel slides simultaneously along the periodic direction and the intra-period direction, thus enabling the joint extraction of cross-period variations and intra-period local patterns. The r-th layer of the two-dimensional convolution can be represented as:

[0142]

[0143] in, This is the periodic structure feature map extracted by the r-th layer CNN. It is a nonlinear function (ReLU). For convolution kernel, This is a two-dimensional convolution operation. For the first Input feature maps of a layer CNN This is a bias term.

[0144] Specifically, the 2D convolutional network consists of two 2D convolutional layers and two 2D max-pooling layers. The first 2D convolutional layer has 1 input channel, 8 output channels, and a kernel size of 2×22. This layer is mainly used to extract local joint change patterns between adjacent weeks and adjacent dates, such as load changes of a user around the same workday in two consecutive weeks, or load pattern changes over two consecutive days within a week. After the first convolutional layer, the feature size changes from 1×148×7 to 8×147×6, and then after a 2×22 2D max-pooling layer, the feature size becomes 8×73×3. The first convolutional and pooling layers can preserve the periodic change features with strong local responses while reducing feature dimensionality and the impact of local noise. The second 2D convolutional layer has 8 input channels, 16 output channels, and the kernel size remains 2×22. This layer further combines higher-level periodic patterns based on the local features of the first layer to characterize complex patterns such as cross-weekly load evolution, disruption of intra-weekly electricity consumption patterns, sudden local load drops, and abnormal lows. After the second convolutional layer, the feature size changes from 8×73×3 to 16×72×2. After the second 2×22 max pooling layer, the feature size becomes 16×36×1.

[0145] This size change is consistent with the structural description of the CNN branch in the code, namely (148,7)→(147,6)→(73,3)→(72,2)→(36,1). Subsequently, the feature map after the second pooling layer is unfolded into a one-dimensional vector:

[0146]

[0147] in, The global periodic feature vector extracted by the CNN. The high-order feature map output from the second convolutional layer is then mapped to fixed-dimensional periodic local features through a fully connected layer.

[0148]

[0149] in, The final CNN branch outputs an embedding. This is the weight matrix of the fully connected layer. For bias terms of fully connected layers;

[0150] These 32-dimensional features are used to express intra-weekly daily patterns, inter-weekly variation patterns, and local cyclical anomalies in user electricity consumption behavior. Through the aforementioned periodic convolutional branch (two-dimensional convolutional network), this application can explicitly introduce the cyclical structure from the original one-dimensional electricity consumption sequence into the detection model. Compared to methods that directly perform convolution on the one-dimensional sequence, this branch can more clearly express the "week-day" structure, enabling the model to focus not only on changes at adjacent time points but also on load pattern differences between different dates within the same week, between adjacent weeks, and across local regions.

[0151] S7. The temporal correlation features and periodic local features are fused to obtain fused features. The fused features are then input into the classifier to obtain the probability of abnormal power consumption by users. The abnormal power consumption detection result is determined based on the probability of abnormal power consumption by users.

[0152] Furthermore, in this embodiment, the above-mentioned S7 step of fusing the temporal correlation features and periodic local features to obtain fused features, inputting the fused features into a classifier to obtain the probability of abnormal power consumption by the user, and determining the abnormal power consumption detection result based on the probability of abnormal power consumption by the user, specifically includes:

[0153] Temporal correlation features and periodic local features By splicing the data, the fused features are obtained. ;

[0154] The fused features are input into a fully connected classifier to obtain a classification score. :

[0155]

[0156] in, This is the weight parameter matrix of the fully connected classifier; These are the bias parameters for the fully connected classifier;

[0157] The classification score is mapped to the probability of abnormal electricity consumption using the Sigmoid probability mapping function:

[0158]

[0159] in, Represents a probability mapping function;

[0160] when When the electricity consumption exceeds a preset threshold, the corresponding user will be identified as an abnormal electricity user or a suspected electricity thief; when If the value is less than or equal to the preset threshold, the user is considered a normal electricity user.

[0161] It should be noted that, It focuses on expressing the relationships between non-adjacent time nodes obtained from learnable temporal graphs. It focuses on expressing local periodic patterns based on a two-dimensional weekly-daily matrix. The two reflect different aspects of user electricity consumption behavior and are complementary.

[0162] This application provides a method for detecting abnormal electricity consumption based on the fusion of learnable temporal sequence graphs and periodic convolutions. First, historical electricity consumption data of users is acquired and preprocessed to obtain a standardized electricity consumption sequence. Then, this sequence is reconstructed into a periodic two-dimensional electricity consumption matrix according to a preset period length. Simultaneously, trainable embedding vectors are set for each time node. Based on the trainable matrix, a Mahalanobis metric matrix is ​​constructed to calculate the distance between nodes, thus building a weighted temporal graph. Next, the standardized electricity consumption sequence is used as the node feature input to a graph convolutional network to extract temporal correlation features, and the periodic two-dimensional matrix is ​​used as the input to a two-dimensional convolutional network to extract periodic local features. Finally, the two types of features are fused and input into a classifier to output the probability of abnormal electricity consumption by the user, completing the abnormal electricity consumption detection. This application uses learnable temporal sequence graphs to characterize discontinuous associations and combines them with periodic convolutions to extract periodic patterns, thus enhancing the identification of covert electricity theft.

[0163] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0164] To verify the effectiveness and stability of the proposed method in identifying abnormal electricity consumption in smart meters, an experiment on electricity theft detection based on real user electricity consumption data was designed and compared with existing mainstream detection methods. Experimental results show that the proposed method can accurately identify users with abnormal electricity consumption or suspected electricity theft even when user load is missing, fluctuates abnormally, or has periodic differences, demonstrating good detection accuracy and application value.

[0165] The experiment selected historical daily electricity consumption data collected by an advanced metering system in a certain region as the research object. Each user has daily electricity consumption records for 1035 consecutive days and a corresponding user tag. Normal electricity users are marked as 0, while abnormal electricity users or suspected electricity theft users are marked as 1. The raw data exhibits typical user-side load fluctuation characteristics and contains common data quality issues encountered during actual data collection, such as:

[0166] (1) Local missing data due to communication anomalies or acquisition failures;

[0167] (2) Abnormal spikes caused by metering anomalies, sudden load changes, or equipment disturbances;

[0168] (3) Periodic differences caused by user lifestyle habits, industry attributes and seasonal changes;

[0169] (4) Local load drops, disruption of periodic patterns, or long-term deviation of electricity usage patterns caused by disguised electricity theft.

[0170] In the experiment, the original daily electricity consumption sequences of users were first processed by missing value completion, outlier suppression, and normalization. Then, a preset value was added to the end of each user's 1035-dimensional daily electricity consumption sequence to extend its length to 1036, and it was rearranged into a 148×7 week-to-day two-dimensional electricity consumption matrix according to a 7-day weekly cycle. This matrix was used for periodic convolutional branches to extract intra-weekly daily patterns and cross-weekly variation patterns. Simultaneously, the 1035 time nodes were used as graph nodes, and a weighted time graph was constructed using a learnable Mahalanobis metric. This graph convolutional branch was used to extract potential correlation features between non-adjacent time nodes.

[0171] To comprehensively evaluate the detection performance of the method in this application, CNN, Wide Convolutional Neural Network (WIDE-CNN), Multi-Layer Perceptron (MLP), Light Gradient Boosting Machine (LightGBM), Graph Convolutional Network (GCN), and a fusion model of graph convolutional network and convolutional neural network (GCN-CNN) were selected as comparison models. Among them, the CNN method converts the user's electricity consumption sequence into a two-dimensional input and extracts local electricity consumption patterns through convolutional layers; WIDE-CNN expands the feature channels or convolutional receptive field on the basis of ordinary convolutional structure to enhance the ability to express multi-scale local load changes; the MLP method uses the user's historical electricity consumption sequence as a vector input and performs abnormal electricity consumption classification through a multi-layer fully connected network; the LIGHTGBM method builds a classifier based on gradient boosting decision trees to represent traditional machine learning detection methods; the GCN method models the correlation between electricity consumption time nodes based on graph convolutional networks; the GCN-CNN method uses graph convolutional branches and convolutional branches to extract temporal correlation features and local pattern features to verify the effectiveness of the dual-branch fusion structure.

[0172] The method described in this application is denoted as MAHA-GCN. This method introduces a learnable Mahalanobis time-series graph construction mechanism based on GCN modeling. It adaptively calculates the similarity relationships between time nodes through trainable time node embeddings and Mahalanobis metric matrices, and constructs a weighted time graph accordingly. Compared with fixed graph or ordinary graph convolution methods, MAHA-GCN can more flexibly capture the similarity of potential electricity consumption behaviors between non-adjacent dates, thereby enhancing the ability to identify suspected electricity theft users and abnormal electricity consumption behaviors. Detection results are evaluated using metrics such as AUC and MAP. AUC measures the model's overall ability to distinguish between normal and abnormal users; ACC measures classification accuracy; FPR measures the proportion of normal users misclassified as abnormal users; and MAP@100 and MAP@200 measure the model's effectiveness in ranking high-risk users. These metrics are consistent with the model evaluation metrics in the code. Table 1 provides examples of experimental results for different methods in the user abnormal electricity consumption detection task.

[0173] Table 1

[0174]

[0175] As shown in Table 1, the proposed method outperforms CNN and GCN methods using only a single branch in both AUC and MAP metrics, indicating a complementary relationship between periodic local features and temporal correlation features. Compared to the fixed-graph GCN-CNN method, the proposed method adaptively constructs weighted graph relationships between time nodes using a learnable Mahalanobis metric, which better captures the similarity of potential electricity consumption behaviors between non-adjacent dates, thereby improving the ability to identify intermittent electricity theft, periodic electricity theft, and hidden abnormal electricity consumption behaviors. Especially when user load has local missing values, abnormal spikes, and periodic fluctuations, the proposed method can first reduce the interference of data quality problems through preprocessing, then extract periodic structure information through a week-to-day two-dimensional convolutional branch, and extract cross-time node correlation information through a learnable temporal graph convolutional branch. The above mechanism enables the model to not only identify obvious anomalies such as sudden local load drops, but also to discover hidden anomalies such as disruption of periodic patterns and long-term electricity consumption pattern deviations. In summary, the proposed method is suitable for applications such as abnormal electricity consumption detection, screening of suspected electricity theft users, distribution network line loss management, and electricity marketing auditing in smart meter environments.

[0176] To implement the above embodiments, this application also proposes a terminal device.

[0177] Figure 2 This is a schematic diagram of the structure of a terminal device according to an embodiment of this application.

[0178] like Figure 2As shown, the terminal device 200 includes:

[0179] The system includes a memory 210 and at least one processor 220, and a bus 230 connecting different components (including the memory 210 and the processor 220). The memory 210 stores a computer program, and when the processor 220 executes the program, it implements the power consumption anomaly detection method based on the fusion of learnable timing graphs and periodic convolutions as described in the embodiments of this application.

[0180] Bus 230 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0181] Terminal device 200 typically includes various electronically readable media. These media can be any available media that can be accessed by terminal device 200, including volatile and non-volatile media, removable and non-removable media.

[0182] Memory 210 may also include computer system readable media in the form of volatile memory, such as RAM 240 and / or cache 250. Terminal device 200 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 260 may be used to read and write non-removable, non-volatile magnetic media (… Figure 2 Not shown; usually referred to as a "hard drive"). Although Figure 2 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 230 via one or more data media interfaces. Memory 210 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.

[0183] A program / utility 280 having a set (at least one) of program modules 270 may be stored in, for example, memory 210. Such program modules 270 include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 270 typically perform the functions and / or methods described in the embodiments of this application.

[0184] Terminal device 200 can also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), and with one or more devices that enable a user to interact with terminal device 200, and / or with any device that enables terminal device 200 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 292. Furthermore, terminal device 200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 293. Figure 2 As shown, network adapter 293 communicates with other modules of terminal device 200 via bus 230. It should be understood that, although... Figure 2 As not shown in the diagram, other hardware and / or software modules can be used in conjunction with terminal device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0185] The processor 220 performs various functional applications and data processing by running programs stored in the memory 210.

[0186] It should be noted that the implementation process and technical principles of the terminal device in this embodiment are explained in the foregoing description of a power consumption anomaly detection method based on the fusion of learnable time sequence graphs and periodic convolution in this application embodiment, and will not be repeated here.

[0187] Corresponding to the above embodiment, a method for detecting abnormal power consumption based on the fusion of learnable temporal graphs and periodic convolutions, Figure 3 The diagram shows a structural block diagram of an electricity anomaly detection device based on the fusion of learnable timing graphs and periodic convolutions according to an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown.

[0188] Reference Figure 3 The device 300 includes:

[0189] The first construction module 301 is used to acquire historical electricity consumption data of multiple users and construct user electricity consumption sequences;

[0190] The standardization processing module 302 is used to perform missing value completion, outlier suppression and normalization processing on the user's electricity consumption sequence to obtain a standardized electricity consumption sequence;

[0191] The reconstruction module 303 is used to periodically reconstruct the standardized electricity consumption sequence according to a preset cycle length to obtain a periodic two-dimensional electricity consumption matrix.

[0192] The second construction module 304 is used to set a trainable time node embedding vector for each time node in the time series, construct a Mahalanobis metric matrix based on the trainable matrix, calculate the distance between time nodes according to the Mahalanobis metric matrix, determine the adjacency relationship and edge weight between time nodes according to the distance, and construct a weighted time graph.

[0193] The first extraction module 305 is used to take the electricity consumption value of each time node in the standardized electricity consumption sequence as the initial feature of the corresponding graph node, and use the weighted time graph as the graph structure input graph convolutional network to extract the temporal correlation features of user electricity consumption behavior.

[0194] The second extraction module 306 is used to input the periodic two-dimensional electricity consumption matrix into a two-dimensional convolutional network to extract the periodic local features of user electricity consumption behavior;

[0195] The fusion classification module 307 is used to fuse time-series correlation features and periodic local features to obtain fused features, and input the fused features into the classifier to obtain the probability of abnormal power consumption by users, and determine the abnormal power consumption detection result based on the probability of abnormal power consumption by users.

[0196] In practical use, the power consumption anomaly detection device based on the fusion of learnable timing graphs and periodic convolution provided in this application embodiment can be configured in any terminal device to execute the aforementioned power consumption anomaly detection method based on the fusion of learnable timing graphs and periodic convolution.

[0197] This application provides an electricity consumption anomaly detection device based on the fusion of learnable time-series graphs and periodic convolutions. First, it acquires and preprocesses historical electricity consumption data from users to obtain a standardized electricity consumption sequence. Then, it reconstructs this sequence into a periodic two-dimensional electricity consumption matrix according to a preset period length, simultaneously setting trainable embedding vectors for each time node. Based on the trainable matrix, a Mahalanobis metric matrix is ​​constructed to calculate the distance between nodes, thus building a weighted time-series graph. Next, a convolutional network is input to the standardized electricity consumption sequence as node feature input to extract temporal correlation features, and a two-dimensional convolutional network is input to the periodic two-dimensional matrix to extract periodic local features. Finally, the two types of features are fused and input into a classifier to output the probability of abnormal electricity consumption by the user, completing the abnormal electricity consumption detection. This application uses learnable time-series graphs to characterize discontinuous associations, combines them with periodic convolutions to extract periodic patterns, and fuses features to enhance the identification of covert electricity theft.

[0198] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0199] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0200] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.

[0201] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments above.

[0202] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some regions, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0203] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0204] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0205] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0206] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0207] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for detecting abnormal power consumption based on the fusion of learnable temporal graphs and periodic convolution, characterized in that, Includes the following steps: S1. Obtain historical electricity consumption data from multiple users and construct user electricity consumption sequences; S2. Perform missing value completion, outlier suppression, and normalization on the user electricity consumption sequence to obtain a standardized electricity consumption sequence; S3. Reconstruct the standardized electricity consumption sequence according to a preset period length to obtain a periodic two-dimensional electricity consumption matrix; S4. Set a trainable time node embedding vector for each time node in the time series, construct a Mahalanobis metric matrix based on the trainable matrix, calculate the distance between time nodes according to the Mahalanobis metric matrix, determine the adjacency relationship and edge weight between time nodes according to the distance, and construct a weighted time graph. S5. The electricity consumption value of each time node in the standardized electricity consumption sequence is used as the initial feature of the corresponding graph node, and the weighted time graph is used as the graph structure input graph convolutional network to extract the temporal correlation features of user electricity consumption behavior. S6. Input the periodic two-dimensional electricity consumption matrix into a two-dimensional convolutional network to extract periodic local features of user electricity consumption behavior; S7. The time-series correlation features and the periodic local features are fused to obtain fused features, and the fused features are input into a classifier to obtain the probability of abnormal power consumption by the user, and the abnormal power consumption detection result is determined based on the probability of abnormal power consumption by the user.

2. The method according to claim 1, characterized in that, The user electricity consumption sequence of the i-th user is as follows: S2, performing missing value completion, outlier suppression, and normalization on the user's electricity consumption sequence to obtain a standardized electricity consumption sequence, specifically includes: When the electricity consumption value at any time point t is missing, but valid values ​​exist at all the adjacent time points before and after it, the missing position is filled in based on the valid electricity consumption values ​​of the adjacent time points: ; in, Let be the electricity consumption value of the i-th user at the t-th time point; When at least one position in an adjacent time node does not have a valid value, the missing position is filled according to a preset value; Let the mean of the electricity consumption sequence of the i-th user be... The standard deviation is The upper bound for outlier truncation is determined as follows: ; when At that time, Cut off as ; Normalize the user's electricity consumption sequence: ; The standardized electricity consumption sequence of the i-th user is obtained. .

3. The method according to claim 2, characterized in that, Step S3 involves periodically reconstructing the standardized electricity consumption sequence according to a preset period length to obtain a periodic two-dimensional electricity consumption matrix, specifically including: Determine whether the length of the standardized electricity consumption sequence is divisible by the preset cycle length; When the length of the standardized electricity consumption sequence cannot be divided by the preset period length, a preset value is added to the end of the standardized electricity consumption sequence so that the length of the added sequence can be divided by the preset period length. The supplemented standardized electricity consumption sequence is rearranged according to the preset period length to construct a periodic two-dimensional electricity consumption matrix; wherein, each row of the periodic two-dimensional electricity consumption matrix corresponds to a complete period, and each column of the periodic two-dimensional electricity consumption matrix corresponds to a fixed time position within the period.

4. The method according to claim 3, characterized in that, Step S4 involves setting trainable time node embedding vectors for each time node in the time series, constructing a Mahalanobis metric matrix based on the trainable matrix, calculating the distance between time nodes according to the Mahalanobis metric matrix, determining the adjacency relationship and edge weights between time nodes based on the distance, and constructing a weighted time graph. Specifically, this includes: Let the embedding vector of the p-th time node be... The embedding vector of the q-th time node is Construct a positive semidefinite metric matrix using a trainable matrix A: ; Calculate the Mahalanobis distance between time nodes p and q: ; Where d(p,q) represents the Mahalanobis distance between the p-th time node and the q-th time node; For each time node, select the k time nodes with the smallest distance as its nearest neighbors and establish edge connections between the time nodes. For the connected time nodes p and q, the edge weights are determined using a negative exponential function of the distance: ; Among them, w pq Let represent the edge weight between the p-th time node and the q-th time node; Based on the nearest neighbor nodes and edge weights, a weighted time graph is obtained. Where V represents the set of time nodes, E represents the set of edges obtained based on k nearest neighbors, and W represents the set of edge weights.

5. The method according to claim 4, characterized in that, Step S5 involves using the electricity consumption values ​​at each time point in the standardized electricity consumption sequence as the initial features of the corresponding graph nodes, and using the weighted time graph as the graph structure input to the graph convolutional network to extract the temporal correlation features of user electricity consumption behavior, specifically including: For the standardized electricity consumption sequence of the i-th user, each time node on its time axis is considered as a node in the weighted time graph. The electricity consumption value of each time node in the standardized electricity consumption sequence is used as the initial feature of the corresponding graph node. Then, the initial graph node feature matrix of the i-th user can be expressed as follows: Where T is the number of time points. This indicates that the matrix is ​​a real number matrix with dimensions of T rows and 1 column, that is, the one-dimensional electricity consumption value is directly used as the initial feature of the graph node; The edge weights of the weighted temporal graph are normalized, and self-loop connections are added to the weighted temporal graph to obtain the normalized weighted adjacency matrix. ; The graph convolutional network consists of two graph convolutional layers. The first graph convolutional layer maps the one-dimensional electricity consumption value at each time point to a 16-dimensional implicit representation. The computation process is as follows: ; in This is the feature matrix output by the convolutional layer of the first image; It is a linear rectified nonlinear activation function, used to introduce the nonlinear expressive power of the network; This represents the feature aggregation and forward propagation operations of the convolutional layer in the first graph; The second convolutional layer continues to propagate and aggregate features on the weighted temporal graph, obtaining a higher-order temporal correlation representation. Its computation process is as follows: ; in, This is the high-order temporal correlation feature matrix output by the second convolutional layer after further propagation and aggregation on the weighted temporal graph. This represents the feature aggregation and forward propagation operations of the second convolutional layer. Will After performing a dimensionality transformation, the temporal dimension is pooled using a max-pooling layer with a kernel size of 2. The pooled features are then unfolded into a one-dimensional vector, input into a fully connected layer, and mapped to 32-dimensional temporal correlation features. ; in, The weight matrix of the fully connected layer at the end of the graph convolutional branch is used to linearly map the unfolded one-dimensional vector to fixed-length temporal correlation features. The bias term Bias parameter is used for the fully connected layer at the end of the convolutional branch in the graph. This is a flattening function used to expand multidimensional pooling features into a one-dimensional vector; This is the graph pooling feature matrix output after dimensionality reduction processing by the max pooling layer, and , Max pooling function, This is the feature tensor obtained by dimensionality transformation of the output of the second-layer graph convolution.

6. The method according to claim 5, characterized in that, Step S6 involves inputting the periodic two-dimensional electricity consumption matrix into a two-dimensional convolutional network to extract periodic local features of user electricity consumption behavior, specifically including: The periodic two-dimensional power consumption matrix It is extended to a single-channel input, where H represents the number of cycles, P represents the preset cycle length, the row direction of the matrix corresponds to cross-cycle changes, and the column direction corresponds to the power consumption differences at different time positions within the cycle; The expanded periodic two-dimensional power consumption matrix is ​​input into the two-dimensional convolutional network; wherein, the two-dimensional convolutional network includes two two-dimensional convolutional layers and two two-dimensional max-pooling layers. The first two-dimensional convolutional layer has 1 input channel, 8 output channels, and a kernel size of 2×2. The second two-dimensional convolutional layer has 8 input channels, 16 output channels, and a kernel size of 2×2. Specifically, it includes: Perform convolution operation on the periodic two-dimensional electricity consumption matrix to extract the local joint change pattern between adjacent periods and adjacent time positions within the period, and obtain the first convolution feature; The first convolutional feature is downsampled using a 2×2 two-dimensional max pooling process to obtain the first pooled feature; The first pooling feature is convolved to extract the composite periodic pattern of cross-cycle load evolution, intra-cycle electricity consumption pattern change and local load shape change, thus obtaining the second convolution feature. The second convolutional feature is downsampled using a 2×2 two-dimensional max pooling process to obtain the second pooling feature; The second pooling feature is unfolded into a one-dimensional vector and input into the fully connected layer, where it is mapped to a fixed-dimensional periodic local feature. .

7. The method according to claim 6, characterized in that, Step S7 involves fusing the temporal correlation features and the periodic local features to obtain fused features, inputting the fused features into a classifier to obtain the probability of abnormal power consumption by the user, and determining the abnormal power consumption detection result based on the probability of abnormal power consumption by the user. Specifically, this includes: Temporal correlation features and periodic local features By splicing the data, the fused features are obtained. ; The fused features are input into a fully connected classifier to obtain a classification score. : ; in, This is the weight parameter matrix of the fully connected classifier; These are the bias parameters for the fully connected classifier; The classification score is mapped to the probability of abnormal electricity consumption using the Sigmoid probability mapping function: ; in, Represents a probability mapping function; when When the electricity consumption exceeds a preset threshold, the corresponding user will be identified as an abnormal electricity user or a suspected electricity thief; when If the value is less than or equal to the preset threshold, the user is considered a normal electricity user.

8. A power consumption anomaly detection device based on the fusion of learnable temporal graphs and periodic convolution, applied to the method described in any one of claims 1-7, characterized in that, include: The first construction module is used to acquire historical electricity consumption data from multiple users and construct user electricity consumption sequences. The standardization processing module is used to perform missing value completion, outlier suppression, and normalization processing on the user electricity consumption sequence to obtain a standardized electricity consumption sequence. The reconstruction module is used to periodically reconstruct the standardized electricity consumption sequence according to a preset period length to obtain a periodic two-dimensional electricity consumption matrix. The second construction module is used to set a trainable time node embedding vector for each time node in the time series, construct a Mahalanobis metric matrix based on the trainable matrix, calculate the distance between time nodes according to the Mahalanobis metric matrix, determine the adjacency relationship and edge weight between time nodes according to the distance, and construct a weighted time graph. The first extraction module is used to take the electricity consumption value of each time node in the standardized electricity consumption sequence as the initial feature of the corresponding graph node, and use the weighted time graph as the graph structure input graph convolutional network to extract the temporal correlation features of user electricity consumption behavior; The second extraction module is used to input the periodic two-dimensional electricity consumption matrix into a two-dimensional convolutional network to extract periodic local features of user electricity consumption behavior; The fusion classification module is used to fuse the time-series correlation features and the periodic local features to obtain fused features, and input the fused features into the classifier to obtain the probability of abnormal power consumption by the user, and determine the abnormal power consumption detection result based on the probability of abnormal power consumption by the user.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.