Power consumption anomaly detection method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202610774891.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-01
- Publication Date
- 2026-10-20
AI Technical Summary
[0015]从上面所述可以看出,本申请提供的用电量异常检测方法通过滑动窗口技术对历史用电量数据进行切片得到历史用电量矩阵,并根据历史用电量矩阵对神经网络模型训练,得到用于识别用户用电量是否异常的电量识别模型,从而实现对用户用电量的准确识别,提高管理效率与精准度,避免传统人工核对可能出现的疏漏。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the field of power grid power consumption monitoring technology, and in particular to a method, device, electronic equipment and storage medium for detecting abnormal power consumption. Background Technology
[0002] With the widespread adoption of smart meters, the power system is rapidly transforming from a traditional grid to a smart grid. In this process, the timely and full collection of electricity fees has become a core issue affecting the economic benefits and stable operation of power grid companies. To fundamentally guarantee electricity fee collection and improve operational efficiency, power supply companies are vigorously promoting a "pay first, use later" business model, realizing a strategic shift from local to remote fee control. Against this backdrop, accurate calculation for remote fee control users is crucial.
[0003] To improve calculation accuracy and prevent abnormal electricity consumption from incurring charges, the daily calculation process triggers a series of audit rules, conducting multi-dimensional verification of user profiles, electricity consumption, and electricity charges. Electricity consumption is the direct basis for electricity charge calculations, and abnormal fluctuations in its data are early signals of energy efficiency issues, equipment malfunctions, and even operational risks. By analyzing massive amounts of electricity consumption data in real-time or near real-time, and identifying electricity consumption behaviors that deviate from normal patterns, the risk control focus can be shifted from "after the cost occurs" to "during electricity consumption." This achieves a fundamental shift from post-event remediation to in-process intervention and even pre-event warning, greatly enhancing the initiative and accuracy of cost control management, which is an essential requirement for lean energy management. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a method, device, electronic device and storage medium for detecting abnormal power consumption.
[0005] To achieve the above objectives, this application provides a method for detecting abnormal electricity consumption, comprising: slicing preset historical electricity consumption data of users using a sliding window technique to obtain a historical electricity consumption matrix; inputting the historical electricity consumption matrix into a preset neural network model to train the neural network model and obtain an electricity consumption anomaly recognition model; and inputting the electricity consumption data of the user to be detected into the electricity consumption recognition model to obtain the electricity consumption recognition result.
[0006] In some embodiments, before slicing the preset historical user electricity consumption data according to the sliding window technique, the method further includes: cleaning the pre-acquired historical user electricity consumption information to obtain cleaned electricity consumption data. The cleaned electricity consumption data is then standardized to obtain standardized electricity consumption data. The standardized electricity consumption data is determined by the following formula: .in, for The maximum value in. for The minimum value among them. Peak electricity consumption, average electricity consumption, and valley electricity consumption are selected from the standardized electricity consumption data as the user's historical electricity consumption data.
[0007] In some embodiments, data cleaning is performed on pre-acquired historical user electricity consumption information to obtain cleaned electricity consumption data. Specifically, this includes: calculating the number of missing data points for a single day in the historical user electricity consumption information to obtain the number of consecutively missing data points; determining the current user's daily electricity consumption data based on a horizontal mean substitution method if the number of consecutively missing data points is less than a preset missing data threshold; and determining the current user's daily electricity consumption data based on a vertical mean substitution method if the number of consecutively missing data points is not less than the missing data threshold. Cleaned electricity consumption data is obtained based on at least two daily electricity consumption data points.
[0008] In some embodiments, the missing threshold is 4. The power cleaning data is determined by the following formula: .in, This represents the battery level of the current user at time i on day t. i represents the horizontal position of the missing data. t represents the time dimension to which the missing data belongs. m and n represent the positions of the non-missing values before and after the i-th missing data in the battery level sequence on day t. k is a constant. The values of m and n represent the number of consecutive missing data.
[0009] In some embodiments, a historical electricity consumption matrix is input into a preset neural network model, and the neural network model is trained to obtain an electricity anomaly identification model. Specifically, this includes: grouping users corresponding to the historical electricity consumption matrix to obtain user grouping results. The user grouping results include at least two user groups. The historical electricity consumption matrices in the at least two user groups are labeled to obtain at least two training sets. The at least two training sets are input into at least two neural network models, and the at least two neural network models are trained using a mean squared error loss function to obtain an electricity anomaly identification model corresponding to the at least two user groups. The neural network model includes an LSTM autoencoder.
[0010] In some embodiments, the power consumption data of the user to be detected is input into the power consumption identification model to obtain the power consumption identification result. Specifically, this includes: determining the user group corresponding to the user to be detected based on the power consumption data; and inputting the power consumption data into the corresponding power consumption anomaly identification model to obtain the power consumption identification result.
[0011] An abnormal electricity consumption detection device includes: a data slicing module for slicing preset historical electricity consumption data of users using a sliding window technique to obtain a historical electricity consumption matrix; a model training module for inputting the historical electricity consumption matrix into a preset neural network model to train the neural network model and obtain an abnormal electricity consumption identification model; and an identification module for inputting the electricity consumption data of the user to be detected into the electricity consumption identification model to obtain the electricity consumption identification result.
[0012] In some embodiments, the apparatus further includes: a data processing module, configured to perform data cleaning on pre-acquired user historical power consumption information to obtain cleaned power consumption data. The cleaned power consumption data is then standardized to obtain standardized power consumption data. The standardized power consumption data is determined by the following formula: .in, for The maximum value in. for The minimum value among them. Peak electricity consumption, average electricity consumption, and valley electricity consumption are selected from the standardized electricity consumption data as the user's historical electricity consumption data.
[0013] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method described in any one of the preceding methods.
[0014] A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform any of the methods described above.
[0015] As can be seen from the above, the electricity consumption anomaly detection method provided in this application uses the sliding window technique to slice historical electricity consumption data to obtain a historical electricity consumption matrix, and trains a neural network model based on the historical electricity consumption matrix to obtain an electricity consumption identification model for identifying whether a user's electricity consumption is abnormal, thereby achieving accurate identification of user electricity consumption, improving management efficiency and accuracy, and avoiding the omissions that may occur in traditional manual verification. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the abnormal power consumption detection method provided in an embodiment of this application.
[0018] Figure 2 This is a schematic diagram of the power consumption anomaly detection device provided in the embodiments of this application; Figure 3 This is a schematic diagram of a more specific electronic device hardware structure provided in an embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0020] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0021] It is understood that before using the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner, and user authorization will be obtained.
[0022] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations of this disclosed technical solution.
[0023] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0024] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0025] In related technologies, outlier detection often employs unsupervised learning methods, such as the Local Outlier Factor (LOF), a widely used density-based outlier detection algorithm. This detection method identifies outliers by calculating the local bias of a given data point, making it suitable for outlier detection in unevenly distributed datasets. Outliers are determined based on the density between each data point and its neighbors; the lower the density, the more likely it is to be identified as an outlier.
[0026] Furthermore, supervised traditional machine learning algorithms are also frequently applied to anomaly detection scenarios. For example, Support Vector Machines (SVMs) are widely used supervised generalized linear classifiers. For binary classification problems, SVMs typically find a separating hyperplane that distinguishes between the two classes and maximizes the margin for sample classification. In anomaly detection datasets, normal data constitutes a large proportion, while anomalous data constitutes a small proportion. This imbalance can cause traditional classifiers to fail to effectively identify the low proportion of anomalous samples. However, anomaly detection can essentially be viewed as a single-class classification problem, thus making single-class support vector machines (OC-SVMs) suitable. The OC-SVM model uses a mapping function to map the training data into a high-dimensional feature space and computes an optimal hyperplane in this feature space. Data within this hyperplane is positioned as far away from the origin as possible. Any data within the hyperplane is considered normal data, while any data outside the hyperplane is considered anomalous data.
[0027] One limitation of the relevant technology is that its anomaly detection model does not take into account the temporal characteristics of electricity consumption data. Since electricity consumption data is significantly affected by seasonal changes, holidays, and other temporal factors, judging anomalies based solely on a single characteristic of electricity consumption drop is easily confused with normal user behavior where electricity consumption naturally decreases during specific periods. This leads to a high false alarm rate and fails to meet the application requirements of precise management.
[0028] Another limitation is that it is difficult to obtain enough multi-dimensional time-series data with both abnormal and normal labels in real-world situations. Therefore, using supervised learning for abnormal data identification requires a significant time and manpower cost.
[0029] An autoencoder (AE) is an artificial neural network used for unsupervised learning. The purpose of an autoencoder is to reconstruct the input vector. For output vectors with the same dimensions This model typically consists of two main parts: an encoder that maps the input vector X to an n-dimensional intermediate vector F, and an encoder that maps the intermediate vector F to an output vector. The decoder. Vector X and vector... They have the same dimension, i.e., m dimensions.
[0030] The remote fee control system mainly consists of a power master station system, a concentrator data collector, and smart meters installed in residential buildings. The power master station system has multiple terminal interfaces to connect to multiple smart meters. Data transmission between the master station and smart meters occurs wirelessly, and the system connects to the marketing business application interface to achieve data sharing between the master station and smart meters. During daily operation, various user anomalies can affect the quality of fee control during power outages and easily lead to numerous service problems.
[0031] like Figure 1 As shown, this application provides a method for detecting abnormal power consumption, including: Step S1: Slice the preset historical electricity consumption data of users according to the sliding window technique to obtain the historical electricity consumption matrix.
[0032] In this embodiment, the user's historical electricity consumption data is sliced using the sliding window technique, which can capture more information about time changes in the time series and enrich the features of the original time series, making the constructed dataset more conducive to the autoencoder learning the most representative features in the dataset.
[0033] Specifically, the user's daily peak, average, and valley electricity consumption over the past d days is denoted as Q, where q i q represents the standardized peak electricity consumption data, average electricity consumption data, and valley electricity consumption data for user i-th day. i =(qp i ,qf i ,qv i ).
[0034] Select a sliding window of T=t (t>1) (i.e., day 1 to t, day 2 to t+1, day n to n+t-1) and slice it into a time series S=s1, s2, ..., s d-t+1 , as the input vector of the model, where s i =(q i q i+1 , ..., q i+t-1 ), s i For t A 3x2 matrix, S is (d-t+1). t A 3D matrix of size 3.
[0035] Step S2: Input the historical electricity consumption matrix into the preset neural network model, train the neural network model, and obtain the electricity anomaly identification model.
[0036] Step S3: Input the power consumption data of the user to be detected into the power consumption recognition model to obtain the power consumption recognition result.
[0037] In this embodiment, a historical electricity consumption matrix is obtained by slicing historical electricity consumption data using sliding window technology. The neural network model is then trained based on the historical electricity consumption matrix to obtain an electricity consumption identification model for identifying whether a user's electricity consumption is abnormal. This enables accurate identification of user electricity consumption, improves management efficiency and accuracy, and avoids potential oversights that may occur with traditional manual verification.
[0038] In some embodiments, prior to step S1, the method further includes: Step S10: Clean the previously acquired historical user power consumption information to obtain power consumption cleaned data.
[0039] In this embodiment, during the process of collecting user electricity consumption data, it is inevitable that the data will be affected by factors such as the strength of communication signals and the condition of circuit connections, resulting in missing or outlier values in the dataset. Therefore, it is necessary to clean the user's historical electricity consumption information to remove missing or outlier values, so as to prevent invalid data from affecting model training.
[0040] Step S20: Standardize the power cleaning data to obtain standardized power data.
[0041] The standardized power data is determined by the following formula: .
[0042] in, for The maximum value in. for The minimum value in.
[0043] In this embodiment, the standardization transformation is performed using the max-min method, which reduces the sensitivity of the trained model to different data.
[0044] Step S30: Select peak electricity, average electricity and valley electricity from the standardized electricity data as the user's historical electricity consumption data.
[0045] In this embodiment, peak power, average power, and valley power are denoted as qp, qf, and qv, respectively.
[0046] In some embodiments, step S10 specifically includes: Step S101: Calculate the number of missing data points for a single day in the user's historical electricity consumption information to obtain the number of consecutively missing data points.
[0047] Step S102: In response to the number of consecutive missing data being less than a preset missing threshold, the current user's daily electricity consumption data is determined according to the horizontal mean substitution method.
[0048] Step S103: In response to the fact that the number of consecutive missing data is not less than the missing threshold, the daily electricity consumption data of the current user is determined according to the longitudinal mean substitution method.
[0049] Step S104: Obtain power cleaning data based on at least two daily power consumption data.
[0050] In this embodiment, when the number of consecutive missing data is small, the horizontal mean substitution method is relatively simple to calculate, so the current user's daily electricity consumption data is determined by the horizontal mean substitution method. When the number of consecutive missing data is large, the horizontal mean substitution method is prone to over-smoothing, making it difficult to reflect the fluctuation characteristics of the original electricity consumption curve. Therefore, when the number of consecutive missing data is not less than the missing threshold, the vertical mean substitution method is selected to determine the current user's daily electricity consumption data.
[0051] In some embodiments, the missing threshold is 4.
[0052] The power cleaning data is determined by the following formula: .
[0053] in, This represents the battery level of the current user at time i on day t. i represents the horizontal position of the missing data. t represents the time dimension to which the missing data belongs. m and n represent the positions of the non-missing values before and after the i-th missing data in the battery level sequence on day t. k is a constant. The values of m and n represent the number of consecutive missing data.
[0054] In some embodiments, step S2 specifically includes: Step S21: Group the users corresponding to the historical electricity consumption matrix to obtain user grouping results. Each user grouping result includes at least two user groups.
[0055] Step S22: Label the historical electricity consumption matrices of at least two user groups to obtain at least two training sets.
[0056] Step S23: Input at least two training sets into at least two neural network models respectively, and train the at least two neural network models according to the mean squared error loss function to obtain power anomaly identification models corresponding to at least two user groups. The neural network models include LSTM autoencoders.
[0057] In this embodiment, by using LSTM units with temporal memory capabilities as neurons in the autoencoder, the model's ability to process long-term series is enhanced, enabling it to capture long-term dependencies between electricity consumption sequences. This method considers the temporal characteristics of user electricity consumption data, eliminating the need to train the model with a large number of abnormal electricity fluctuation samples, and adaptively extracting features based on the historical electricity consumption sequences of the user to be inspected to complete anomaly identification.
[0058] For each user group, the neural network model includes an LSTM encoder and an LSTM decoder.
[0059] Specifically, the LSTM encoder consists of an L1-layer network: the first layer is the input layer, an LSTM network with L11 neurons, the activation function is ReLU, and the output type is time series; the second to (L1-1) layers are intermediate layers, LSTM networks with L12 neurons, the activation function is ReLU, and the output type is time series; the L1 layer is the output layer, a fully connected network with L13 neurons, and the activation function is a linear activation function.
[0060] The LSTM decoder consists of two L2 layers: the first layer is the input layer, an LSTM network with L21 neurons, the activation function is ReLU, and the output type is time series; the second to (L2-1) layers are intermediate layers, LSTM networks with L22 neurons, the activation function is ReLU, and the output type is time series; the L2 layer is the output layer, a fully connected layer with L23 neurons, the activation function is a linear activation function, and it is applied to each time step.
[0061] Traditional supervised learning methods for identifying anomalies are limited by the difficulty in obtaining a large number of labels for abnormal power fluctuations, while unsupervised learning methods often neglect the key temporal characteristics of power data. To overcome these limitations, this invention employs an LSTM autoencoder algorithm, whose gating mechanism effectively avoids the gradient problem of recurrent neural networks (RNNs), thereby accurately capturing long-term temporal dependencies. This method does not require training a model based on a large number of abnormal power fluctuation samples; it only needs to adaptively extract temporal features from the historical power data sequence of the user to be detected. This significantly reduces the dependence on labeled data and improves the practicality and adaptability of the detection.
[0062] In some alternative embodiments, the loss function for model training can be mean squared error, and the optimizer can be Adam. By inputting S into the LSTM encoder, the LSTM encoder encodes it to form V(v1, v2, ..., v...). L13 ), where V is the encoder output, a one-dimensional vector, and L 13 The LSTM decoder reads the encoded result V, decodes it, and generates the sequence S.r Note: S r It is a (d-t+1) t A 3D matrix of 3. Finally, the loss function is used to calculate sequence S and sequence S'. r By iteratively addressing the differences, the reconstruction loss can be minimized through continuous iteration.
[0063] In some embodiments, step S3 specifically includes: Step S31: Determine the user group corresponding to the user to be tested based on the electricity consumption data.
[0064] Step S32: Input the electricity consumption data into the corresponding electricity anomaly identification model to obtain the electricity identification result.
[0065] In this embodiment, for the user to be detected, an anomaly detection model is selected based on the electricity consumption category and industry type. The trained model is used to reconstruct the normal data in the training set, and the reconstruction error is calculated. The mean of the reconstruction error of the normal data ± 3 times the standard deviation is taken as the anomaly threshold, where the threshold is 3. A 1D matrix. If the reconstruction error of each dimension is less than the corresponding threshold, the sequence is considered a normal sample; if the reconstruction error of any dimension exceeds the corresponding threshold, the sequence is considered an abnormal sample. The daily peak, average, and valley electricity consumption of the user to be tested over the past d days constitute a time series S. The reconstruction error is calculated using model M, and samples with errors exceeding the threshold are marked as abnormal.
[0066] As can be seen from the above embodiments of this application, the power consumption anomaly detection method provided by this application uses the sliding window technique to slice historical power consumption data to obtain a historical power consumption matrix, and trains a neural network model based on the historical power consumption matrix to obtain a power consumption identification model for identifying whether a user's power consumption is abnormal, thereby achieving accurate identification of user power consumption, improving management efficiency and accuracy, and avoiding omissions that may occur in traditional manual verification.
[0067] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the method described.
[0068] It should be noted that the above description describes some embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0069] Based on the same inventive concept, corresponding to any of the above embodiments, this application also provides an abnormal power consumption detection device.
[0070] refer to Figure 2 An abnormal power consumption detection device includes: The data slicing module 100 is used to slice the preset historical electricity consumption data of users according to the sliding window technology to obtain the historical electricity consumption matrix.
[0071] The model training module 200 is used to input the historical electricity consumption matrix into a preset neural network model, train the neural network model, and obtain an electricity anomaly identification model.
[0072] The identification module 300 is used to input the power consumption data of the user to be detected into the power consumption identification model to obtain the power consumption identification result.
[0073] In some embodiments, the apparatus further includes: The data processing module is used to clean the pre-acquired historical user power consumption information to obtain cleaned power consumption data.
[0074] The power cleaning data is standardized to obtain standardized power data.
[0075] The standardized power data is determined by the following formula: .
[0076] in, for The maximum value in. for The minimum value in.
[0077] Peak electricity consumption, average electricity consumption, and valley electricity consumption were selected from the standardized electricity consumption data as the user's historical electricity consumption data.
[0078] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0079] The apparatus described above is used to implement the corresponding power anomaly detection method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0080] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the power abnormality detection method described in any of the above embodiments.
[0081] Figure 3 This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.
[0082] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0083] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0084] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0085] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0086] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0087] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0088] The electronic devices described above are used to implement the corresponding power anomaly detection methods in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0089] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the power anomaly detection method as described in any of the above embodiments.
[0090] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0091] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the power abnormality detection method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0092] It should be noted that the embodiments of this application can also be further described in the following ways: A method for detecting abnormal electricity consumption, comprising: The historical electricity consumption matrix is obtained by slicing the preset user historical electricity consumption data using the sliding window technique. The historical electricity consumption matrix is input into a preset neural network model, and the neural network model is trained to obtain an electricity anomaly identification model. The power consumption data of the user to be detected is input into the power consumption recognition model to obtain the power consumption recognition result.
[0093] Optionally, before slicing the preset historical user electricity consumption data according to the sliding window technique, the method further includes: The previously acquired historical user battery data is cleaned to obtain cleaned battery data. The power cleaning data is standardized to obtain power standardized data; The standardized electricity data is determined by the following formula: ; in, for The maximum value in; for The minimum value in; Peak electricity consumption, average electricity consumption, and valley electricity consumption are selected from the standardized electricity consumption data as the user's historical electricity consumption data.
[0094] Optionally, the step of cleaning the pre-acquired historical user power consumption information to obtain cleaned power consumption data specifically includes: The number of missing data points for a single day in the user's historical electricity consumption information is calculated to obtain the number of consecutively missing data points; In response to the fact that the number of consecutive missing data is less than a preset missing threshold, the current user's daily electricity consumption data is determined according to the horizontal mean substitution method; In response to the fact that the number of consecutive missing data is not less than the missing threshold, the current user's daily electricity consumption data is determined according to the longitudinal mean substitution method; The electricity cleaning data is obtained based on at least two of the aforementioned daily electricity consumption data.
[0095] Optionally, the missing threshold is 4; The power cleaning data is determined by the following formula: ; in, This represents the battery level of the current user at time i on day t; i represents the horizontal position of the missing data; t represents the time dimension to which the missing data belongs; m and n represent the positions of the non-missing values before and after the i-th missing data in the battery level sequence on day t; k is a constant; the value of mn represents the number of consecutive missing data.
[0096] Optionally, the step of inputting the historical electricity consumption matrix into a preset neural network model and training the neural network model to obtain an abnormal electricity consumption identification model specifically includes: The users corresponding to the historical electricity consumption matrix are grouped to obtain user grouping results; wherein, the user grouping results include at least 2 user groups; The historical electricity consumption matrices of the at least two user groups are labeled to obtain at least two training sets; The at least two training sets are respectively input into at least two neural network models, and the at least two neural network models are trained according to the mean squared error loss function to obtain the power anomaly identification model corresponding to the at least two user groups; wherein, the neural network model includes an LSTM autoencoder.
[0097] Optionally, the step of inputting the power consumption data of the user to be detected into the power consumption recognition model to obtain the power consumption recognition result specifically includes: The user group corresponding to the user to be detected is determined based on the electricity consumption data; The electricity consumption data is input into the corresponding electricity anomaly identification model to obtain the electricity identification result.
[0098] An abnormal power consumption detection device includes: The data slicing module is used to slice the preset historical electricity consumption data of users according to the sliding window technology to obtain the historical electricity consumption matrix; The model training module is used to input the historical electricity consumption matrix into a preset neural network model, train the neural network model, and obtain an electricity anomaly identification model. The identification module is used to input the power consumption data of the user to be detected into the power consumption identification model to obtain the power consumption identification result.
[0099] Optionally, the device further includes: The data processing module is used to clean the pre-acquired historical user power consumption information to obtain cleaned power consumption data. The power cleaning data is standardized to obtain power standardized data; The standardized electricity data is determined by the following formula: ; in, for The maximum value in; for The minimum value in; Peak electricity consumption, average electricity consumption, and valley electricity consumption are selected from the standardized electricity consumption data as the user's historical electricity consumption data.
[0100] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any of the preceding descriptions.
[0101] A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform any of the methods described above.
[0102] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application (including the claims) is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in the details for the sake of brevity.
[0103] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0104] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0105] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.
Claims
1. A method for detecting abnormal electricity consumption, comprising: The historical electricity consumption matrix is obtained by slicing the preset user historical electricity consumption data using the sliding window technique; The historical electricity consumption matrix is input into a preset neural network model, and the neural network model is trained to obtain an electricity anomaly identification model. The power consumption data of the user to be detected is input into the power consumption recognition model to obtain the power consumption recognition result.
2. The method for detecting abnormal electricity consumption according to claim 1, wherein, Before slicing the preset historical electricity consumption data of users according to the sliding window technique, the method further includes: The previously acquired historical user battery data is cleaned to obtain cleaned battery data. The power cleaning data is standardized to obtain power standardized data; The standardized electricity data is determined by the following formula: ; in, for The maximum value in; for The minimum value in; Peak electricity consumption, average electricity consumption, and valley electricity consumption are selected from the standardized electricity consumption data as the user's historical electricity consumption data.
3. The method for detecting abnormal electricity consumption according to claim 2, wherein, The process of cleaning the pre-acquired historical user battery information to obtain cleaned battery data specifically includes: The number of missing data points for a single day in the user's historical electricity consumption information is calculated to obtain the number of consecutively missing data points; In response to the fact that the number of consecutive missing data is less than a preset missing threshold, the current user's daily electricity consumption data is determined according to the horizontal mean substitution method; In response to the fact that the number of consecutive missing data is not less than the missing threshold, the current user's daily electricity consumption data is determined according to the longitudinal mean substitution method; The electricity cleaning data is obtained based on at least two of the aforementioned daily electricity consumption data.
4. The method for detecting abnormal electricity consumption according to claim 3, wherein, The missing threshold is 4; The power cleaning data is determined by the following formula: ; in, This represents the battery level of the current user at time i on day t; i represents the horizontal position of the missing data; t represents the time dimension to which the missing data belongs; m and n represent the positions of the non-missing values before and after the i-th missing data in the battery level sequence on day t; k is a constant; the value of mn represents the number of consecutive missing data.
5. The method for detecting abnormal electricity consumption according to claim 1, wherein, The step of inputting the historical electricity consumption matrix into a preset neural network model and training the neural network model to obtain an electricity consumption anomaly identification model specifically includes: The users corresponding to the historical electricity consumption matrix are grouped to obtain user grouping results; wherein, the user grouping results include at least 2 user groups; The historical electricity consumption matrices of the at least two user groups are labeled to obtain at least two training sets; The at least two training sets are respectively input into at least two neural network models, and the at least two neural network models are trained according to the mean squared error loss function to obtain the power anomaly identification model corresponding to the at least two user groups; wherein, the neural network model includes an LSTM autoencoder.
6. The method for detecting abnormal electricity consumption according to claim 5, wherein, The step of inputting the power consumption data of the user to be detected into the power consumption recognition model to obtain the power consumption recognition result specifically includes: The user group corresponding to the user to be detected is determined based on the electricity consumption data; The electricity consumption data is input into the corresponding electricity anomaly identification model to obtain the electricity identification result.
7. A power consumption anomaly detection device, comprising: The data slicing module is used to slice the preset historical electricity consumption data of users according to the sliding window technology to obtain the historical electricity consumption matrix; The model training module is used to input the historical electricity consumption matrix into a preset neural network model, train the neural network model, and obtain an electricity anomaly identification model. The identification module is used to input the power consumption data of the user to be detected into the power consumption identification model to obtain the power consumption identification result.
8. The apparatus according to claim 7, wherein, The device further includes: The data processing module is used to clean the pre-acquired historical user power consumption information to obtain cleaned power consumption data. The power cleaning data is standardized to obtain power standardized data; The standardized electricity data is determined by the following formula: ; in, for The maximum value in; for The minimum value in; Peak electricity consumption, average electricity consumption, and valley electricity consumption are selected from the standardized electricity consumption data as the user's historical electricity consumption data.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as claimed in any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 6.