Electricity stealing detection method and system
Using LSTM and deep residual convolutional neural network to extract power grid data features and construct a power theft detection model, it solves the problem of power theft detection in smart grids, achieves high-precision and low-cost power theft identification, and improves the efficiency of power grid operation. Security and fairness.
Patent Information
- Application Number
- CN202410589800.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2024-08-30
AI Technical Summary
In smart grids, power theft caused by users causes power loss and grid dispatch instability, and it is difficult for existing technologies to effectively detect and prevent new cyber attacks and power theft.
The LSTM network is used to extract the time series characteristics of the power grid data and the deep residual convolutional neural network is used to extract the periodic features, and a power theft detection network model is constructed to detect the power theft behavior of the target power grid through the model. It combines sample generation, feature extraction and model training to form a power theft detection network model. Electrical detection system.
It achieves high-precision detection of power theft, reduces computing costs, effectively prevents and identifies power theft, and improves the security and fairness of power grid operation.
Smart Images

Figure CN118568462A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electricity theft detection, and more particularly to an electricity theft detection method and system. Background Art
[0002] The development and application of smart grids have put forward higher requirements for reducing the power loss in the power grid system and reasonably balancing the distribution of power demand. The power loss in the power grid includes technical loss and non-technical loss.
[0003] Technical loss refers to the normal loss of electricity in the process of electricity production, transmission and distribution. Non-technical loss is mainly caused by users stealing electricity, which mainly includes three methods: physical attack, hardware attack and network attack. With the popularization of smart meters, it is difficult for users to steal electricity by privately modifying the meters. New methods of stealing electricity such as network attacks are gradually adopted.
[0004] Electricity theft by users will not only cause economic losses to the power grid company, but also undermine the fairness of electricity transactions among normal users, and will have an adverse impact on the power grid's electricity dispatching and distribution and the safety of power grid operations. Summary of the invention
[0005] In view of the above problems, the present invention proposes a method for detecting electricity theft, comprising:
[0006] Acquire a power theft detection data set of a power grid, and generate sample data according to the power theft detection data set;
[0007] Using an LSTM network to extract the one-dimensional time series features of the sample data, and using a deep residual convolutional neural network to extract the periodic features of the sample data;
[0008] Using the extracted one-dimensional time series features and periodic features of the sample data, training the electricity theft detection network to build an electricity theft detection network model;
[0009] The electricity theft detection network model is used to detect electricity theft in the target power grid.
[0010] Optionally, generating sample data according to the electricity theft detection data set includes:
[0011] The electricity theft detection data set is subjected to unbalance processing, and normal electricity usage data and abnormal electricity usage data in the electricity theft detection data set after the unbalance processing are compared to obtain periodic data features of the normal electricity usage data and the abnormal electricity usage data; the normal electricity usage data and the abnormal electricity usage data are divided according to the periodic data features to obtain sample data of the normal electricity usage data and the abnormal electricity usage data.
[0012] Optionally, the method further includes:
[0013] The obtained sample data is normalized.
[0014] Optionally, using the extracted one-dimensional time series features and periodic features of the sample data to train an electricity theft detection network and construct an electricity theft detection network model, including:
[0015] The electricity theft detection network is used to splice the extracted one-dimensional time series features and periodic features of the sample data to obtain an output feature tensor of the sample data, and the electricity theft detection network is trained with the output feature tensor to obtain an electricity theft detection network model.
[0016] Optional, electricity theft detection network model, as follows:
[0017]
[0018]
[0019]
[0020]
[0021]
[0022] Among them, N TP 、N TN 、N FP and N FN are the number of true positive, true negative, false positive and false negative samples in the prediction results, respectively, k is the number of the first k electricity stealing users correctly detected, r is the number of electricity stealing users in the first N tags, k i is the location of the i-th electricity stealer, P acc is the accuracy of electricity theft detection, P TPR is the true positive rate of electricity theft detection, P TPR is the false positive rate of electricity theft detection, P@k is the accuracy rate of correctly detecting the first k electricity theft users, MAP@N is the average precision of P@k in the first N tags, k i is the location of the i-th electricity stealer, P@k i To correctly detect the first k i MAP is the average precision, N is the number of tags, and P is the precision of electricity theft detection.
[0023] In another aspect, the present invention further provides a power theft detection system, comprising:
[0024] A sample generating unit, used to obtain a power theft detection data set of the power grid, and generate sample data according to the power theft detection data set;
[0025] A feature extraction unit, used to extract the one-dimensional time series features of the sample data using an LSTM network, and to extract the periodic features of the sample data using a deep residual convolutional neural network;
[0026] A model building unit, used to train the electricity theft detection network using the extracted one-dimensional time series features and periodic features of the sample data to build an electricity theft detection network model;
[0027] The detection unit is used to detect the electricity theft behavior of the target power grid using the electricity theft detection network model.
[0028] Optionally, the sample generating unit generates sample data according to the electricity theft detection data set, including:
[0029] The electricity theft detection data set is subjected to unbalance processing, and normal electricity usage data and abnormal electricity usage data in the electricity theft detection data set after the unbalance processing are compared to obtain periodic data features of the normal electricity usage data and the abnormal electricity usage data; the normal electricity usage data and the abnormal electricity usage data are divided according to the periodic data features to obtain sample data of the normal electricity usage data and the abnormal electricity usage data.
[0030] Optionally, the sample generation unit is further configured to:
[0031] The obtained sample data is normalized.
[0032] Optionally, the model building unit uses the extracted one-dimensional time series features and periodic features of the sample data to train the electricity theft detection network and build an electricity theft detection network model, including:
[0033] The electricity theft detection network is used to splice the extracted one-dimensional time series features and periodic features of the sample data to obtain an output feature tensor of the sample data, and the electricity theft detection network is trained with the output feature tensor to obtain an electricity theft detection network model.
[0034] Optional, electricity theft detection network model, as follows:
[0035]
[0036]
[0037]
[0038]
[0039]
[0040] Among them, N TP 、NTN 、N FP and N FN are the number of true positive, true negative, false positive and false negative samples in the prediction results, respectively, k is the number of the first k electricity stealing users correctly detected, r is the number of electricity stealing users in the first N tags, k i is the location of the i-th electricity stealer, P acc is the accuracy of electricity theft detection, P TPR is the true positive rate of electricity theft detection, P FPR is the false positive rate of electricity theft detection, P@k is the accuracy rate of correctly detecting the first k electricity theft users, MAP@N is the average precision of P@k in the first N tags, k i is the location of the i-th electricity stealer, P@k i To correctly detect the first k i MAP is the average precision, N is the number of tags, and P is the precision of electricity theft detection.
[0041] In yet another aspect, the present invention further provides a computing device, comprising: one or more processors;
[0042] a processor for executing one or more programs;
[0043] When the one or more programs are executed by the one or more processors, the above-described method is implemented.
[0044] In yet another aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed, the method described above is implemented.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] The present invention proposes a method for detecting electricity theft, including: obtaining an electricity theft detection data set of a power grid, generating sample data according to the electricity theft detection data set; using an LSTM network to extract the one-dimensional time series features of the sample data, and using a deep residual convolutional neural network to extract the periodic features of the sample data; using the extracted one-dimensional time series features and periodic features of the sample data to train an electricity theft detection network and construct an electricity theft detection network model; using the electricity theft detection network model to detect electricity theft behavior of the target power grid. The present invention uses the electricity theft detection network model as the basis for detection, has low computational cost and high accuracy, and can effectively detect electricity theft behavior of the power grid. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flow chart of the method of the present invention;
[0048] Figure 2 The flowchart of the deep learning electricity theft detection method based on SE-ResNet-LSTM of the method of the present invention;
[0049] Figure 3 This is a network parallel comparison verification diagram before and after the data imbalance processing of the method of the present invention;
[0050] Figure 4 A comparison chart of electricity theft detection results based on the SE-ResNet-LSTM deep learning model under different balance degrees of the method of the present invention;
[0051] Figure 5 It is a structural diagram of the system of the present invention. DETAILED DESCRIPTION
[0052] Now, exemplary embodiments of the present invention are described with reference to the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. These embodiments are provided to disclose the present invention in detail and completely and to fully convey the scope of the present invention to those skilled in the art. The terms used in the exemplary embodiments shown in the accompanying drawings are not intended to limit the present invention. In the accompanying drawings, the same units / elements are marked with the same reference numerals.
[0053] Unless otherwise specified, the terms (including technical terms) used herein have the commonly understood meanings to those skilled in the art. In addition, it is understood that the terms defined in commonly used dictionaries should be understood to have the same meanings as those in the context of the relevant fields, and should not be understood as idealized or overly formal meanings.
[0054] Embodiment 1:
[0055] The present invention proposes a method for detecting electricity theft, such as Figure 1 As shown, including:
[0056] Step 1: Obtain a power theft detection data set of the power grid, and generate sample data according to the power theft detection data set;
[0057] Step 2: Use an LSTM network to extract the one-dimensional time series features of the sample data, and use a deep residual convolutional neural network to extract the periodic features of the sample data;
[0058] Step 3: Using the extracted one-dimensional time series features and periodic features of the sample data, the electricity theft detection network is trained to construct an electricity theft detection network model;
[0059] Step 4: Use the electricity theft detection network model to detect electricity theft behavior in the target power grid.
[0060] Wherein, generating sample data according to the electricity theft detection data set includes:
[0061] The electricity theft detection data set is subjected to unbalance processing, and normal electricity usage data and abnormal electricity usage data in the electricity theft detection data set after the unbalance processing are compared to obtain periodic data features of the normal electricity usage data and the abnormal electricity usage data; the normal electricity usage data and the abnormal electricity usage data are divided according to the periodic data features to obtain sample data of the normal electricity usage data and the abnormal electricity usage data.
[0062] The method further includes:
[0063] The obtained sample data is normalized.
[0064] Optionally, using the extracted one-dimensional time series features and periodic features of the sample data to train an electricity theft detection network and construct an electricity theft detection network model, including:
[0065] The electricity theft detection network is used to splice the extracted one-dimensional time series features and periodic features of the sample data to obtain an output feature tensor of the sample data, and the electricity theft detection network is trained with the output feature tensor to obtain an electricity theft detection network model.
[0066] Among them, the electricity theft detection network model is as follows:
[0067]
[0068]
[0069]
[0070]
[0071]
[0072] Among them, N TP 、N TN 、N FP and N FN are the number of true positive, true negative, false positive and false negative samples in the prediction results, respectively, k is the number of the first k electricity stealing users correctly detected, r is the number of electricity stealing users in the first N tags, k i is the location of the i-th electricity stealer, P acc is the accuracy of electricity theft detection, P TPR is the true positive rate of electricity theft detection, P TPR is the false positive rate of electricity theft detection, P@k is the accuracy rate of correctly detecting the first k electricity theft users, MAP@N is the average precision of P@k in the first N tags, ki is the location of the i-th electricity stealer, P@k i To correctly detect the first k i MAP is the average precision, N is the number of tags, and P is the precision of electricity theft detection.
[0073] The present invention will be further described below in conjunction with specific embodiments:
[0074] Its implementation principle is as follows Figure 2 The specific implementation process is as follows:
[0075] (1) Data set imbalance processing:
[0076] The most significant problem in the electricity theft detection data set is that the number of electricity theft samples is far less than the normal electricity usage samples, resulting in a serious imbalance in the data set, which will cause the network training results to be biased towards the normal user class, resulting in deviations in the network classification results and misjudgment of electricity theft samples. Therefore, in order to solve the data imbalance problem, the present invention adopts the SMOTE method in the simple and easy-to-implement oversampling method, which generates new examples of electricity theft by interpolating between a few samples. The calculation process is as follows:
[0077] x new =x+randn(0,1)×(x′-x) (1)
[0078] In the formula, x is a randomly selected electricity theft user sample, and x′ is the neighboring sample of the electricity theft user sample.
[0079] (2) Comparative analysis of normal user data and abnormal power consumption data:
[0080] Traditional learning-based electricity theft detection methods only consider the user's electricity consumption time series data features as network input. Normal electricity users have stable electricity consumption fluctuations, while electricity theft users have large fluctuations in electricity consumption, and there is a cliff in electricity consumption decline. Therefore, the present invention considers the time series feature distinction and extracts the time series features through a long short-term memory network.
[0081] Unlike traditional learning-based electricity theft detection methods, the present invention considers data segmentation and comparison by period, extracting periodic data features. The weekly electricity consumption curves of normal electricity users have high similarity and fit, and obvious periodicity, while the weekly electricity consumption data of electricity theft users do not show strong connections, there are large differences in electricity consumption, and there is no periodic characteristic. Therefore, the present invention considers mining and extracting periodic features through a two-dimensional deep learning network.
[0082] The number of data cycles is determined by data comparison and analysis, and the present invention chooses to divide the data on a weekly basis to obtain two-dimensional data.
[0083] (3) Data preprocessing:
[0084] Normalizing sample data reduces the impact of data differences and facilitates rapid optimization of learning models:
[0085]
[0086] In the formula, x max 、x min are the maximum and minimum values of the data respectively.
[0087] (4) LSTM module feature extraction:
[0088] The present invention uses a long short-term memory network (LSTM) to extract one-dimensional time series features. LSTM is a type of recurrent neural network (RNN). As an improved RNN network, LSTM contains three complex gated logic structures, which use gated units to capture the periodic pattern of one-dimensional power data and explore the close dependencies between time series data. This network structure can effectively memorize important information at the current moment, while being able to selectively forget irrelevant information in the past, which helps to reduce the sensitivity of the system to abnormal changes in power data caused by abnormal factors such as weather, holiday gatherings, and business trips.
[0089] Forget Gate:
[0090] f t =Sigmoid(D l (h t-1 ,x t ,θ f )) (3)
[0091] Input Gate:
[0092] i t =Sigmoid(D l (h t-1 ,x t ,θ i ))
[0093]
[0094] Cell status update:
[0095]
[0096] Output Gate:
[0097] o t =Sigmoid(D l (h t-1 ,x t ,θ o ))
[0098] ht =o t tanh(C t ) (6)
[0099] In the formula, θ f ,θ i ,θ c and θ o are the convolution kernel training parameters respectively; D l It is a one-dimensional convolution operation.
[0100] (5) SE-ResNet module feature extraction:
[0101] The present invention uses a deep residual convolutional neural network to extract periodic features, converts time-series electricity consumption data into two-dimensional data with a width of one week, and mines the spatiotemporal periodic features and more potential features of the two-dimensional power data user electricity consumption data. The multi-level feature information of the feature map is extracted through a deep two-dimensional convolutional layer. In order to avoid the problem of gradient vanishing or gradient explosion that is prone to occur in deep convolutional networks, a residual mechanism is introduced to transfer feature information across layers, effectively improving the training speed and training accuracy of the network. In addition, the SE attention mechanism is introduced in the traditional residual module to mine the deep interactive information of the convolution, pay attention to the important feature channels of the network, focus on the channels that are beneficial to the current training, and give full play to the learning ability of the network.
[0102] The depth convolution operation process is as follows:
[0103] X i+1 =H χ (D2(X i ,θ i )) (7)
[0104] Where D2 is a two-dimensional convolution operation; input X i is the feature vector graph of the i-th convolution input; θ i is the i-th convolution kernel training parameter; H χ After the convolution operation, the Relu function activation and BN layer normalization operations are performed.
[0105] After the deep convolution operation, the features are subjected to SE operation. First, a global average pooling operation is performed on the input features to achieve data compression:
[0106]
[0107] In the formula, X GAP is the output after global average pooling; Output tensor for the channel attention mechanism.
[0108] Secondly, the compressed data features are input into the bottleneck layer consisting of two fully connected layers to achieve data excitation and further obtain the correlation between the tensor features of different channels:
[0109] X ex =σ2(g(σ1(g(X GAP ,θ GAP,1 )),θ GAP,2 )) (9)
[0110] Where, X ex is the single-channel attention weight after the excitation operation; σ1 and σ2 represent the Sigmoid activation function and the Relu activation function respectively; θ GAP,1 ,θ GAP,2 are the training parameter matrices respectively.
[0111] Finally, the input features are weighted to complete the scaling operation.
[0112]
[0113] In the formula, Output tensor for SE mechanism.
[0114] The present invention introduces a residual mechanism after the SE mechanism, and gives full play to the powerful learning ability of the deep learning network by learning a simple residual function. The residual function calculation process is as follows:
[0115]
[0116] Where R(X) is the output of the input feature map after the deep convolution channel attention mechanism; H(X) is the residual mechanism output tensor; It is the operation performed on the input feature map on the jump connection layer. When the input and output dimensions do not match, Perform a one-dimensional convolution operation on the input feature map, that is When the input and output dimensions match, No operation is performed on the input feature map, that is,
[0117] (6) Parallel network fusion:
[0118] The electricity theft detection network concatenates the parallel network outputs through the Concatenate layer to obtain a comprehensive output feature tensor:
[0119] Y = Concatenate[X LSTM ,X SE-RN ] (12)
[0120] The Dense layer is used to mine the comprehensive output features, and finally the electricity theft detection prediction results are obtained:
[0121] y=f(Y,θ den,1 ) (13)
[0122] Where, f is the Dense operation; θ den,1 is the training parameter.
[0123] The network is classified into two categories through Dense operation (0 is a normal user, 1 is a power theft user)
[0124]
[0125] In the formula, θ den,2 is the training parameter.
[0126] (7) Electricity theft detection model:
[0127]
[0128]
[0129]
[0130]
[0131]
[0132] Where N TP 、N TN 、N FP and N FN are the number of true positive, true negative, false positive and false negative samples in the prediction results respectively; Y k is the number of the first k electricity stealing users correctly detected; r is the number of electricity stealing users in the first N tags; is the position of the i-th electricity stealing user.
[0133] The above process can be implemented according to the following specific steps:
[0134] The specific implementation steps are as follows:
[0135] Step 1: Data imbalance processing. According to formula (1), the SMOTE oversampling operation is used to expand the real electricity theft behavior data samples, and the ratio of electricity theft data to normal data is expanded to 1:2 to form detection sample data;
[0136] Step 2: Comparative analysis of data between normal and abnormal electricity users. Determine the input model feature data form and the two-dimensional data construction period based on the comparison of electricity time series data curves and periodic electricity data curves divided into different periods;
[0137] Step 3: Data preprocessing: Normalize the sample data according to formula (2);
[0138] Step 4: Construct the time series feature extraction network. According to equations (3) to (6), construct the LSTM network as the time series feature extraction network;
[0139] Step 5: Construct a periodic feature extraction network. According to the convolution operation, the two-dimensional data features are deeply mined. The convolution operation is as shown in formula (7). According to formulas (8) to (10), the SE operation is performed on the deep convolution output to obtain the output features of different channel attention. According to formula (11), the residual operation is performed to establish a leapfrog link between the input data and the output data. Among them, the jump connection layer determines whether to perform a one-dimensional convolution operation based on whether the input feature map matches the output dimension.
[0140] Step 6: Parallel network fusion. According to formula (12), the LSTM output features are fused with the SE-ResNet output features. The number of features is reduced by formula (13), and the features are further mined. According to formula (14), binary classification is performed to determine whether electricity theft occurs.
[0141] Step 7 Network training and verification. The network model input is the electricity consumption data of each user. The sample data is divided into training set and test set according to 7:3. The network model uses Adam optimizer, the loss function uses cross entropy function, batch_size is set to 64, epochs is 30, and the loop iteration is 10 rounds. The area under the curve (AUC), accuracy, and average precision (MAP) are used as evaluation indicators of the network model operation results, as shown in formulas (15) to (19).
[0142] The present invention has the advantages of low network computing cost, low false positive rate, high detection accuracy, etc. The comparison processing results are as follows: Figure 3 and 4 As shown, from Figure 3 and Figure 4 It can be seen that the present invention effectively solves the problems of data set imbalance, difficulty in network training and input dimension limitation existing in traditional learning methods, and has better engineering application effect.
[0143] Embodiment 2:
[0144] The present invention also proposes a power theft detection system 200, such as Figure 5 As shown, including:
[0145] The sample generating unit 201 is used to obtain a power theft detection data set of the power grid, and generate sample data according to the power theft detection data set;
[0146] A feature extraction unit 202 is used to extract the one-dimensional time series features of the sample data using an LSTM network, and to extract the periodic features of the sample data using a deep residual convolutional neural network;
[0147] A model building unit 203 is used to train the electricity theft detection network using the extracted one-dimensional time series features and periodic features of the sample data to build an electricity theft detection network model;
[0148] The detection unit 204 is used to detect the electricity theft behavior of the target power grid using the electricity theft detection network model.
[0149] The sample generation unit 201 generates sample data according to the electricity theft detection data set, including:
[0150] The electricity theft detection data set is subjected to unbalance processing, and normal electricity usage data and abnormal electricity usage data in the electricity theft detection data set after the unbalance processing are compared to obtain periodic data features of the normal electricity usage data and the abnormal electricity usage data; the normal electricity usage data and the abnormal electricity usage data are divided according to the periodic data features to obtain sample data of the normal electricity usage data and the abnormal electricity usage data.
[0151] The sample generation unit 201 is further used for:
[0152] The obtained sample data is normalized.
[0153] The model building unit 203 uses the extracted one-dimensional time series features and periodic features of the sample data to train the electricity theft detection network and build an electricity theft detection network model, including:
[0154] The electricity theft detection network is used to splice the extracted one-dimensional time series features and periodic features of the sample data to obtain an output feature tensor of the sample data, and the electricity theft detection network is trained with the output feature tensor to obtain an electricity theft detection network model.
[0155] Among them, the electricity theft detection network model is as follows:
[0156]
[0157]
[0158]
[0159]
[0160]
[0161] Among them, N TP 、NTN 、N FP and N FN are the number of true positive, true negative, false positive and false negative samples in the prediction results, respectively, k is the number of the first k electricity stealing users correctly detected, r is the number of electricity stealing users in the first N tags, k i is the location of the i-th electricity stealer, P acc is the accuracy of electricity theft detection, P TPR is the true positive rate of electricity theft detection, P FPR is the false positive rate of electricity theft detection, P@k is the accuracy rate of correctly detecting the first k electricity theft users, MAP@N is the average precision of P@k in the first N tags, k i is the location of the i-th electricity stealer, P@k i To correctly detect the first k i MAP is the average precision, N is the number of tags, and P is the precision of electricity theft detection.
[0162] The present invention uses an electricity theft detection network model as a basis for detection, has low calculation cost and high accuracy, and can effectively detect electricity theft behavior in the power grid.
[0163] Embodiment 3:
[0164] Based on the same inventive concept, the present invention also provides a computer device, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding functions, so as to implement the steps of the method in the above embodiment.
[0165] Embodiment 4:
[0166] Based on the same inventive concept, the present invention also provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both a built-in storage medium in a computer device and an extended storage medium supported by the computer device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the steps of the method in the above embodiment.
[0167] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present invention may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0168] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0169] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0170] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0171] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0172] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for detecting electricity theft, characterized in that: include: Acquire a power theft detection data set of a power grid, and generate sample data according to the power theft detection data set; Using an LSTM network to extract the one-dimensional time series features of the sample data, and using a deep residual convolutional neural network to extract the periodic features of the sample data; Using the extracted one-dimensional time series features and periodic features of the sample data, training the electricity theft detection network to build an electricity theft detection network model; The electricity theft detection network model is used to detect electricity theft in the target power grid.
2. The method according to claim 1, characterized in that The step of generating sample data according to the electricity theft detection data set includes: The electricity theft detection data set is subjected to unbalance processing, and normal electricity usage data and abnormal electricity usage data in the electricity theft detection data set after the unbalance processing are compared to obtain periodic data features of the normal electricity usage data and the abnormal electricity usage data; the normal electricity usage data and the abnormal electricity usage data are divided according to the periodic data features to obtain sample data of the normal electricity usage data and the abnormal electricity usage data.
3. The method according to claim 2, characterized in that The method further comprises: The obtained sample data is normalized.
4. The method according to claim 1, characterized in that: The method uses the extracted one-dimensional time series features and periodic features of the sample data to train the electricity theft detection network and construct an electricity theft detection network model, including: The electricity theft detection network is used to splice the extracted one-dimensional time series features and periodic features of the sample data to obtain an output feature tensor of the sample data, and the electricity theft detection network is trained with the output feature tensor to obtain an electricity theft detection network model.
5. The method according to claim 1, characterized in that The electricity theft detection network model is as follows: Among them, N TP 、N TN 、N FP and N FN are the number of true positive, true negative, false positive and false negative samples in the prediction results, respectively, k is the number of the first k electricity stealing users correctly detected, r is the number of electricity stealing users in the first N tags, k i is the location of the i-th electricity stealer, P acc is the accuracy of electricity theft detection, P TPR is the true positive rate of electricity theft detection, P FPR is the false positive rate of electricity theft detection, P@k is the accuracy rate of correctly detecting the first k electricity theft users, MAP@N is the average precision of P@k in the first N tags, k i is the location of the i-th electricity stealer, P@k i To correctly detect the first k i MAP is the average precision, N is the number of tags, and P is the precision of electricity theft detection.
6. A power theft detection system, characterized in that: include: A sample generating unit, used to obtain a power theft detection data set of the power grid, and generate sample data according to the power theft detection data set; A feature extraction unit, used to extract the one-dimensional time series features of the sample data using an LSTM network, and to extract the periodic features of the sample data using a deep residual convolutional neural network; A model building unit, used to train the electricity theft detection network using the extracted one-dimensional time series features and periodic features of the sample data to build an electricity theft detection network model; The detection unit is used to detect the electricity theft behavior of the target power grid using the electricity theft detection network model.
7. The system according to claim 6, characterized in that The sample generating unit generates sample data according to the electricity theft detection data set, including: The electricity theft detection data set is subjected to unbalance processing, and normal electricity usage data and abnormal electricity usage data in the electricity theft detection data set after the unbalance processing are compared to obtain periodic data features of the normal electricity usage data and the abnormal electricity usage data; the normal electricity usage data and the abnormal electricity usage data are divided according to the periodic data features to obtain sample data of the normal electricity usage data and the abnormal electricity usage data.
8. The system according to claim 7, characterized in that The sample generation unit is also used for: The obtained sample data is normalized.
9. The system according to claim 6, characterized in that The model building unit uses the extracted one-dimensional time series features and periodic features of the sample data to train the electricity theft detection network and build an electricity theft detection network model, including: The electricity theft detection network is used to splice the extracted one-dimensional time series features and periodic features of the sample data to obtain an output feature tensor of the sample data, and the electricity theft detection network is trained with the output feature tensor to obtain an electricity theft detection network model.
10. The system according to claim 6, characterized in that The electricity theft detection network model is as follows: Among them, N TP 、N TN 、N FP and N FN are the number of true positive, true negative, false positive and false negative samples in the prediction results, respectively, k is the number of the first k electricity stealing users correctly detected, r is the number of electricity stealing users in the first N tags, k i is the location of the i-th electricity stealer, P acc is the accuracy of electricity theft detection, P TPR is the true positive rate of electricity theft detection, P FPR is the false positive rate of electricity theft detection, P@k is the accuracy rate of correctly detecting the first k electricity theft users, MAP@N is the average precision of P@k in the first N tags, k i is the location of the i-th electricity stealer, P@k i To correctly detect the first k i MAP is the average precision, N is the number of tags, and P is the precision of electricity theft detection.
11. A computer device, characterized in that: include: one or more processors; a processor for executing one or more programs; When the one or more programs are executed by the one or more processors, the method according to any one of claims 1 to 5 is implemented.
12. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Electricity stealing detection method and system based on ResNet-LSTM
CN112098714A
Electricity stealing user identification method and device, storage medium and terminal
CN117034132A
