Electric energy metering data anomaly detection method and system and storage medium

By combining CNN and LSTM to process the power metering data, extract local and global features, and use multiple error metrics to perform abnormal detection, the problem of false alarms and misreports in traditional methods is solved, and more efficient power metering abnormal detection is achieved.

CN120123938APending Publication Date: 2025-06-10国网安徽省电力有限公司营销服务中心 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510210213.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

The existing abnormal detection methods of power metering devices rely on manual inspection and simple rule threshold judgment, which is difficult to adapt to the operation and maintenance needs of large-scale electricity meters. In addition, traditional methods are prone to false alarms and missed alarms, and cannot effectively capture potential abnormalities during the operation of power metering devices.

Method used

Convolutional neural network (CNN) is used to extract local features of electrical energy data, and combined with long and short-term memory network (LSTM) to process global timing information. By calculating multi-mode features, linear interpolation and splicing are performed, and abnormal detection is performed by combining mean square error, average absolute error and residual.

Benefits of technology

It improves the reliability and accuracy of detection of abnormal data of electrical energy measurement, can show good robustness and adaptability in different environments and scenarios, and accurately capture abnormalities in electrical energy data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123938A_ABST
    Figure CN120123938A_ABST
Patent Text Reader

Abstract

The invention discloses an electric energy metering data anomaly detection method and system and a storage medium, and the method comprises the steps: collecting the electric energy data of an electric energy metering device, and inputting the electric energy data into a convolutional neural network to obtain the local features of the electric energy data; multi-mode features of the electric energy data are calculated, linear interpolation is carried out on the multi-mode features so that the time step number of the multi-mode features can be matched with the local features, and the multi-mode features comprise the periodic coding feature, the change trend feature and the temperature feature; splicing the multimode features matched with the time step number with the local features to obtain a fusion feature matrix, and inputting the fusion feature matrix into an LSTM network to obtain an electric energy data predicted value; based on the electric energy data predicted value and the electric energy data actual measurement value, determining the abnormal condition of the electric energy data actual measurement value; the accuracy of electric energy data anomaly detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power metering data analysis, and in particular to a method, a system and a storage medium for detecting abnormal power metering data. Background Art

[0002] The power metering device is an important part of the smart grid, and the accuracy of its data is directly related to the operation efficiency and stability of the power system. At present, the verification of power metering devices mostly relies on manual inspections and simple rule-based threshold judgments. Manual inspections are not only time-consuming and costly, but also difficult to meet the operation and maintenance requirements of a large number of electric meters. Moreover, traditional anomaly detection methods based on fixed thresholds are prone to false alarms and missed detections, and are unable to flexibly cope with different electricity usage environments and the dynamic changes of the power system. These traditional methods lack in-depth analysis of the temporal characteristics of power data and cannot effectively capture potential anomalies during the operation of power metering devices.

[0003] Power metering data has obvious temporal characteristics. Especially in the application scenarios of high-frequency data collection and real-time monitoring, the volatility and periodicity of power consumption are very obvious. In order to effectively monitor and analyze this data, traditional methods have not fully utilized modern deep learning technologies, especially lacking sufficient modeling capabilities for the temporal characteristics of power data. With the rapid growth of power data volume, how to efficiently and accurately extract temporal characteristics and perform anomaly detection has become a new technical challenge.

[0004] With the continuous development of deep learning technology, more and more research has begun to apply deep learning methods such as convolutional neural networks (CNNs) and long short-term memory networks (LSTMs) to analyze and verify power metering data. CNNs are good at capturing local features in data and are especially suitable for processing local information such as sudden changes and periodic fluctuations in time series. LSTMs, on the other hand, can handle the long-term dependencies in time series data well and provide strong support in capturing short-term and long-term time series features. However, when using CNNs or LSTMs alone to process power metering data, certain limitations are faced. For example, although CNNs can extract local features of time series data, their modeling of time series relationships is relatively limited; while LSTMs can handle time series data, their effect in capturing local patterns in data is not as good as that of CNNs. Therefore, combining CNNs and LSTMs, using CNNs to extract local features and LSTMs to process global time series information, can effectively improve the accuracy and reliability of power metering data analysis. For example, in the literature "Research on Abnormal Power Consumption Detection Method in Smart Grid Based on Deep Learning, Master's Thesis, Ren Wen", a 2D_CNN_LSTM-based smart grid abnormal power consumption detection model was established to address the problems of cycle feature extraction for abnormal power consumption data and difficult-to-process time series data, achieving good detection performance. This scheme optimizes the input daily power consumption data into weekly power consumption data. Essentially, it can only extract the features of power data in time. Focusing only on the impact of a certain feature on power data and relying solely on a single feature is still not accurate enough for predicting power data. Summary of the Invention

[0005] The technical problem to be solved by the present invention is how to improve the reliability of abnormal power metering data detection.

[0006] The present invention solves the above technical problem by the following technical means:

[0007] A method for abnormal detection of power metering data is proposed, and the method includes:

[0008] Collect power data of a power metering device and input the power data into a convolutional neural network to obtain local features of the power data;

[0009] Calculate multi-modal features of the power data and perform linear interpolation on the multi-modal features to make the number of time steps of the multi-modal features match the local features. The multi-modal features include periodic coding features, change trend features, and temperature features;

[0010] Concatenate the multi-modal features with matching time steps and the local features to obtain a fused feature matrix and input it into an LSTM network to obtain a predicted value of the power data;

[0011] Determine the abnormal situation of the actual measured value of the electrical energy data based on the predicted value and the actual measured value of the electrical energy data.

[0012] Further, after collecting the electrical energy data of the electrical energy metering device, the method further includes:

[0013] Preprocess the electrical energy data to obtain the preprocessed electrical energy data;

[0014] Correspondingly, input the preprocessed electrical energy data into a convolutional neural network to obtain the local features of the electrical energy data.

[0015] Further, the step of inputting the electrical energy data into a convolutional neural network to obtain the local features of the electrical energy data includes:

[0016] Slice the electrical energy data into multiple time windows, form an input sequence with a shape of (T, N), and input it into the convolutional neural network to obtain the local features of the electrical energy data, where T is the number of time windows and N is the number of features at each time step.

[0017] Further, the step of calculating the multi-modal features of the electrical energy data and performing linear interpolation on the multi-modal features to match the number of time steps of the local features includes:

[0018] Perform sine-cosine encoding on the periodic features of the electrical energy data to obtain periodic encoding features;

[0019] Divide into four stages according to quarters, and predict the change trend of the electrical energy data in each stage to obtain the change trend features of each stage;

[0020] Process the ambient temperature corresponding to the electrical energy data to obtain temperature features;

[0021] Perform linear interpolation on the periodic encoding features, change trend features, and temperature features so that the number of time steps of the periodic encoding features, change trend features, and temperature features matches the local features.

[0022] Further, the step of performing sine-cosine encoding on the periodic features of the electrical energy data to obtain periodic encoding features includes:

[0023] Perform sine-cosine encoding on the date features and month features of the electrical energy data to obtain date encoding features and month encoding features as:

[0024]

[0025] where: day_sine is the date sine encoding feature, day_cosine is the date cosine encoding feature, month_sine is the month sine encoding feature, month_cosine is the month cosine encoding feature, day represents the date, and month represents the month.

[0026] Further, dividing into four stages according to quarters and predicting the change trend of power data in each stage, the change trend feature obtained for each stage is:

[0027]

[0028] where: L i is the maximum data of stage i, k i is the growth rate of stage i, t i is the demarcation point of stage i, and g(t) is the change trend feature at time t.

[0029] Further, processing the ambient temperature corresponding to the power data to obtain the temperature feature:

[0030] ΔT t = T t-1 - T t-2

[0031] where: ΔT t is the temperature feature, T t-1 is the ambient temperature at time t-1, and T t-2 is the ambient temperature at time t-2.

[0032] Further, performing linear interpolation on the periodic encoding feature, the change trend feature, and the temperature feature so that the time steps of the periodic encoding feature, the change trend feature, and the temperature feature match the local feature, including:

[0033] Performing linear interpolation on the periodic encoding feature, the change trend feature, and the temperature feature respectively, and converting the time steps of the periodic encoding feature, the change trend feature, and the temperature feature into the time steps of the local feature. The formula is expressed as:

[0034]

[0035] where: y 1 , y 2 are the multi-modal features at time steps t 1 , t 2 respectively, t is the time step to be calculated, and y is the feature matching the local feature steps.

[0036] Further, the process of concatenating the multi-modal features matching the time steps with the local features to obtain a fused feature matrix and inputting it into the LSTM network to obtain the predicted value of the power data includes:

[0037] Concatenate the multi-modal features matching the time steps with the local features to obtain a fused feature matrix Fused_feature = [CNN_output, Trend_feature, Temperature_feature, period_feature], where CNN_output is the local feature, Trend_feature is the trend feature, Temperature_feature is the temperature feature, and period_feature is the periodic coding feature;

[0038] Input the fused feature matrix into the LSTM network to obtain the forward information and backward information of the fused feature matrix, and concatenate the forward information and backward information to obtain the predicted value of the power data.

[0039] Further, the process of determining the abnormality of the actual measured value of the power data based on the predicted value of the power data and the actual measured value of the power data includes:

[0040] Calculate the mean square error, mean absolute error, and residual between the actual measured value of the power data and the predicted value of the power data;

[0041] Based on the mean square error, mean absolute error, and residual, calculate the comprehensive error as:

[0042] T = MSE·α + MAE·β + Residual(t)·γ

[0043] Where: T is the comprehensive error, MSE is the mean square error, MAE is the mean absolute error, Residual(t) is the residual, and α, β, γ are the confidence levels corresponding to the mean square error, mean absolute error, and residual, respectively;

[0044] Compare the comprehensive residual with the set anomaly detection threshold. When the comprehensive residual is greater than the anomaly detection threshold, it is determined that the actual measured value of the power data is abnormal; otherwise, it is determined that the actual measured value of the power data is normal.

[0045] Further, the convolutional neural network and the LSTM network are pre-trained, and the loss function L used in the training process is:

[0046]

[0047] Where: m is the number of samples, y i is the true label of sample i, is the correlation between the predicted value and the actual value output by the network model, yact is the actual measured value of the electrical energy data, is the predicted value of the electrical energy data.

[0048] In addition, the present invention also proposes an abnormal detection system for electrical energy metering data, including:

[0049] a data acquisition module, configured to acquire the electrical energy data of the electrical energy metering device;

[0050] a local feature extraction module, configured to input the electrical energy data into a convolutional neural network to obtain the local features of the electrical energy data;

[0051] a multi-modal feature calculation module, configured to calculate the multi-modal features of the electrical energy data, and perform linear interpolation on the multi-modal features to make the number of time steps of the multi-modal features match the local features, where the multi-modal features include periodic coding features, change trend features, and temperature features;

[0052] a feature splicing module, configured to splice the multi-modal features with matching time steps and the local features to obtain a fused feature matrix and input it into an LSTM network to obtain the predicted value of the electrical energy data;

[0053] an abnormal detection module, configured to determine the abnormal situation of the actual measured value of the electrical energy data based on the predicted value of the electrical energy data and the actual measured value of the electrical energy data.

[0054] In addition, the present invention also proposes a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the abnormal detection method for electrical energy metering data as described above is implemented.

[0055] The advantages of the present invention are as follows:

[0056] (1) For power data, traditional single-feature models often can only work under specific conditions, and although the current technology can notice the influence of a certain feature on power data, relying solely on a certain feature, the prediction of power data is still not accurate enough. However, the present invention integrates features from different sources into a unified model, can extract the influence of multiple features on power data, reduces the error of power data prediction, and excludes the influence of some contingencies on the model. After fusing features of different dimensions, the neural network can consider these factors simultaneously, perform more comprehensive learning and prediction, and avoid losing the connection between features of different dimensions when processing different features separately. Especially in time-series data such as electrical energy metering data, the relationship between features is often non-linear. Through feature fusion, these relationships can be maintained and the model can learn more effectively. The model after feature fusion can process a wider range, large-scale, and multi-dimensional electrical energy metering data, and can show good robustness and adaptability in different environments and scenarios.

[0057] (2) The present invention uses a sine-cosine coding method to map the periodic characteristics of power metering data to a periodic interval (such as between 0 and 2π), which can preserve the continuity of periodic data and make it easier for the model to understand the periodic changes in the data.

[0058] (3) By dividing the year into four seasons, the model can dynamically adjust the growth rate within each season and independently predict the load growth, thereby improving the prediction accuracy.

[0059] (4) Since power data is usually affected by various factors (such as seasonal changes, holiday power consumption fluctuations, etc.) and the power load has obvious temporal and periodic fluctuations, traditional anomaly detection methods may not be able to accurately capture these complex changes. The present invention combines multiple error metrics (such as mean square error MSE and mean absolute error MAE) and residual analysis, which helps to more accurately identify anomalies in power data. Among them, MSE reflects the global error, MAE focuses on the error of individual samples, and the residual highlights the deviation between the prediction and the actual value, helping to identify potential anomalies. Therefore, more accurate anomaly detection of power data can be achieved.

[0060] Additional aspects and advantages of the present invention will be given in part in the following description, become apparent in part from the following description, or be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 is a schematic flowchart of a method for detecting anomalies in power metering data according to an embodiment of the present invention;

[0062] Figure 2 is a schematic flowchart of the training and optimization process of a neural network model in an embodiment of the present invention

[0063] Figure 3 is a schematic structural diagram of a system for detecting anomalies in power metering data according to an embodiment of the present invention;

[0064] Figure 4 is a schematic diagram of the principle of detecting anomalies in power metering data in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0065] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0066] Such as Figure 1As shown, the first embodiment of the present invention provides a method for detecting abnormality in electric energy metering data, the method comprising the following steps:

[0067] S10, collecting electric energy data from the electric energy metering device, and inputting the electric energy data into a convolutional neural network to obtain local features of the electric energy data;

[0068] It should be noted that the raw electric energy data obtained from the electric energy metering device in this embodiment includes power consumption, voltage, current, power factor, etc., and then the electric energy data is input into the convolutional neural network CNN for feature extraction. The convolutional neural network is good at extracting local features from time series data, and is particularly suitable for capturing emergencies and periodic fluctuations in electric energy data.

[0069] S20, calculating multi-mode features of electric energy data, and performing linear interpolation on the multi-mode features so that the time steps of the multi-mode features match the local features, the multi-mode features including periodic coding features, change trend features, and temperature features;

[0070] It should be noted that the multi-mode features of electric energy data calculated in this embodiment include periodic coding features, change trend features and temperature features. Since the traditional single feature model for electric energy data can only work under specific conditions, the fusion of features from different sources into a unified model helps to improve the generalization ability of the model. The model after feature fusion can handle a wider range of electric energy data situations and can show good robustness and adaptability in different environments and scenarios.

[0071] Specifically, since the data format of the multi-mode feature does not match the data format length of the output of the convolutional neural network after the convolution operation, this embodiment uses linear interpolation to match the time steps of the two features, so as to splice the periodic coding features, change trend features and temperature features with the feature vectors extracted by the convolutional neural network to obtain a new feature matrix as the input of the LSTM network, and output a more accurate prediction value of the electric energy data for a period of time in the future.

[0072] S30, splicing the multi-mode features matched with the time steps with the local features to obtain a fused feature matrix and inputting it into the LSTM network to obtain the predicted value of the electric energy data;

[0073] S40: Determine an abnormality of the actual measured value of the electric energy data based on the predicted value of the electric energy data and the actual measured value of the electric energy data.

[0074] It should be noted that in this embodiment, a model architecture combining CNN and LSTM is adopted, which is responsible for local feature extraction and temporal relationship modeling respectively, so as to give full play to the advantages of both in feature extraction and temporal modeling. The electric energy data is input into the CNN+LSTM combined model for further analysis. CNN is used to extract the local features of the electric energy data, and the local features and multi-modal features are concatenated and used as the input of the LSTM network. The bidirectional LSTM can process the forward and backward information of the input data at the same time. By concatenating the hidden states of the forward LSTM and the backward LSTM, the model can better understand the long-term dependence relationship in the temporal data and obtain the predicted value of the electric energy data at the future moment. Then, the predicted value of the electric energy data output by the neural network model is compared with the measured value of the actually collected electric energy data, so as to determine whether the measured value of the actually collected electric energy data is abnormal.

[0075] As a further preferred technical solution, step S10: collecting the electric energy data of the electric energy metering device and inputting the electric energy data into the convolutional neural network to obtain the local features of the electric energy data includes the following steps:

[0076] S11. Collect the electric energy data of the electric energy metering device;

[0077] It should be noted that by collecting electric energy measurement data, including power consumption, voltage, current, power factor, etc., the operating state of the electric meter and the load situation of the power system can be reflected. Data preprocessing is the first step in the verification of electric energy metering data to ensure the quality and accuracy of the original data.

[0078] S12. Preprocess the electric energy data to obtain the preprocessed electric energy data;

[0079] It should be noted that the preprocessing methods adopted in this embodiment include operations such as missing value filling, data normalization, time window construction, etc., to provide cleaned data for the subsequent model input. Specifically:

[0080] (1) Missing value filling

[0081] Missing values may occur in the actual application of electric energy metering data. Filling missing values is an important link in data preprocessing. To ensure the stability of model training, the following filling method is adopted:

[0082] Interpolation filling: Calculate the filling value according to the data points before and after the missing point by the linear interpolation method to ensure the continuity of the data. The formula is as follows:

[0083]

[0084] where x i is the missing value after interpolation, x i+1 and x i-1Data points before and after the missing value.

[0085] Mean filling: Fill the missing value with the mean of this feature, which is applicable to the case where the data distribution is relatively uniform. The formula is:

[0086]

[0087] where, x missing is the missing value to be filled, K is the number of samples of this feature, and x i are the other non-missing values of this feature.

[0088] (2) Normalization processing

[0089] To ensure that different features have equal influence on the model, in this embodiment, the standardization (z-score) method is adopted to normalize features such as power and voltage, so that the data values are within a unified range, and to avoid the situation where the numerical values of some features are too large or too small and affect the training effect of the model:

[0090]

[0091] where, x std is the value after standardization, μ is the mean of the feature, and σ is the standard deviation of the feature.

[0092] (3) Constructing time series with a sliding window

[0093] Power metering data usually has time dependence. Therefore, a sliding window method is used to construct the input dataset. By specifying the window size (such as 14 days), the input shape of each time window is (M, features), where M is the window size and features is the number of features at each time step. The power data within each window is used as the input feature of the model to predict the future power change trend.

[0094] S13. Input the preprocessed power data into a convolutional neural network to obtain the local features of the power data.

[0095] As a further preferred technical solution, the step S13: Input the preprocessed power data into a convolutional neural network to obtain the local features of the power data, specifically includes:

[0096] Slice the preprocessed power data into multiple time windows to form an input sequence with the shape of (T, N) and input it into the convolutional neural network to obtain the local features of the power data, where T is the number of time windows and N is the number of features at each time step.

[0097] It should be noted that after the data preprocessing part of this embodiment is completed, a data matrix with a shape of (n, N) is obtained, where n is the time step of the data, representing the length of the time series; N is the number of features at each time step, such as power, voltage, current, etc. The data matrix is the input of the CNN model, and the electrical energy data will be cut into multiple time windows to form an input sequence with a shape of (T, N), where T is the number of time windows.

[0098] It should be understood that if the electrical energy data is not preprocessed in this embodiment, the electrical energy data will be directly cut into multiple time windows to form an input sequence and input into the convolutional neural network.

[0099] As a further preferred technical solution, in step S20: calculating the multi-modal features of the electrical energy data and performing linear interpolation on the multi-modal features to make the number of time steps of the multi-modal features match the local features, specifically includes the following steps:

[0100] S21. Perform sine-cosine encoding on the periodic features of the electrical energy data to obtain periodic encoding features;

[0101] It should be noted that in order for the LSTM to recognize the periodic changes in the electrical energy data, this embodiment takes the month-day features (i.e., month and date) as periodic features and inputs them into the LSTM. This feature can reflect the electricity consumption differences in different seasons and holidays, and enhance the model's perception ability of seasonal fluctuations and holiday effects.

[0102] Specifically, this embodiment performs sine-cosine encoding on the extracted month and date features. This method can map the periodic data to a periodic interval, enabling the LSTM to better process the periodicity of these features.

[0103] S22. Divide into four stages according to quarters, and predict the change trend of the electrical energy data in each stage to obtain the change trend features of each stage;

[0104] It should be noted that the change of electricity consumption is often closely related to seasons. For example, the use of air conditioners in summer and the heating demand in winter will cause significant fluctuations in electricity use. To accurately capture the actual fluctuations of electricity consumption, this embodiment considers seasonal factors, divides into four stages according to seasons, dynamically adjusts the growth rate within each stage, and independently predicts the load growth, thereby improving the prediction accuracy.

[0105] S23. Process the ambient temperature corresponding to the electrical energy data to obtain temperature features;

[0106] It should be noted that in this embodiment, considering the characteristics of the temperature change rate (temperature difference) and hysteresis (the change of power data does not immediately respond to the change of temperature), the temperature characteristics corresponding to the electrical energy data are calculated.

[0107] S24. Perform linear interpolation on the periodic coding feature, the change trend feature, and the temperature feature, so that the number of time steps of the periodic coding feature, the change trend feature, and the temperature feature matches the local feature.

[0108] Specifically, in this embodiment, the periodic feature (i.e., the sine and cosine coding of the month and day) is concatenated with the local feature output by the CNN to form the final input data. Specifically, the periodic feature, the change trend, the temperature feature, and the feature vector extracted by the CNN are concatenated to obtain a new feature matrix as the input of the LSTM network. Since the data format of the multi-modal feature does not match the length of the data format output after the CNN convolution operation, linear interpolation is used to match the number of time steps of the two features.

[0109] As a further preferred technical solution, in the step S21: performing sine and cosine coding on the periodic feature of the electrical energy data, the obtained periodic coding feature is:

[0110]

[0111] In the formula: day_sine is the date sine coding feature, day_cosine is the date cosine coding feature, month_sine is the month sine coding feature, month_cosine is the month cosine coding feature, day represents the date (from 1 to 7, corresponding to Monday to Sunday respectively), and month represents the month.

[0112] Specifically, after periodic coding, a set of (n, 4) feature codings are obtained, that is, n time steps and 4 periodic codings: (mouth_sine, mouth_cosine, day_sine, day_cosine).

[0113] The advantages of processing power data using the sine-cosine encoding method in this embodiment are as follows: (1) Avoiding the linearization problem of periodic features: Other encoding forms, such as one-hot encoding, transform periodic features (such as months or dates) into discrete numerical values, which may lose their essential periodic information; while sine-cosine encoding maps periodic features to a periodic interval (such as between 0 and 2π), which can preserve the continuity of periodic data, making it easier for the model to understand the periodic changes in the data. Here, discrete and continuous mean that the encoded values are non-adjacent numbers, but there is a clear continuous relationship between these numbers, rather than just being independent of each other. (2) Unambiguous representation of periodic information: When using sine-cosine encoding, two adjacent time points (for example, two consecutive months) are continuous in the encoded space, so that the LSTM can clearly understand the periodic relationship between these time points, avoiding the situation where periodic features may be non-adjacent when using other encoding methods. (3) Reducing the computational complexity of the model: The features provided by sine-cosine encoding can be directly embedded into the neural network for training without additional processing steps (for example, in one-hot encoding, a new dimension needs to be created for each feature value), thus reducing the dimension of the feature space and improving the computational efficiency.

[0114] As a further preferred technical solution, in step S22: divide into four stages according to quarters, and predict the change trend of power data in each stage, and the change trend characteristics of each stage are:

[0115]

[0116] In the formula: L i is the maximum data in stage i, k i is the growth rate in stage i, t i is the demarcation point in stage i, and g(t) is the change trend characteristic at time t.

[0117] Specifically, in this embodiment, the growth model is divided into four stages based on the four seasons. The growth rate and the maximum data in each stage can be obtained through model training, and a (n, 1) change trend characteristic is obtained.

[0118] It should be noted that since the change in power consumption is often closely related to seasons. For example, the use of air conditioners in summer and the heating demand in winter will cause significant fluctuations in electricity use. If these seasonal factors are not considered, using a single growth model may not be able to accurately capture the actual fluctuations in power consumption; in this embodiment, by dividing into four stages according to seasons, the model can dynamically adjust the growth rate within each stage and independently predict the load growth, so that the prediction can more flexibly adapt to different power systems and electricity consumption environments.

[0119] In practical applications, more targeted adjustments can also be made according to the power demand characteristics of specific regions, so as to improve the migration application effect of the overall model. Through transfer learning, the power prediction tasks in different regions and different climates can be completed more flexibly.

[0120] As a further preferred technical solution, the processing of the ambient temperature corresponding to the power data to obtain the temperature feature is as follows:

[0121] ΔT t =T t-1 -T t-2

[0122] In the formula: ΔT t is the temperature feature, T t-1 is the ambient temperature at time t-1, and T t-2 is the ambient temperature at time t-2.

[0123] In this embodiment, considering the characteristics of the temperature change rate (temperature difference) and hysteresis (the change of power data does not immediately respond to the change of temperature), the temperature feature is processed to obtain a time feature of (n, 1).

[0124] As a further preferred technical solution, in step S24: linear interpolation is performed on the periodic coding feature, the change trend feature, and the temperature feature, so that the number of time steps of the periodic coding feature, the change trend feature, and the temperature feature matches the local feature. The formula is expressed as:

[0125]

[0126] In the formula: y 1 , y 2 are the multi-modal features at time steps t 1 , t 2 respectively. t is the time step to be calculated, and y is a set of feature results matching the number of steps of the local feature obtained by the interpolation method, so that the multi-modal feature can be concatenated with the local feature.

[0127] Specifically, in this embodiment, the original time step length is n, and to interpolate to n-k+1, the time step to be calculated is where a is (1, 2, 3... n).

[0128] As a further preferred technical solution, in step S30: the multi-modal features with matching time steps are concatenated with the local features to obtain a fused feature matrix and input into the LSTM network to obtain the power data prediction value, which specifically includes the following steps:

[0129] S31. Concatenate the multi-modal features that match the time steps with the local features to obtain a fused feature matrix Fused_feature of (n - k + 1, l + 1 + 1 + 4), where Fused_feature = [CNN_output, Trend_feature, Temperature_feature, period_feature], CNN_output is the local feature, Trend_feature is the change trend feature, Temperature_feature is the temperature feature, and period_feature is the periodic encoding feature;

[0130] Specifically, the convolutional neural network adopted in this embodiment is suitable for capturing emergencies and periodic fluctuations in power data. The local features are extracted through a 1D convolutional layer (Conv1D), and the data dimension is reduced through a max pooling layer (MaxPooling1D) to reduce the computational amount and improve the training speed of the model. Among them:

[0131] 1D convolutional layer: Through the convolution operation, the 1D convolutional layer slides a set of convolutional kernels on the time series data, and calculates the local feature at each position as:

[0132]

[0133] where y i is the i-th convolution output value, representing the local feature of the input data, ω j is the convolutional kernel parameter, x i+j is the input feature, b is the bias, and f is the activation function.

[0134] Pooling layer: After the convolution operation, we obtain a set of local features with the shape of (n - k + 1, 1), where k is the size of the convolutional kernel. The pooling layer is used to reduce the dimension of the output feature map after convolution, reduce the computational amount and retain the important features. The max pooling (MaxPooling) method is used to select the maximum value in each pooling window.

[0135] It should be noted that in this embodiment, fusing features from different sources into a unified model helps to improve the generalization ability of the model, enables it to handle a wider range of power data situations, and can exhibit better robustness and adaptability in different environments and scenarios. Because after fusing these features with different dimensions, the neural network can consider these factors simultaneously, conduct more comprehensive learning and prediction. If different features are processed separately, the relationships between them may be lost. Especially in time series data, the relationships between features are often non-linear. Through feature fusion, these relationships can be maintained and the model can learn more effectively.

[0136] Moreover, the scale of power data is usually extremely large. Especially in complex systems such as smart grids, the number of power metering devices and the complexity of data are both increasing continuously. By fusing different features, neural networks can effectively process this large-scale and multi-dimensional data, improving the application effect in large-scale power systems.

[0137] S32. Input the fused feature matrix into the LSTM network to obtain the forward information and backward information of the fused feature matrix, and splice the forward information and backward information to obtain the power data prediction value.

[0138] It should be noted that LSTM can effectively capture the long-term dependence relationships in power metering data, especially suitable for analyzing long-term trend changes and seasonal fluctuations in the data. To more accurately reflect the various influences on power metering data, this embodiment designs a comprehensive weighted feature of multi-mode data to enhance the model's learning ability for power load changes. This feature captures the multi-dimensional characteristics of power load through the weighted combination of different input features.

[0139] Among them, the processing process of the LSTM network is as follows:

[0140] (1) Calculate the data to be discarded from the memory cell:

[0141] f t =σ(w f ·[h t-1 ,x t +b f )

[0142] In the formula: f t is the output of the forget gate, σ is the sigmoid activation function, and the output range is between [0,1]; w f is the weight matrix of the forget gate, h t-1 is the concatenation of the previous hidden state and the current input, and b f is the bias term.

[0143] (2) Calculate the new data to be added to the memory cell:

[0144] i t =σ(w f ·[h t-1 ,x t +b f )

[0145] In the formula: i t is the output of the forget gate.

[0146] (3) Calculate the new candidate memory:

[0147]

[0148] In the formula: is the candidate memory unit, representing the new candidate memory content generated at the current moment. Wc is the weight matrix of the candidate memory unit, and [h t-1 , x t is the concatenation of the hidden state at the previous moment and the current input. b C is the bias term.

[0149] (4) Update the memory unit at the current moment:

[0150]

[0151] In the formula: Ct is the state at the current moment, and f t is the output of the forget gate, controlling the degree of forgetting of the state at the previous moment. C t-1 is the state at the previous moment. i t is the output of the input gate, controlling the degree of introduction of the current candidate memory content. is the candidate memory content at the current moment.

[0152] (6) Control the information output:

[0153] O t = σ(W o · [h t-1 , χ t + b 0 )

[0154] In the formula: O t is the output of the output gate, representing the degree to which the current state is passed to the next layer or used as the final output. W o is the weight matrix of the output gate. [h t-1 , χ t is the concatenation of the hidden state at the previous moment and the current input. b 0 is the bias term.

[0155] (7) Calculate the hidden state at the current moment:

[0156] h t = O t · tanh(C t )

[0157] In the formula: h t is the hidden state at the current moment. O t is the output of the output gate, determining the influence of the current state on the hidden state. C t is the state at the current moment. tanh is the activation function, and its output range is between [-1, 1].

[0158] Specifically, the output of the LSTM network is connected to a fully connected layer, which is used to input the previously extracted temporal features and local features into the fully connected layer for fusion, and finally the prediction result of the electrical energy data is output through a linear activation function.

[0159] As a further preferred technical solution, in step S40: based on the predicted value of the electrical energy data and the actual measured value of the electrical energy data, determine the abnormal situation of the actual measured value of the electrical energy data, which specifically includes the following steps:

[0160] S41. Calculate the error parameters between the actual measured value of the electrical energy data and the predicted value of the electrical energy data. The error parameters include mean square error, mean absolute error, and residual.

[0161] Specifically, in this embodiment, the predicted value of the electrical energy data is output by using the neural network model, and then the abnormal detection of the electrical energy data is further calculated to ensure the reliability of the electrical energy measurement data. The key to this step is to timely discover possible abnormal data through the error analysis between the predicted value and the actual measured value of the model. The mean square error (MSE) can effectively evaluate the overall prediction error, while the mean absolute error (MAE) helps to evaluate the prediction accuracy of a single sample. The calculation formulas are as follows:

[0162]

[0163] Where, Y Pre is the predicted value of the electrical energy data output by the model, Y act is the actual electrical energy data, and n is the number of samples.

[0164] It should be noted that respective error thresholds are set for MSE and MAE, and respective confidence levels α and β are given, which can be dynamically changed through training.

[0165] The prediction error (residual) is calculated as:

[0166] Residual(t) = |Y act - Y Pre |

[0167] Where, Y act is the actual value, and Y Pre is the predicted value.

[0168] S42. Based on the mean square error, mean absolute error, and residual, calculate the comprehensive error as:

[0169] T = MSE·α + MAE·β + Residual(t)·γ

[0170] Where: T is the comprehensive error, MSE is the mean square error, MAE is the mean absolute error, Residual(t) is the residual, and α, β, and γ are the confidence levels corresponding to the mean square error, mean absolute error, and residual, respectively;

[0171] S43. Compare the comprehensive residual with the set anomaly detection threshold. When the comprehensive residual is greater than the anomaly detection threshold, it is determined that the actual measured value of the power data is abnormal; otherwise, it is determined that the actual measured value of the power data is normal.

[0172] It should be noted that in this embodiment, by directly performing weighted summation on the three error parameters, it is simple and intuitive, without the need for preprocessing of the error parameters, and the training speed is fast. This method omits the step of parameter anomaly judgment and is applicable to the case of clean and stable data. However, if extreme errors are encountered, it may affect the calculation of the comprehensive error. Therefore, this embodiment adds a preprocessing process for the error parameters. First, abnormal error values that do not meet the expectations are screened out, so that the model training is more stable. However, the threshold needs to be set reasonably when selecting it, otherwise it will affect the final result. This method has strong robustness and higher accuracy, as follows:

[0173] In this embodiment, the mean square error, mean absolute error, and residual calculated can also be respectively subjected to anomaly judgment. When the judgment is normal, the value is 1, and when the judgment is abnormal, the value is 0. Then, the comprehensive error is calculated using the error parameters determined to be normal in the judgment result, and the comprehensive error is compared with a preset threshold. When the comprehensive error is greater than the threshold, it is determined that the currently actually measured power data is abnormal; when the comprehensive error is less than or equal to the threshold, it is determined that the currently actually measured power data is normal.

[0174] Furthermore, the anomaly judgment process for the residual, mean square error, and mean absolute error is as follows:

[0175] (1) Residual anomaly judgment:

[0176] Calculate the mean and standard deviation of the residual, and set the anomaly detection threshold for the residual:

[0177] The mean of the residual is:

[0178]

[0179] The standard deviation of the residual is:

[0180]

[0181] Determine the anomaly detection threshold:

[0182] The value range of Threshold is [u - 3·σ, u + 3·σ]

[0183] Specifically, if the residual is greater than or less than the anomaly detection threshold, the residual is judged as an outlier, and a judgment result of 1 (normal value) or 0 (outlier) is given, and a partial confidence γ is assigned to the residual.

[0184] (2) Compare the mean square error and the mean absolute error with their respective threshold ranges respectively. If they are within the threshold range, it is determined that the mean square error or the mean absolute error is judged as a normal value, otherwise it is judged as an outlier.

[0185] (3) Calculate the comprehensive error using the error parameters with normal judgment results:

[0186] Assume that the judgment result of the mean square error is abnormal, and the judgment results of the mean absolute error and the residual are normal, then the comprehensive error is calculated as:

[0187] T = MAE·β + Residual(t)·γ.

[0188] In particular, when the anomaly results of all three error parameters are judged as 0, it is directly considered that the actually measured power metering data is abnormal data.

[0189] It should be noted that in this embodiment, a comprehensive anomaly judgment algorithm (Dynamic Weighted Residual Anomaly Detection) combining residual anomaly detection with MSE and MAE is used to judge the anomaly situation of the actually measured power data. This method has higher accuracy compared to the original residual anomaly monitoring method: (1) It increases robustness. The residual algorithm itself identifies anomalies by calculating the difference between the predicted value and the actual value. However, in data with extreme values or high noise, using only the residual may lead to overfitting or misjudgment. By combining MSE and MAE, this influence can be eliminated, ensuring that the model is not overly disturbed by a few outliers or extreme values. (2) It reduces the influence of extreme outliers on the model. A single residual algorithm may cause bias in the prediction model when there are extreme outliers. For example, in power loads, sudden large-scale load fluctuations may occur. If only the residual is used for detection, overfitting and misjudgment may not be effectively avoided. (3) It increases the accuracy of outlier identification. By introducing MSE and MAE, the judgment criteria can be further refined by comparing the results of different error metrics, improving the detection accuracy. Combining the results of multiple error metrics and residual judgment can better handle the uncertainty and diversity of data, making anomaly detection more accurate in various scenarios. (4) A more flexible threshold judgment method. Compared with the original residual judgment algorithm, the dynamic weights and thresholds in this embodiment can provide a more flexible judgment basis for the accuracy of the model.

[0190] As a further preferred technical solution, such as Figure 2As shown, the CNN+LSTM combined model adopted in this embodiment is a pre-trained network model for predicting power data, and the training process is as follows:

[0191] (1) The dataset consists of multiple types of data: power data (voltage, power consumption, current, power factor, etc.), temperature data, calculated trend feature data, and time-related periodic feature data.

[0192] The dataset is divided in the ratio of 7:2:1, where 70% is used for training, 20% for validation, and the remaining 10% for testing. This division can ensure the training effect of the model and verify its generalization ability.

[0193] Specifically, after these data pass through the data preprocessing part, they are added to the neural network. Among them, the power data is first input into the cnn to obtain a feature matrix, and then combined with the remaining several types of feature data.

[0194] (2) Set the loss function. Regarding the network model and the anomaly detection part as a whole, train the neural network according to the judgment result. The binary cross-entropy loss function is the most common choice for dealing with binary classification problems. It can effectively optimize the accuracy of the network in identifying abnormal and normal data and can better handle possible faults and fluctuations in the power system. Therefore, in this embodiment, the loss function of the network model is set as the binary cross-entropy loss function:

[0195]

[0196] In the formula: m is the number of samples, y i is the true label of sample i, is the correlation between the predicted value and the actual value output by the network model, y act is the actual measured value of the power data, is the predicted value of the power data.

[0197] (3) Adam optimizer:

[0198] The Adam optimizer is used for gradient update, which is responsible for adjusting each parameter (such as weights and biases) in the neural network to minimize the loss function of the model, thereby improving the prediction accuracy of the network, and automatically adjusting the learning rate to improve the convergence speed of the model.

[0199] Specifically:

[0200] 3-1) Initialization

[0201] Before the start of training, the Adam optimizer will initialize the following variables: initial parameters: θ0 and b0 (initial weights and biases of the model), first-order moment estimation (momentum), and second-order moment estimation, which are initialized to zero:

[0202] m0 = 0 (First moment estimate)

[0203] v0 = 0 (Second moment estimate)

[0204] 3-2) Calculate the gradient

[0205] At each training, first calculate the gradients of the network parameters θ and b with respect to the loss function L:

[0206]

[0207] In the formula, gt is the gradient at the current time t, representing the rate of change of the loss function with respect to the parameters; represents the gradient operator (i.e., partial derivative operation);

[0208] 3-3) Calculate the first moment estimate

[0209] Adam calculates the first moment (momentum) estimate m t , which is the exponentially weighted average of the gradients. Momentum is used to accelerate convergence through historical gradients. Update formula:

[0210] m t = β 1 ·m t-1 +(1 - β 1 )·g t

[0211] where β1 is the decay rate of the first moment, usually taking a value close to 1 (e.g., 0.9), and here it is taken as 0.95. mt is the first moment estimate at the previous time. gt is the gradient at the current time.

[0212] 3-4) Calculate the second moment estimate

[0213] Adam also calculates the exponentially weighted average of the squares of the gradients, i.e., the second moment estimate vt, which reflects the variance of the gradients. The second moment estimate is used to adjust the learning rate of each parameter to prevent unstable parameter updates caused by overly large gradients. Update formula:

[0214]

[0215] In the formula, β2 is the decay rate of the second moment, usually taking a value close to 1 (e.g., 0.999); v t-1 is the second moment estimate at the previous time; is the square of the gradient at the current time.

[0216] 3-5) Bias correction

[0217] Since both mt and vt are initialized to 0 at the beginning, their estimates will be on the small side in the initial stage. Therefore, it is necessary to correct the biases of the first moment and the second moment, especially in the first few training steps when the biases are relatively large. The bias correction formula:

[0218]

[0219] In the formula, m′ t and v′ t are the estimates after bias correction, which reduce the bias; t is the current training time step (iteration number).

[0220] 3 - 6) Update the parameters

[0221] Use the first moment estimate m′ t and the second moment estimate v′ t to update the parameters θt and the bias bt. The parameter update formula (bt is the same):

[0222]

[0223] In the formula, θt - 1 is the parameter at the previous moment, θt is the parameter at the current moment, α is the learning rate, and ∈ is a small constant (such as 10e - 8) used to avoid division by zero errors.

[0224] (4) Transfer learning:

[0225] Through transfer learning, fine - tune the parameters based on the pre - trained model so that it can adapt to the new power metering device, reduce the time cost of model training, and improve the efficiency of data processing.

[0226] (5) Hyperparameter optimization:

[0227] Adopt grid search or random search methods to optimize hyperparameters such as the learning rate and batch size to maximize the training effect and accuracy of the model.

[0228] In this embodiment, the data is first pre - processed, and then the short - term characteristics of the power data are obtained by training the power data using the CNN network. The obtained characteristics are concatenated with other multi - modal characteristics and input into the LSTM network to obtain the prediction value. Then, anomaly recognition is performed based on the prediction value, and the parameters of each part in the network are updated by backpropagation using the adam optimizer based on the anomaly recognition result.

[0229] In addition, as Figures 3 to 4 shown, the second embodiment of the present invention proposes a power metering data anomaly detection system, which specifically includes:

[0230] The data acquisition module 10 is used to collect the power data of the power metering device;

[0231] The local feature extraction module 20 is used to input power data into a convolutional neural network to obtain local features of the power data;

[0232] The multi-modal feature calculation module 30 is used to calculate multi-modal features of the power data and perform linear interpolation on the multi-modal features so that the number of time steps of the multi-modal features matches the local features. The multi-modal features include periodic coding features, change trend features, and temperature features;

[0233] The feature splicing module 40 is used to splice the multi-modal features with matching time steps and the local features to obtain a fused feature matrix and input it into an LSTM network to obtain a power data prediction value;

[0234] The anomaly detection module 50 is used to determine the anomaly situation of the actual measured value of the power data based on the power data prediction value and the actual measured value of the power data.

[0235] As a further preferred technical solution, the system further includes a data preprocessing module, which is used to: preprocess the power data to obtain preprocessed power data.

[0236] As a further preferred technical solution, the present embodiment adopts a combined model of CNN + LSTM, including an input layer, a CNN, an LSTM, and a fully connected layer. The input layer is used to divide the power data into multiple time windows to form an input sequence with a shape of (T, N) and input it into the convolutional neural network to obtain local features of the electrified data. Here, T is the number of time windows, and N is the number of features at each time step.

[0237] The convolutional neural network CNN is used to extract local features from the input time series data through a 1D convolutional layer and a max pooling layer. The CNN part extracts local features from the input time series data. The LSTM layer is responsible for processing the temporal relationship in the data. Especially in the scenario of long-term dependence, the LSTM can use its memory unit (cell state) to capture the long-term trend of the time series data. The bidirectional LSTM further strengthens the memory ability of the model through two time flows in the forward and reverse directions, thereby providing a more accurate temporal prediction.

[0238] The fully connected layer is used to input the previously extracted temporal features and local features into the fully connected layer for fusion, and finally output the prediction result through a linear activation function.

[0239] As a further preferred technical solution, the multi-modal feature calculation module 30 specifically includes:

[0240] An encoding unit, which is used to perform sine-cosine encoding on the periodic features of the power data to obtain periodic coding features;

[0241] A change trend feature calculation unit, which is used to divide four stages according to quarters, and predict the change trend of power data in each stage to obtain the change trend features of each stage;

[0242] A temperature feature calculation unit, which is used to process the ambient temperature corresponding to the power data to obtain temperature features;

[0243] An interpolation unit, which is used to perform linear interpolation on the periodic coding feature, the change trend feature and the temperature feature, so that the number of time steps of the periodic coding feature, the change trend feature and the temperature feature matches the local feature.

[0244] As a further preferred technical solution, the feature splicing module 40 is specifically used for:

[0245] Splice the multi-modal features with matching time steps and the local features to obtain a fused feature matrix Fused_feature = [CNN_output, Trend_feature, Temperature_feature, period_feature] and input it into the LSTM network, where CNN_output is the local feature, Trend_feature is the change trend feature, Temperature_feature is the temperature feature, and period_feature is the periodic coding feature.

[0246] As a further preferred technical solution, the anomaly detection module 50 includes:

[0247] An error calculation unit, which is used to calculate the mean square error, the mean absolute error and the residual between the actual measured value of the power data and the predicted value of the power data;

[0248] A comprehensive error calculation unit, which is used to calculate the comprehensive error based on the mean square error, the mean absolute error and the residual as follows:

[0249] T = MSE·α + MSE·β + Residual(t)·γ

[0250] In the formula: T is the comprehensive error, MSE is the mean square error, MAE is the mean absolute error, Residual(t) is the residual, and α, β, γ are the confidence levels corresponding to the mean square error, the mean absolute error and the residual respectively;

[0251] An anomaly judgment unit, which is used to compare the comprehensive residual with a set anomaly detection threshold, and determine that the actual measured value of the power data is abnormal when the comprehensive residual is greater than the anomaly detection threshold, otherwise determine that the actual measured value of the power data is normal.

[0252] It should be noted that for other embodiments or specific implementation methods of the power metering data anomaly detection system of the present invention, reference may be made to the above method embodiments, and details are not described herein again.

[0253] In addition, the present invention also proposes a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the power metering data anomaly detection method described in the above embodiments is implemented.

[0254] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in combination with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or other appropriate processing as necessary, and then stored in a computer memory.

[0255] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

[0256] In the description of this specification, the descriptions referring to terms such as "one embodiment", "some embodiments", "examples", "specific examples", or "some examples", etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0257] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, the meaning of "a plurality of" is at least two, such as two, three, etc., unless otherwise specifically defined.

[0258] Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for detecting abnormality in electric energy metering data, characterized in that: include: Collecting electric energy data from an electric energy metering device, and inputting the electric energy data into a convolutional neural network to obtain local features of the electric energy data; Calculating multi-mode features of electric energy data and performing linear interpolation on the multi-mode features so that the time steps of the multi-mode features match the local features, wherein the multi-mode features include periodic coding features, change trend features, and temperature features; The multi-mode features matching the time steps are concatenated with the local features to obtain a fused feature matrix and input it into the LSTM network to obtain the predicted value of the electric energy data; Based on the predicted value of the electric energy data and the actual measured value of the electric energy data, an abnormality of the actual measured value of the electric energy data is determined.

2. The method for detecting abnormality in electric energy metering data according to claim 1, characterized in that: After collecting the electric energy data of the electric energy metering device, the method further includes: Preprocessing the electric energy data to obtain preprocessed electric energy data; Accordingly, the preprocessed electric energy data is input into the convolutional neural network to obtain the local features of the electric energy data.

3. The method for detecting abnormality in electric energy metering data according to claim 1, characterized in that: The step of inputting the electric energy data into the convolutional neural network to obtain local features of the electric energy data includes: The electric energy data is divided into multiple time windows to form an input sequence of shape (T, N) and input into the convolutional neural network to obtain the local features of the electrification data, where T is the number of time windows and N is the number of features in each time step.

4. The method for detecting abnormality in electric energy metering data according to claim 1, wherein: The step of calculating the multi-mode features of the electric energy data and performing linear interpolation on the multi-mode features so that the time steps of the multi-mode features match the local features includes: Perform sine and cosine encoding on the periodic characteristics of the electric energy data to obtain periodic coding characteristics; Divide the data into four stages according to the quarter, and predict the change trend of the electric energy data in each stage to obtain the change trend characteristics of each stage; Process the ambient temperature corresponding to the electric energy data to obtain temperature characteristics; Linear interpolation is performed on the periodic coding feature, the change trend feature and the temperature feature so that the time steps of the periodic coding feature, the change trend feature and the temperature feature match the local feature.

5. The method for detecting abnormality in electric energy metering data according to claim 4, characterized in that: The step of performing sine and cosine encoding on the periodic characteristics of the electric energy data to obtain the periodic coding characteristics includes: The date features and month features of the electric energy data are sine-cosine coded to obtain the date coding features and month coding features as follows: Wherein: day_sine is the date sine encoding feature, day_cosine is the date cosine encoding feature, month_sine is the month sine encoding feature, month_cosine is the month cosine encoding feature, day represents the date, and month represents the month.

6. The method for detecting abnormality in electric energy metering data according to claim 4, characterized in that: The four stages are divided according to the quarter, and the change trend of the electric energy data in each stage is predicted, and the change trend characteristics of each stage are obtained as follows: Where: L i is the maximum data of stage i, k i is the growth rate of stage i, t i is the dividing point of stage i, and g(t) is the changing trend characteristic at time t.

7. The method for detecting abnormality in electric energy metering data according to claim 4, characterized in that: The ambient temperature corresponding to the electric energy data is processed to obtain the temperature characteristic: ΔT t =T t-1 -T t-2 Where: ΔT t is the temperature characteristic, T t-1 is the ambient temperature at time t-1, T t-2 is the ambient temperature at time t-2.

8. The method for detecting abnormality in electric energy metering data according to claim 4, characterized in that: The linear interpolation of the periodic coding feature, the change trend feature and the temperature feature so that the time steps of the periodic coding feature, the change trend feature and the temperature feature match the local feature includes: Linear interpolation is used to process the periodic coding features, change trend features and temperature features respectively, and the time steps of the periodic coding features, change trend features and temperature features are converted into the time steps of the local features. The formula is expressed as follows: Where y1 and y2 are the multimodal features of time steps t1 and t2 respectively, t is the time step to be calculated, and y is the feature result that matches the number of local feature steps.

9. The method for detecting abnormality in electric energy metering data according to claim 1, wherein: The multi-mode features matching the time step number are concatenated with the local features to obtain a fused feature matrix and input it into the LSTM network to obtain the predicted value of the electric energy data, including: The multi-mode features matched with the time step number are spliced ​​with the local features to obtain the fused feature matrix Fused_feature = [CNN_output, Trend_feature, Temperature_feature, period_feature], where CNN_output is the local feature, Trend_feature is the trend feature, Temperature_feature is the temperature feature, and period_feature is the periodic coding feature; The fused feature matrix is ​​input into the LSTM network to obtain the forward information and reverse information of the fused feature matrix, and the forward information and reverse information are concatenated to obtain the predicted value of the electric energy data.

10. The method for detecting abnormality in electric energy metering data according to claim 1, wherein: The determining, based on the predicted value of the electric energy data and the actual measured value of the electric energy data, of an abnormal situation of the actual measured value of the electric energy data comprises: Calculate the mean square error, mean absolute error and residual between the actual measured value of the electric energy data and the predicted value of the electric energy data; Based on the mean square error, mean absolute error and residual error, the comprehensive error is calculated as: T=MSE·α+MAE·β+Residual(t)·γ Where: T is the comprehensive error, MSE is the mean square error, MAE is the mean absolute error, Residual(t) is the residual, α, β, γ are the trust corresponding to the mean square error, mean absolute error and residual respectively; The comprehensive residual is compared with the set abnormal detection threshold. When the comprehensive residual is greater than the abnormal detection threshold, it is determined that the actual measurement value of the electric energy data is abnormal; otherwise, it is determined that the actual measurement value of the electric energy data is normal.

11. The method for detecting abnormality in electric energy metering data according to any one of claims 1 to 10, characterized in that: The convolutional neural network and LSTM network are pre-trained, and the loss function L used in the training process is: Where: m is the number of samples, y is i is the true label of sample i, The correlation between the predicted value and the actual value output by the network model, y act is the actual measured value of the electric energy data, The predicted value for electric energy data.

12. An electric energy metering data anomaly detection system, characterized in that: include: A data acquisition module, used for collecting electric energy data of the electric energy metering device; A local feature extraction module is used to input the electric energy data into a convolutional neural network to obtain local features of the electric energy data; A multi-mode feature calculation module, used to calculate the multi-mode features of the electric energy data and perform linear interpolation on the multi-mode features so that the time steps of the multi-mode features match the local features, wherein the multi-mode features include periodic coding features, change trend features, and temperature features; The feature concatenation module is used to concatenate the multi-mode features with the local features that match the time steps, obtain the fused feature matrix and input it into the LSTM network to obtain the predicted value of the electric energy data; The anomaly detection module is used to determine the abnormality of the actual measured value of the electric energy data based on the predicted value of the electric energy data and the actual measured value of the electric energy data.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for detecting anomalies in electric energy metering data according to any one of claims 1 to 11 is implemented.