A power load anomaly detection method and device

By combining the multi-head self-attention network and the KL divergence loss function, the problems of feature capture difficulty and data imbalance in traditional methods in power load anomaly detection are solved, efficient power load anomaly detection is achieved, and detection accuracy and system stability are improved.

CN118839268BActive Publication Date: 2025-10-17CHAOYANG POWER SUPPLY COMPANY OF STATE GRID LIAONING ELECTRIC POWER SUPPLY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410841619.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2025-10-17
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

Traditional power load anomaly detection methods are difficult to effectively capture complex potential features when faced with massive multi-source heterogeneous power big data, and there is a data imbalance problem that leads to low monitoring accuracy. Existing deep learning methods are not effective in actual power consumption scenarios.

Method used

A multi-head self-attention network is used to process the power load data in blocks. The attention matrix representation between blocks and within blocks is calculated, and asynchronous training is performed using the KL divergence loss function to calculate the anomaly score. The anomaly is determined based on the preset threshold.

Benefits of technology

It improves the accuracy and generalization ability of power load anomaly detection, can effectively identify abnormal power consumption behavior, and improve the stability and security of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118839268B_ABST
    Figure CN118839268B_ABST
Patent Text Reader

Abstract

The application provides a power load anomaly detection method and device, and belongs to the technical field of power grid safety. The method comprises the following steps: standardizing power load data and processing the power load data in blocks. Then, a multi-head self-attention network is used to calculate an attention matrix representation between blocks and within blocks, and the attention matrix representation is respectively up-sampled. Next, a divergence loss function of the two is calculated, and an anomaly score of each point is calculated according to the divergence loss function. Finally, whether the power load data is abnormal is determined through a preset hyperparameter threshold. Through the method, the distance between normal and abnormal user features is maximized, the distance between features of the same type of users is minimized, an effective power data representation is learned, different user power consumption data features are actively compared, and abnormal power consumption behaviors are effectively identified.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of power grid safety, and particularly relates to a power load anomaly detection method and device. BACKGROUND

[0002] In recent years, with the continuous expansion of the power grid structure, power big data presents the characteristics of massive multi-source heterogeneity. Traditional data mining methods have been unable to adapt to the changing data sources and structural forms.

[0003] Traditional power consumption anomaly detection relies on manual on-site detection, which is not only cumbersome but also expensive. The development of the Internet of Things has accelerated the realization of smart grids, making it possible to deploy smart meter sensors that require edge computing. Smart meters can monitor user power consumption data in real time and analyze these data to provide new solutions for anomaly detection.

[0004] Traditional deep learning anomaly detection methods automatically extract features and quantitatively evaluate anomalies by building neural networks. Existing research mainly focuses on improving clustering algorithms and constructing power consumption models for different users. Machine learning models such as support vector machines (SVM) and k-nearest neighbors (KNN) are widely used in power consumption anomaly detection due to their fast training speed and interpretability.

[0005] Document (X. Kong, X. Zhao, C. Liu, Q. Li, D. Dong, Y. Li, Electricity theft detection in low-voltage stations based on similarity measure and dt-ksvm. Int. J. Electr. Power Energy Syst. 125, 106544 (2021)) proposes an anomaly power consumption detection method based on similarity measure and decision tree k-nearest neighbor combined with support vector machine (DT-KSVM). This method can be quickly trained, but it is difficult to capture complex potential features from power data.

[0006] Document (M.-M. Buzau, J. Tejedor-Aguilera, P. Cruz-Romero and A.

[0007] Gomez-Expósito, "Hybrid Deep Neural Networks for Detection of Non-Technical Losses in Electricity Smart Meters," in IEEE Transactions on Power Systems, vol. 35, no. 2, pp. 1254-1263, March 2020) combines a long short-term memory (LSTM) network with a multi-layer perceptron (MLP) to learn features from sequential data, thereby detecting abnormal electricity usage behavior. However, in actual electricity usage scenarios, there is less abnormal electricity usage data, and this serious data imbalance problem will affect the training effect of the network, and overfitting problems will occur, resulting in a lower final monitoring accuracy of the network. SUMMARY

[0008] The purpose of the present application is to overcome the problems existing in the prior art described above, and to provide a power load anomaly detection method and device.

[0009] The present application provides a power load anomaly detection method, comprising:

[0010] Converting the power load data into the same scale range as the input sequence;

[0011] Dividing the input sequence into blocks with a preset step value;

[0012] Calculating the attention matrix representation between the blocks by a multi-head self-attention network, and upsampling the attention matrix representation between the blocks to obtain an inter-block upsampling representation;

[0013] Performing an embedding operation on each of the multiple points of the power load data in the block;

[0014] Calculating the attention matrix representation of the multiple points after the embedding operation in the block by a multi-head self-attention network, and upsampling the attention matrix representation in the block to obtain an intra-block upsampling representation;

[0015] Respectively calculating the divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation;

[0016] According to the divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation, calculating the anomaly score of each point in the input sequence;

[0017] Using a preset hyperparameter threshold to compare with the anomaly score of each point to determine whether the power load data is abnormal.

[0018] Optionally, an anomaly score of each point in the input sequence is calculated, expressed as follows:

[0019]

[0020] wherein KL represents the KL divergence distance, grad(N) represents the up-sampling matrix gradient between blocks,

[0021] grad(N) represents the up-sampling gradient of points within a block.

[0022] Optionally, before calculating the anomaly score of each point in the input sequence, further comprising:

[0023] Asynchronous training of the divergence loss function of the inter-block up-sampling representation and the intra-block up-sampling representation, expressed as follows:

[0024]

[0025] wherein L N is the inter-block up-sampling representation, is the intra-block up-sampling representation, and N is the number of blocks.

[0026] Optionally, the representation of the input sequence is χ=(x1,x2,…,x T );

[0027] wherein T is the length of the power load data.

[0028] Optionally, the preset numerical value is 7.

[0029] The application also provides a power load anomaly detection device, comprising:

[0030] An input module, configured to convert power load data into the same scale range as an input sequence;

[0031] A segmentation module, configured to divide the input sequence into blocks with a step size of a preset numerical value;

[0032] A first sampling module, configured to calculate an attention matrix representation between the blocks through a multi-head self-attention network, up-sample the attention matrix representation between the blocks, and obtain an inter-block up-sampling representation;

[0033] A conversion module, configured to perform an embedding operation on a plurality of points of the power load data within each block;

[0034] A second sampling module, configured to calculate an attention matrix representation of a plurality of points after the embedding operation within the block through a multi-head self-attention network, up-sample the attention matrix representation within the block, and obtain an intra-block up-sampling representation;

[0035] a function module configured to calculate a divergence loss function of the inter-block up-sampling representation and the intra-block up-sampling representation, respectively;

[0036] a scoring module configured to calculate an anomaly score of each point in the input sequence according to the divergence loss function of the inter-block up-sampling representation and the intra-block up-sampling representation;

[0037] a comparison module configured to compare the anomaly score of each point with a preset hyperparameter threshold to determine whether the power load data is abnormal.

[0038] Optionally, the scoring module calculates the anomaly score of each point in the input sequence according to the following expression:

[0039]

[0040] wherein KL represents a KL divergence distance, grad(N) represents a gradient of the up-sampling matrix between blocks,

[0041] grad(N) represents a gradient of the up-sampling matrix within blocks.

[0042] Optionally, before the scoring module calculates the anomaly score of each point in the input sequence, the method further comprises:

[0043] asynchronously training the divergence loss function of the inter-block up-sampling representation and the intra-block up-sampling representation according to the following expression:

[0044]

[0045] wherein L N is the inter-block up-sampling representation, is the intra-block up-sampling representation, and N is the number of blocks.

[0046] Optionally, the representation of the input sequence is χ=(x1,x2,…,x T ).

[0047] wherein the T is the length of the power load data.

[0048] Optionally, the preset numerical value is 7.

[0049] The application has the following beneficial effects:

[0050] The present application provides a method for detecting anomalies in power loads, comprising: converting power load data to the same scale as an input sequence; dividing the input sequence into blocks with a step size of a preset value; calculating an attention matrix representation between the blocks through a multi-head self-attention network, upsampling the attention matrix representation between the blocks to obtain an inter-block upsampled representation; performing an embedding operation on multiple points of the power load data within each block; calculating an attention matrix representation of the multiple points after the embedding operation within the block through a multi-head self-attention network, upsampling the attention matrix representation within the block to obtain an intra-block upsampled representation; calculating a divergence loss function for the inter-block upsampled representation and the intra-block upsampled representation respectively; calculating an anomaly score for each point in the input sequence based on the divergence loss function of the inter-block upsampled representation and the intra-block upsampled representation; and comparing the anomaly score of each point using a preset hyperparameter threshold to determine whether the power load data is abnormal. The present application learns an effective representation of power data by maximizing the distance between the characteristics of normal electricity users and electricity theft and leakage users, while minimizing the distance between the characteristics of users of the same type. This strategy enables the model to actively compare the electricity usage data characteristics between different users, thereby effectively identifying abnormal electricity usage behavior. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 This is a schematic diagram of the power load anomaly detection process in this application;

[0052] Figure 2 This is a schematic diagram of the power load anomaly detection network process in this application;

[0053] Figure 3 This is a schematic diagram of the attention module structure in this application;

[0054] Figure 4 It is a schematic diagram of the power load anomaly detection device in this application. DETAILED DESCRIPTION

[0055] The present application will be further described below with reference to the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present application and implement it.

[0056] The following contents are all examples of specific implementation processes provided for detailed description of the technical solutions to be protected by this application. However, this application is also implemented in other ways different from the descriptions herein. Under the guidance of the concept of this application, those skilled in the art may implement this application using different technical means. Therefore, this application is not limited to the specific embodiments below.

[0057] A method for detecting abnormal power loads, which represents power load data as a power load sequence with a power load length of T, can be expressed as χ = (x1, x2, ..., x T ), where x t ∈R d represents the d-dimensional data obtained from the sensor at time t. Here, d represents multiple characteristic dimensions of the data, which may include different power parameters such as voltage, current, and power factor.

[0058] In the anomaly detection task, a model is built that learns the characteristics of normal electricity usage patterns and identifies anomalous sequences that do not conform to these patterns.

[0059] Specifically, the present application expects to obtain a test result sequence y=(y1,y2,…,y T ), y t ∈{0,1}. Here, y t A value of 0 indicates that the load sequence at time point t is normal, while a value of 1 indicates that the sequence is abnormal. Such a label sequence y can clearly indicate which time points have abnormal load data.

[0060] Please refer to Figure 1 As shown in the figure, a method for detecting abnormal power load includes the following steps:

[0061] S101 converts the power load data into the same scale range as the input sequence.

[0062] The input power load sequence is first processed by the instance normalization module for maximum and minimum normalization.

[0063] Specifically, the original power load data is converted into numerical values ​​within a standard range, for example, between [0, 1], to eliminate the dimensional influence between different data features and improve the stability and prediction accuracy of the model.

[0064] During the max-min normalization process, each load sequence value is linearly transformed based on the maximum and minimum values ​​in the sequence. Specifically, for each value x in the sequence, its normalized value x' can be calculated using the following formula:

[0065] x'=(x-min) / (max-min)

[0066] Among them, min and max represent the minimum and maximum values ​​in the load sequence respectively. After such transformation, all load sequence values ​​will be mapped to the interval [0,1].

[0067] S102 divides the input sequence into blocks with a step size of a preset value.

[0068] In this application, the multivariate input is regarded as a multi-channel load sequence. In the power system, the power load is often affected by many factors, such as weather, season, holiday, etc. Therefore, there are multiple variables to describe and predict the power load. The multivariate input can be regarded as multiple channels in the model, and each channel corresponds to a variable.

[0069] Preferably, this application divides a week into multiple blocks with a step size of 7, which can fully utilize the periodic characteristics of the power load data in the time dimension. Since there is usually a significant difference in the power consumption mode between weekdays and weekends within a week, dividing the data by a week for block processing helps the model better capture this periodicity.

[0070] Then, the results representing each block are connected as the input of the subsequent module.

[0071] S103 calculates the attention matrix representation between the blocks by the multi-head self-attention network, upsamples the attention matrix representation between the blocks, and obtains the inter-block upsampled representation.

[0072] This application performs representation learning on the input power load sequence from two different perspectives of intra-block and inter-block. In normal power consumption mode, the difference between the representations in different perspectives is small; however, when abnormal power consumption behavior occurs, the difference between these representations will significantly increase.

[0073] First, the input power load sequence χ∈R T×d is divided into multiple blocks, and a new tensor χ∈R P×N×d is obtained, where P represents the size of each block, N represents the number of blocks, and d is the data dimension. Such block processing helps to capture the local and global features of the power load data.

[0074] In order to fully utilize the channel information and batch dimension, the channel dimension of χ is fused with the batch dimension, so that the input size becomes χ∈R P×N . Then, a multi-head self-attention network is used to model the dependency between different blocks, so as to capture the complex changes of the power load data in the time sequence.

[0075] For the inter-block perspective, multiple blocks are taken as input, and the Query and Key values are initialized. These values are converted by learnable parameter matrices to obtain specific Query and Key vectors. As shown in the following formula:

[0076]

[0077] where H is the number of attention heads is the learnable parameter matrix of Query and Key.

[0078] For each attention head i, the corresponding parameter matrix is used to obtain Query and Key. These vectors have dimension N x d / H, where H denotes the number of attention heads.

[0079] Subsequently, the attention weights are calculated using the Query and Key vectors.

[0080] By means of a dot product operation and the application of a scaling factor the attention weight matrix AttnN for each attention head is obtained i as shown in the following equation:

[0081]

[0082] The Softmax function ensures that the sum of the weights is 1, thus reflecting the relative importance between different patches.

[0083] Finally, the outputs of all attention heads are concatenated (Concat) and linearly transformed by a learnable output matrix to obtain the final attention matrix representation AttnN, as shown in the following equation:

[0084]

[0085] This attention matrix integrates the information of different patches and considers their dependencies, thus facilitating the subsequent anomaly detection task, where

[0086] S104 performs an embedding operation for each of the plurality of points of the power load data within the patch.

[0087] For the perspective within a patch, the plurality of points within a patch are taken as input data. In order to capture the intrinsic relationship between these points, an embedding operation is first performed on the dimension within the patch. This operation converts the original input into a new representation space, so that the relationship and features between points are highlighted.

[0088] After the embedding operation, a new tensor is obtained, where P is the number of points within the patch and d is the dimension of the embedding.

[0089] S105 calculates the attention matrix representation of the plurality of points after the embedding operation within the patch through the multi-head self-attention network, and upsamples the attention matrix representation within the patch to obtain an upsampled representation within the patch.

[0090] ​Next, the values of Query and Key are initialized, expressed as follows:

[0091]

[0092] where H is the number of attention heads, are the learnable parameter matrices for Query and Key.

[0093] These values are transformed through learnable parameter matrices. For each attention head i, the corresponding parameter matrices and are used to perform a linear transformation on the input to obtain the Query and Key vectors and These vectors have the same dimension as the embedding dimension.

[0094] Having obtained the Query and Key vectors, we can now calculate the attention weights.

[0095] This is achieved through the dot product operation, i.e., the Query vector is multiplied by the transpose of the Key vector, expressed as follows:

[0096]

[0097] To prevent the weights from becoming too large and causing gradient vanishing, a scaling factor is introduced, where H is the number of attention heads. Finally, the Softmax function is applied to ensure that the sum of the weights is 1, thereby obtaining the weight matrix for each attention head

[0098] The last step is to concatenate the outputs of multiple attention heads, expressed as follows:

[0099]

[0100] The weight matrices of all attention heads are concatenated (Concat) and linearly transformed through a learnable output matrix to obtain the final attention matrix representation This matrix combines the information of all points within the block and considers their dependencies, helping us better understand the structure and patterns within the block.

[0101] S106 calculates the divergence loss function of the inter-block up-sampling representation and the intra-block up-sampling representation, respectively.

[0102] For the inter-block perspective, the focus is on the relationship between different blocks. In this perspective, the attention matrix AttnN learned by the multi-head self-attention network reflects the dependencies and associations between blocks. However, this representation is based on the block level and fails to capture detailed information for specific points within the blocks. Therefore, an upsampling operation is performed on AttnN to obtain an upsampling representation N for each point within the blocks. In this way, N not only contains information between blocks, but also enriches the details within the blocks through upsampling.

[0103] On the other hand, for the intra-block perspective, the model focuses on the relationship between points within each block. Through a similar attention mechanism, an intra-block attention matrix is obtained, which describes the dependencies and interactions between points within the same block. To extend this intra-block relationship representation to the scale of the entire sequence, an upsampling operation is performed on to obtain an inter-block upsampling representation In this way, both contains intra-block information and is extended to the entire sequence range through upsampling.

[0104] Finally, the representation N of the inter-block perspective and the representation of the intra-block perspective are obtained. These two representations capture the spatiotemporal features of the power load sequence from different perspectives. The following formula gives the mathematical expression of the upsampling operation:

[0105] N = Upsampling(AttnN)

[0106]

[0107] The upsampling operation of the inter-block perspective learns the weighted combination of the same position sample points from each block, which helps to capture the pattern changes in the same position between blocks. The upsampling of the intra-block perspective learns the weighted combination between points within the same block, further enriching the detailed information within the block.

[0108] S107 calculates the anomaly score of each point in the input sequence according to the divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation.

[0109] Under the dual perspectives of intra-block and inter-block, two contrastive views are obtained: the intra-block representation and the inter-block representation N.

[0110] To measure the similarity between these two views, Kullback-Leibler divergence (KL divergence) is used as the basis for the loss function. KL divergence can measure the difference between two probability distributions and is suitable for comparing the information loss between different views.

[0111] First, define the loss function of the intra-block perspective It takes into account The similarity between the gradient grad(N) of the upsampled representation N between blocks. At the same time, in order to ensure the symmetry of information, the calculation of grad(N) and The KL divergence between . Therefore, It can be defined as the formula:

[0112]

[0113] Similarly, define the loss function L between block perspectives N , which measures the relationship between N and the upsampling representation within the block Gradient The similarity between The similarity between L and N. N The definition of is shown in the formula:

[0114]

[0115] Where χ is the input power load sequence, which provides the basis of the original data. KL represents the function of calculating the KL divergence distance, which is used to quantify the difference between the two distributions. grad(N) and The gradients of the upsampled representations within and across patches, respectively, provide additional information about the variation in representations.

[0116] In order to train these two branches asynchronously and obtain a unified optimization objective, the total loss function L is defined as:

[0117]

[0118] This application uses a normalized approach to balance the loss contributions of the two branches, where len(N) represents the length of N between blocks.

[0119] By minimizing the total loss function L, we can simultaneously optimize the intra-block and inter-block representations, allowing them to maintain their respective characteristics while also coordinating with each other to capture the complex patterns in power load sequences. This dual-perspective training strategy helps improve the model's generalization and anomaly detection performance.

[0120] S108 uses a preset hyperparameter threshold to compare with the abnormality score of each point to determine whether the power load data is abnormal.

[0121] In power load sequence analysis, normal points are relatively close in representation results under different views within and outside blocks due to similar power consumption patterns and correlations. In contrast, abnormal points are relatively far in representation results under different views due to deviating from normal power consumption patterns. Based on this observation, the application defines a scoring mechanism to quantify the abnormality degree of each point.

[0122] The scoring function Score(x) considers the KL divergence between the intra-block representation and the inter-block up-sampling gradient grad(N), as well as the KL divergence between the inter-block representation N and the intra-block up-sampling gradient By adding these divergence values, a comprehensive score reflecting the abnormality degree of the point is obtained, as shown in the following formula:

[0123]

[0124] The scores of abnormal points are usually higher than those of normal points. To convert these scores into specific abnormality judgments, a hyperparameter threshold δ is introduced. By comparing the score of each point with the threshold, it can be determined whether the point is an abnormal point, as shown in the following formula:

[0125]

[0126] The setting of the above abnormality criterion enables accurate definition of abnormal points between different industries. By learning and comparing the divergence distances of normal points in various industries, an abnormality criterion suitable for different scenarios can be constructed, thereby achieving accurate abnormal point detection.

[0127] In practical applications, the selection of threshold δ is a key issue. It needs to be adjusted according to the specific application scenario and data distribution to ensure the accuracy and reliability of abnormality detection. Generally, a suitable threshold can be determined through cross-validation or statistical analysis based on historical data.

[0128] By combining the dual perspectives of intra-block and inter-block and using KL divergence as a measurement tool, the method of the application can effectively capture abnormal points in power load sequences. This not only helps to improve the stability and security of power systems, but also provides strong support for the operation and management of the power industry.

[0129] As shown in Figure 4 , the application also provides a power load abnormality detection device for executing the steps of the above method, including:

[0130] An input module 201 is used to convert power load data into the same scale range as the input sequence;

[0131] The segmentation module 202 is configured to divide the input sequence into blocks with a preset step value.

[0132] The first sampling module 203 is configured to calculate an attention matrix representation between the blocks by a multi-head self-attention network, and up-sample the attention matrix representation between the blocks to obtain an up-sampling representation between the blocks.

[0133] The conversion module 204 is configured to perform an embedding operation on a plurality of points of the power load data in each block.

[0134] The second sampling module 205 is configured to calculate an attention matrix representation of the plurality of points after the embedding operation in the block by a multi-head self-attention network, and up-sample the attention matrix representation in the block to obtain an up-sampling representation in the block.

[0135] The function module 206 is configured to calculate a divergence loss function of the up-sampling representation between the blocks and the up-sampling representation in the block, respectively.

[0136] The scoring module 207 is configured to calculate an anomaly score of each point in the input sequence according to the divergence loss function of the up-sampling representation between the blocks and the up-sampling representation in the block.

[0137] The comparison module 208 is configured to compare the anomaly score of each point with a preset hyperparameter threshold to determine whether the power load data is abnormal.

[0138] Further, the scoring module calculates the anomaly score of each point in the input sequence, and the expression is as follows:

[0139]

[0140] Wherein, KL represents the KL divergence distance, grad(N) represents the up-sampling matrix gradient of the points in the block, represents the up-sampling gradient between the blocks.

[0141] Further, before the scoring module calculates the anomaly score of each point in the input sequence, it further includes:

[0142] The divergence loss function of the up-sampling representation between the blocks and the up-sampling representation in the block is asynchronously trained, and the expression is as follows:

[0143]

[0144] Wherein, L N is the up-sampling representation between the blocks, is the up-sampling representation in the block, and N is the number of blocks.

[0145] Further, the input sequence is represented as: χ = (x1, x2, …, x T ).

[0146] Wherein, the T is the length of the power load data.

[0147] Further, the preset value is 7.

[0148] The above only is the preferred embodiment of the present application, it should be pointed out, for ordinary skilled in the art, without departing from the technical principles of the present application, can also make a number of improvements and deformation, these improvements and deformation also should be considered as the protection scope of the present application.

Claims

1. A method for detecting abnormal power load, characterized in that: include: The power load data is converted to the same scale range as the input sequence. The power load data is represented as X = (x1, x2, ..., xT), where xt∈Rd represents the d-dimensional data obtained from the sensor at time point t, and d represents multiple feature dimensions of the data, including voltage, current, and power factor; Dividing the input sequence into blocks with a step size of a preset value; Calculating the attention matrix representation between the blocks through a multi-head self-attention network, upsampling the attention matrix representation between the blocks to obtain an upsampled representation between the blocks; Performing an embedding operation on multiple points of the power load data in each block; Calculate the attention matrix representation of multiple points after the embedding operation in the block through a multi-head self-attention network, upsample the attention matrix representation in the block, and obtain the upsampled representation in the block; Calculating the divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation respectively; Calculating an anomaly score for each point in the input sequence according to a divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation; A preset hyperparameter threshold is used to compare with the abnormality score of each point to determine whether the power load data is abnormal.

2. The method for detecting abnormal power load according to claim 1, characterized in that: Calculate the anomaly score of each point in the input sequence. The expression is as follows: Among them, KL represents the KL divergence distance, grad(N) represents the upsampling matrix gradient between blocks, Represents the upsampled gradient of the points within the block.

3. The method for detecting abnormal power load according to claim 1, wherein: Before calculating the anomaly score of each point in the input sequence, the following steps are also included: The divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation is asynchronously trained and expressed as follows: Among them, L N is the upsampling representation between blocks, is the upsampled representation within a block, and N is the number of blocks.

4. The method for detecting abnormal power load according to claim 1, wherein: The input sequence is represented as: χ=(x1, x2,…, x T ); Wherein, T is the length of the power load data.

5. The method for detecting abnormal power load according to claim 1, characterized in that: The preset value is 7.

6. A power load abnormality detection device, characterized in that: include: An input module is used to convert the power load data into the same scale range as an input sequence. The power load data is represented as X = (x1, x2, ..., xT), where xt∈Rd represents the d-dimensional data obtained from the sensor at time point t, and d represents multiple feature dimensions of the data, including voltage, current, and power factor; A segmentation module, configured to divide the input sequence into blocks with a step size of a preset value; A first sampling module is configured to calculate the attention matrix representation between the blocks through a multi-head self-attention network, and upsample the attention matrix representation between the blocks to obtain an upsampled representation between the blocks; a conversion module, configured to perform an embedding operation on a plurality of points of the power load data in each of the blocks; A second sampling module is used to calculate the attention matrix representation of multiple points after the embedding operation in the block through a multi-head self-attention network, and upsample the attention matrix representation in the block to obtain an upsampled representation in the block; A function module, configured to respectively calculate the divergence loss functions of the inter-block upsampling representation and the intra-block upsampling representation; a scoring module, configured to calculate an anomaly score for each point in the input sequence based on a divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation; A comparison module is used to compare the abnormality score of each point with a preset hyperparameter threshold to determine whether the power load data is abnormal.

7. The power load abnormality detection device according to claim 6, characterized in that: The scoring module calculates the anomaly score of each point in the input sequence, and the expression is as follows: Among them, KL represents the KL divergence distance, grad(N) represents the upsampling matrix gradient between blocks, Represents the upsampled gradient of the points within the block.

8. The power load abnormality detection device according to claim 6, characterized in that: Before the scoring module calculates the anomaly score of each point in the input sequence, the scoring module further includes: The divergence loss function of the inter-block upsampling representation and the intra-block upsampling representation is asynchronously trained and expressed as follows: Among them, L N is the upsampling representation between blocks, is the upsampled representation within a block, and N is the number of blocks.

9. The power load abnormality detection device according to claim 6, characterized in that: The input sequence is represented as: χ=(x1, x2,…, x T ); Wherein, T is the length of the power load data.

10. The power load abnormality detection device according to claim 6, characterized in that: The preset value is 7.

Citation Information

Patent Citations

  • Multi-element time sequence anomaly detection method for intelligent Internet of Things system

    CN116663613A

  • Battery charging process anomaly detection method and device based on comparative learning network

    CN117233615A