Electricity theft behavior detection method, apparatus, and device, and storage medium
By building a power stolen behavior detection model based on OS_CNN and AutoXGB, the problem of the inability to quickly and accurately detect power stolen behavior in the existing technology is solved, and fast and accurate power stolen behavior detection and timely alarms are achieved, reducing power grid and economic losses.
Patent Information
- Application Number
- PCT/CN2024/137270
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-17
- Filing Date
- 2024-12-06
- Publication Date
- 2025-07-24
AI Technical Summary
The prior art cannot quickly and accurately detect whether there is power theft behavior in the power terminal, resulting in problems of grid stability and economic losses.
The power stolen behavior detection model is constructed by using OS_CNN technology and AutoXGB technology. By obtaining the historical power consumption data of the power consumption terminal, data preprocessing and labeling are performed, and feature extraction networks and classification networks are used for training and testing to realize the detection of power stolen behavior.
It realizes rapid and accurate detection of power stolen behavior at power terminals, reduces the technical drawbacks of traditional manual detection methods, and promptly alerts to reduce the losses caused by power stolen behavior.
Smart Images

Figure CN2024137270_24072025_PF_FP_ABST
Abstract
Description
Electricity theft detection method, device, equipment and storage medium
[0001] This application claims priority to a Chinese patent application filed with the Patent Office of China on January 17, 2024, with application number 202410072789.5 and invention name “Method, device, equipment and storage medium for detecting electricity theft”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application belongs to the field of data detection technology, and in particular relates to a method, device, equipment and storage medium for detecting electricity theft. Background Art
[0003] Electricity is ubiquitous in our daily lives, consumed worldwide at all times. However, electricity is subject to certain losses during transmission and conversion. Generally speaking, these losses can be categorized as technical and non-technical. Technical losses are unavoidable, primarily due to the Joule effect on power lines and transformer losses during transmission. Due to their inherent nature, calculating technical losses is complex and cannot be completely eliminated; existing technologies can be used to reduce them. Non-technical losses are primarily caused by billing delays and irregularities, energy theft, meter failures, fraud, and unpaid bills.
[0004] In recent years, a small number of users have tampered with meter data to reduce electricity usage, and theft of electricity has become one of the main causes of non-technical losses. At the same time, electricity theft can also undermine the stability of the power grid. For example, the grid may be unable to accurately calculate the regional electricity load and unable to properly upgrade and match the corresponding power supply facilities. When peak electricity consumption occurs, the grid may be overloaded and cause regional power grid failure, resulting in direct or indirect economic losses. Traditional manual detection methods for electricity theft not only consume a lot of manpower and material resources, but also have unsatisfactory detection accuracy and efficiency. Based on this, how to quickly and accurately detect whether electricity theft occurs at the power terminal is a key research direction in the industry.
[0005] The above content is only used to assist in understanding the technical solution of this application and does not constitute an admission that the above content is prior art. Summary of the Invention
[0006] The main purpose of this application is to provide a method, device, equipment and storage medium for detecting electricity theft, aiming to solve the technical problem that the existing technology cannot quickly and accurately detect whether there is electricity theft in the electricity terminal.
[0007] To achieve the above-mentioned objectives, the present application provides a method for detecting electricity theft, which includes the following steps: obtaining historical electricity usage data of an electricity terminal within a first detection period, and assigning data labels to the historical electricity usage data, wherein the data labels include normal users and electricity theft users; performing data preprocessing on missing data in the historical electricity usage data to obtain preprocessed data; training and testing a preset model based on the preprocessed data and the historical electricity usage data with the data labels to obtain an electricity theft detection model, wherein the preset model is constructed based on OS_CNN (Omni-Scale Convolutional Neural Network) technology and AutoXGB technology; and detecting whether the electricity terminal has electricity theft using the electricity theft detection model.
[0008] In an exemplary embodiment, the step of performing data preprocessing on the missing data in the historical electricity consumption data to obtain preprocessed data includes: performing piecewise cubic Hermite interpolation on the historical electricity consumption data to obtain a difference function; performing data filling on the missing data in the historical electricity consumption data based on the difference function to obtain filled historical electricity consumption data; and performing standardization on the filled historical electricity consumption data to obtain preprocessed data.
[0009] In an exemplary embodiment, the step of training and testing a preset model based on the preprocessed data and the historical electricity usage data with the data labels to obtain a power theft detection model includes: dividing a data set consisting of the preprocessed data and the historical electricity usage data with the data labels into an original training sample set and a test data set according to a preset ratio; performing sample enhancement on the original training sample set using a synthetic minority class oversampling technique and an edited nearest neighbor node algorithm to obtain a training data set; and training and testing the preset model based on the training data set and the test data set to obtain a power theft detection model.
[0010] In an exemplary embodiment, the step of training and testing a preset model based on the training data set and the test data set to obtain a power theft detection model includes: extracting features from the training data set through a feature extraction network to obtain training data features; inputting the training data features into a classification network to perform classification task prediction to obtain a prediction probability corresponding to each data item in the training data set; and training and testing the preset model based on the prediction probability corresponding to each data item in the training data set and the test data set to obtain a power theft detection model.
[0011] In an exemplary embodiment, the step of extracting features from the training data set through a feature extraction network to obtain training data features includes: stacking a preset number of full-scale convolutional neural networks to obtain a feature extraction network; and extracting features from the training data set through the feature extraction network to obtain training data features.
[0012] In an exemplary embodiment, the step of inputting the training data features into a classification network to perform classification task prediction and obtaining a predicted probability corresponding to each data in the training data set includes: constructing a classification network based on an extreme gradient boosting algorithm with automatic hyperparameter optimization, inputting the training data features into the classification network to perform classification task prediction, and obtaining a predicted probability corresponding to each data in the training data set, wherein the predicted probability includes a normal user probability and a power theft user probability.
[0013] In an exemplary embodiment, the step of detecting whether the electricity terminal has committed electricity theft through the electricity theft detection model includes: inputting the electricity usage data of the electricity terminal in the second detection cycle into the electricity theft detection model to obtain a model output result; judging whether the electricity terminal has committed electricity theft based on the model output result, and issuing an alarm when the electricity terminal has committed electricity theft.
[0014] In addition, to achieve the above-mentioned purpose, the present application also proposes an electricity theft detection device, which includes: a label marking module, a data processing module, a model building module and an electricity theft detection module.
[0015] A label marking module is used to obtain historical electricity usage data of the electricity terminal in the first detection cycle and assign data labels to the historical electricity usage data, wherein the data labels include normal users and electricity theft users; a data processing module is used to preprocess the missing data in the historical electricity usage data to obtain preprocessed data; a model construction module is used to train and test a preset model based on the preprocessed data and the historical electricity usage data with the data labels to obtain an electricity theft behavior detection model, wherein the preset model is constructed based on OS_CNN technology and AutoXGB technology; and an electricity theft detection module is used to detect whether the electricity terminal has electricity theft behavior through the electricity theft behavior detection model.
[0016] In addition, to achieve the above-mentioned purpose, the present application also proposes an electricity theft detection device, which includes: a memory, a processor, and an electricity theft detection program stored in the memory and executable on the processor, wherein the electricity theft detection program is configured to implement the steps of the electricity theft detection method described above.
[0017] In addition, to achieve the above objectives, the present application also proposes a non-transitory storage medium, on which a power theft detection program is stored. When the power theft detection program is executed by a processor, the steps of the power theft detection method described above are implemented.
[0018] The beneficial effects of the present application are as follows: the present application obtains the historical electricity consumption data of the electricity terminal in the first detection cycle, and assigns data labels to the historical electricity consumption data, wherein the data labels include normal users and electricity theft users; performs data preprocessing on the missing data in the historical electricity consumption data to obtain preprocessed data; trains and tests a preset model based on the preprocessed data and the historical electricity consumption data with the data labels to obtain an electricity theft behavior detection model, wherein the preset model is constructed based on the OS_CNN technology and the AutoXGB technology; and detects whether the electricity terminal has committed electricity theft through the electricity theft behavior detection model. Compared with the traditional electricity theft behavior detection method, since the above-mentioned method of the present application obtains the electricity theft behavior detection model by training and testing the preset model obtained after being constructed based on the OS_CNN technology and the AutoXGB technology, the electricity theft behavior detection model can be used to quickly and accurately detect whether the electricity terminal has committed electricity theft, thereby avoiding the technical disadvantages brought about by the traditional manual detection method.
[0019] Figures in the specification
[0020] FIG1 is a schematic diagram of the structure of an electricity theft detection device in a hardware operating environment according to an embodiment of the present application;
[0021] FIG2 is a flow chart of a first embodiment of a method for detecting electricity theft according to the present invention;
[0022] FIG3 is a flow chart of a second embodiment of a method for detecting electricity theft according to the present invention;
[0023] FIG4 is a flow chart of a third embodiment of a method for detecting electricity theft according to the present application;
[0024] FIG5 is a schematic diagram of a feature extraction network process in the electricity theft detection method of the present application;
[0025] FIG6 is a schematic diagram of an electricity theft detection model in the electricity theft detection method of the present application;
[0026] FIG7 is a schematic diagram of a classification network structure in the electricity theft detection method of the present application;
[0027] FIG8 is a heat diagram of a confusion matrix of the electricity theft detection model in the electricity theft detection method of the present application on a test set;
[0028] FIG9 is a structural block diagram of the first embodiment of the electricity theft detection device of the present application. DETAILED DESCRIPTION
[0029] The present application will be further described below with reference to the following examples. The following examples are provided only to facilitate understanding of the present application. It should be noted that, without departing from the principles of the present application, a number of modifications may be made to the present application by a person skilled in the art, and such improvements and modifications are intended to fall within the scope of the claims of the present application.
[0030] 1 , which is a schematic diagram of the structure of an electricity theft detection device in a hardware operating environment according to an embodiment of the present application.
[0031] As shown in Figure 1, the electricity theft detection device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display and an input unit such as a keyboard. Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a wireless fidelity (Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk storage device. The memory 1005 may also be a storage device independent of the processor 1001.
[0032] Those skilled in the art will appreciate that the structure shown in FIG1 does not limit the electricity theft detection device, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0033] As shown in FIG1 , the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and an electricity theft detection program.
[0034] In the electricity theft detection device shown in Figure 1, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the electricity theft detection device of the present application can be set in the electricity theft detection device. The electricity theft detection device calls the electricity theft detection program stored in the memory 1005 through the processor 1001 and executes the electricity theft detection method provided in the embodiment of the present application.
[0035] An embodiment of the present application provides a method for detecting electricity theft. Referring to FIG. 2 , FIG. 2 is a flow chart of a first embodiment of the method for detecting electricity theft.
[0036] In this embodiment, the electricity theft detection method includes the following steps:
[0037] Step S1: acquiring historical electricity usage data of an electricity terminal in a first detection cycle, and assigning data tags to the historical electricity usage data, wherein the data tags include normal users and electricity theft users.
[0038] It should be noted that the execution entity of the method of this embodiment can be a terminal device with model building, data processing, and program execution functions, such as a smartphone, computer, etc., or an electronic device with the same or similar functions, such as the above-mentioned electricity theft detection device. The following uses the electricity theft detection device (hereinafter referred to as the detection device) as an example to illustrate this embodiment and the following embodiments.
[0039] It is understandable that the above-mentioned power-consuming terminals may refer to a collection of all terminals used by power users that require electricity to operate, such as household appliances, mobile devices, industrial equipment, medical equipment, etc., and this embodiment does not limit this.
[0040] It should be understood that the above-mentioned first detection period can be set by the administrator, such as 24 hours, one week, one month, etc.; the above-mentioned historical electricity consumption data may include electricity data (such as total electricity, peak electricity, valley electricity and normal electricity, etc.), electricity consumption time (such as daily electricity consumption time, monthly electricity consumption time, etc.), load data (such as maximum load, average load and minimum load, etc.), voltage data (such as real-time value, maximum value, minimum value and average value of voltage, etc.), current data (such as real-time value, maximum value, minimum value and average value of current, etc.), power factor data (such as real-time value, maximum value, minimum value and average value of power factor, etc.), abnormal data (such as power outage, tripping, fault, etc.) or other data that can reflect the electricity consumption of the electricity terminal, and this embodiment does not limit this.
[0041] Step S2: performing data preprocessing on the missing data in the historical electricity consumption data to obtain preprocessed data.
[0042] It should be noted that the missing data in the above historical electricity consumption data may be null value data in the historical electricity consumption data.
[0043] It should be understood that the missing data in the above-mentioned historical electricity consumption data can be preprocessed based on the following methods to obtain the above-mentioned preprocessed data. Interpolation method: Use statistical methods, such as mean, median or mode, to estimate missing values. Forward filling method or backward filling method: Use the previous non-missing value (forward filling) or the next non-missing value (backward filling) to fill the missing value. Model prediction method: Use other features to predict missing values, and machine learning models such as regression, classification or clustering can be used. Root mean square error interpolation method: Use the weighted average of the k neighbors closest to the missing value to estimate the missing value. Multiple interpolation method: Use multiple rounds of model training to iteratively estimate missing values until convergence. Deep learning method: For complex data relationships, deep learning methods such as autoencoders can be used to learn the representation of the data and fill in missing values.
[0044] Step S3: training and testing a preset model based on the preprocessed data and the historical electricity usage data with the data labels to obtain an electricity theft detection model, wherein the preset model is constructed based on OS_CNN technology and AutoXGB technology.
[0045] It should be noted that the above-mentioned OS_CNN technology is a technology based on stacking multiple layers of full-size convolutional neural networks, and the above-mentioned AutoXGB technology is a technology based on the XGBoost (eXtreme Gradient Boosting) algorithm for performing tasks such as feature engineering, hyperparameter optimization and model selection.
[0046] In a specific implementation, the above preset model can be established based on Python's deep learning framework - Pytorch framework.
[0047] Step S4: detecting whether the electricity-using terminal has committed electricity theft through the electricity theft detection model.
[0048] In a specific implementation, the data to be detected in the above-mentioned power-consuming terminal can be input into the above-mentioned power-stealing behavior detection model, so as to determine whether the above-mentioned power-consuming terminal has committed power-stealing behavior based on the model data result.
[0049] This embodiment obtains historical electricity usage data of an electricity terminal during a first detection cycle and assigns data labels to the historical electricity usage data, wherein the data labels include normal users and electricity theft users; preprocesses missing data in the historical electricity usage data to obtain preprocessed data; trains and tests a preset model based on the preprocessed data and the historical electricity usage data with the data labels to obtain an electricity theft detection model, wherein the preset model is constructed based on OS_CNN technology and AutoXGB technology; and detects whether the electricity terminal has engaged in electricity theft using the electricity theft detection model. Compared to traditional electricity theft detection methods, the method of this embodiment trains and tests a preset model constructed based on OS_CNN technology and AutoXGB technology to obtain an electricity theft detection model. Therefore, the electricity theft detection model can quickly and accurately detect whether the electricity terminal has engaged in electricity theft, thereby avoiding the technical drawbacks of traditional manual detection methods.
[0050] Refer to FIG3 , which is a flow chart of a second embodiment of a method for detecting electricity theft in the present application.
[0051] Based on the first embodiment above, in this embodiment, in order to improve the data integrity of the historical electricity usage data, step S2 may include:
[0052] Step S21: performing piecewise cubic Hermitian interpolation on the historical electricity consumption data to obtain a difference function.
[0053] In the specific implementation, let the function f(x) be at node a=x0 <x1<…<x k-1 <… <x n = Functions y0, y1, ..., y on b k-1 ,y k ,…,y n The kth subinterval [x k-1 ,x k ]The corresponding function interval is [y k-1 ,y k ]. Thus, the cubic Hermite interpolation function P on the interval k (x) can be defined as:
[0054] Among them, d k-1 ,d k Represent the interpolation function P k (x) in the subinterval [x k-1 ,x k ]The first derivative of the left and right endpoints. a k,1 ,a k,2 ,a k,3 are the coefficients of the interpolation polynomial for each segment.
[0055] If the function values at the endpoints of an interval are known, determining the derivatives of the interpolation function at each node is the key to constructing an interval monotone cubic Hermite interpolation function. For each intermediate node k = 1, 2, ..., n-1, the corresponding derivative is approximated by weighting the first-order difference quotient of the two adjacent intervals to the left and right:
[0056] Among them, δ k Represents a node (x k-1 ,y k-1 ) and (x k ,y k ) is the average rate of change between two adjacent nodes, which is used to measure the changing trend of the function in this interval. k+1 Represents a node (x k+1 ,y k+1 ) and (x k ,y k ). w1 represents the slope of the previous section δ k The weight of δ k The greater the contribution to the final derivative. w2 represents the slope of the latter section δ k+1 The weight of δ k+1 The greater the contribution to the final derivative. The boundary point (the starting point node k = 0 of the line segment) is only supported by data on one side, and the derivative d0 directly takes the slope δ1 of the adjacent node k = 1, which means that the derivative of the boundary point is directly determined by the slope of the adjacent interval of the endpoint. The derivative d of the boundary point k = n n Directly take the slope δ of node k=n n .
[0057] Step S22: filling in missing data in the historical electricity usage data based on the difference function to obtain filled historical electricity usage data.
[0058] Step S23: performing standardization processing on the filled historical electricity consumption data to obtain pre-processed data.
[0059] In a specific implementation, the above-mentioned filled historical electricity consumption data can be normalized based on the following formula:
[0060] Where x represents the vector of daily electricity consumption data, x i represents the data value of x on the i-th day, μ represents the mean of sample x, and σ represents the standard deviation of sample x.
[0061] In an exemplary embodiment, in order to promptly alert the electricity theft behavior of the electricity terminal and thus minimize the losses caused by the electricity theft behavior, step S4 may include:
[0062] Step S41: inputting the electricity consumption data of the electricity terminal in the second detection cycle into the electricity theft behavior detection model to obtain a model output result.
[0063] It should be noted that the second detection period can be set by the administrator, for example, 24 hours, one week, one month, etc.
[0064] Step S42: determining whether the electricity-using terminal has committed electricity theft based on the output result of the model, and issuing an alarm when the electricity-using terminal has committed electricity theft.
[0065] In a specific implementation, the alarm may be issued by sending an email to the administrator, or by broadcasting the alarm to the administrator through a loudspeaker device, which is not limited in this embodiment.
[0066] This embodiment performs piecewise cubic Hermitian interpolation on the historical electricity usage data to obtain a difference function; based on the difference function, data is filled in for missing data in the historical electricity usage data to obtain filled historical electricity usage data; the filled historical electricity usage data is normalized to obtain preprocessed data; the electricity usage data of the electricity terminal during the second detection cycle is input into the electricity theft detection model to obtain a model output result; based on the model output result, it is determined whether the electricity terminal has engaged in electricity theft, and an alarm is issued if the electricity terminal has engaged in electricity theft. Compared to traditional electricity theft detection methods, the method of this embodiment preprocesses missing data in the historical electricity usage data by performing piecewise cubic Hermitian interpolation and normalization on the historical electricity usage data, thereby improving the data integrity of the historical electricity usage data; and by promptly issuing an alarm for electricity theft at the electricity terminal, the losses caused by the electricity theft that has already occurred are reduced.
[0067] Refer to FIG4 , which is a flow chart of a third embodiment of a method for detecting electricity theft in the present application.
[0068] Based on the above embodiments, in this embodiment, step S3 may include:
[0069] Step S31: dividing the data set consisting of the pre-processed data and the historical electricity consumption data with the data labels into an original training sample set and a test data set according to a preset ratio.
[0070] Step S32: performing sample enhancement on the original training sample set by using the synthetic minority class oversampling technique and the edited nearest neighbor node algorithm to obtain a training data set.
[0071] Step S33: training and testing a preset model based on the training data set and the test data set to obtain an electricity theft detection model.
[0072] In the specific implementation, the above original training sample set can be sample enhanced based on the following steps. Input: The training dataset (X_train) consists of the majority class data samples (X_train maj ) and minority class data samples (X_train min ), the number of minority class samples (X_train min ), sampling rate (N)%, number of neighboring nodes (K), newly generated minority class samples (x s ). Output: If N<100, randomly select min Select T*N% samples from X_train and find the K nearest neighbor nodes Xinn,nn∈{1,2,…,K} of X_trainmin in X_train. s <(N / 100)*T, then arbitrarily select a sample X from Xinn iab , calculate the remaining current traversal samples X icd The vector difference of , multiply this difference (vector difference) with a random number between 0 and 1, and add the current traversal sample to get the new minority class abnormal data class sample x s =x icd +(x iab -x icd )*rand(0,1). Based on the KNN algorithm, predict and classify the newly generated data sample. If most of the types of its K nearest neighbor samples are the same, the data is saved; otherwise, it is deleted. Finally, the new sample is added to the original data and the enhanced data sample is returned.
[0073] In an exemplary embodiment, in this embodiment, step S33 may include:
[0074] Step S331: extracting features from the training data set through a feature extraction network to obtain training data features.
[0075] Step S332: Input the training data features into the classification network to perform classification task prediction, and obtain the prediction probability corresponding to each data in the training data set.
[0076] Refer to Figure 5, which is a schematic diagram of the feature extraction network flow in the electricity theft detection method of the present application. In Figure 5, the connection layer is called Concatenation, the batch layer is called Concatenation, and the output layer is called Layeroutput.
[0077] In its implementation, the feature extraction network uses a simple and universal rule to automatically set kernel selection in a one-dimensional convolutional neural network to achieve a receptive field covering different time series scales. This rule is derived from the Goldbach conjecture, which states that any positive even number can be written as the sum of two prime numbers. To address this, a full-scale convolutional neural network layer uses a multi-layer one-dimensional convolutional neural network, in which a set of prime numbers is used as the kernel size, with only 1 and 2 used as kernel sizes on the last layer, thus achieving a receptive field covering different time series scales. The specific kernel selection formula is described below:
[0078] Among them, p (i) represents the kernel size of the i-th layer.
[0079] Step S333: training and testing a preset model based on the predicted probability corresponding to each piece of data in the training data set and the test data set to obtain an electricity theft detection model.
[0080] Refer to FIG6 , which is a schematic diagram of an electricity theft detection model in the electricity theft detection method of the present application.
[0081] In an exemplary embodiment, in this embodiment, the step S331 may include:
[0082] Step S3311: stack a preset number of full-scale convolutional neural networks to obtain a feature extraction network.
[0083] Step S3312: extracting features from the training data set through the feature extraction network to obtain training data features.
[0084] In the specific implementation, the feature extraction network in this application is composed of a multi-layer full-scale convolutional neural network, and finally the training data is feature extracted and reduced to 50 dimensions. The specific feature extraction network formula is expressed as follows: out =Relu(BatchNormld(Conv 1d (ConstandPad 1d (X in )))),P (1) ∈{1,2,3,5,…, p k}. X" out=Reky(BatchNormld(Conv 1d (ConstandPad 1d (X' out )))),P (i) ∈{1, 2, 3, 5, …, p k}. X out =Relu(BatchNormld(Cov 1d (ConstandPad 1d (X” out )))),P (i) ∈{1, 2}.
[0085] The above formula represents a full-scale convolutional neural network, where X in It is the data extracted from the input features. In the first layer, it represents the input data set sample, and in the subsequent layers, it represents the data features output by the previous layer. (i) Indicates the kernel size of the convolutional neural network at different layers. The first two layers represent an adaptively generated prime number, and the last layer uses 1 and 2 as kernel sizes to achieve a receptive field covering different time series scales. out , X” out Represents the output of each layer, X out Represents the output of a full-scale convolutional neural network. 1d () represents the padding operation, Conv 1d () is the convolution operator symbol, BatchNormld() is the normalization operation, and Relu() is the activation function symbol. In this embodiment, a stack of three layers of full-scale convolutional neural networks is used for residual connection to perform feature extraction and feature dimensionality reduction on the dataset samples.
[0086] Refer to FIG. 7 , which is a schematic diagram of a classification network structure in the electricity theft detection method of the present application.
[0087] Referring to Figure 8, Figure 8 is a heat diagram of the confusion matrix of the electricity theft detection model in the electricity theft detection method of the present application on the test set. As can be seen from Figure 8, 709 of the 758 electricity theft behaviors were correctly identified as electricity theft, and 49 were misidentified as normal electricity use behaviors, with a false alarm rate of only 6.4%. In terms of false alarm rate, 18 of the 7717 normal electricity use behaviors were misidentified as electricity theft, with a false alarm rate of only 0.23%. The overall classification accuracy of the model is (7699 + 709) / (7717 + 758) = 99.2%.
[0088] In an exemplary embodiment, the step S332 may include:
[0089] Step S3321: Construct a classification network based on the extreme gradient boosting algorithm with automatic hyperparameter optimization, input the training data features into the classification network to perform classification task prediction, and obtain the predicted probability corresponding to each data in the training data set, wherein the predicted probability includes the probability of a normal user and the probability of a power theft user.
[0090] In the specific implementation, feature extraction can be performed through data set samples of a full-scale convolutional neural network, and then the extracted features are input into the classification network. The classification network is composed of the Extreme Gradient Boosting (AutoXGB) algorithm with automatic hyperparameter optimization. AutoXGB uses the optimized gradient boosting library (XGBoost) to train the model, and uses Optuna, an automatic hyperparameter optimization framework specially designed for machine learning and deep learning, to optimize the hyperparameters of XGBoost. Engineers no longer need to optimize XGBoost hyperparameters again, saving optimization steps and time. Compared with hyperparameter optimization based on manual experience, it can find more suitable hyperparameters and improve model performance.
[0091] This embodiment divides a dataset consisting of the preprocessed data and the historical electricity consumption data with the data labels into an original training sample set and a test dataset according to a preset ratio; performs sample enhancement on the original training sample set using a synthetic minority class oversampling technique and an edited nearest neighbor node algorithm to obtain a training dataset; stacks a preset number of full-scale convolutional neural networks to obtain a feature extraction network; extracts features from the training dataset using the feature extraction network to obtain training data features; constructs a classification network based on an extreme gradient boosting algorithm with automatic hyperparameter optimization, inputs the training data features into the classification network to perform classification task prediction, and obtains a predicted probability corresponding to each data item in the training dataset, the predicted probability including a normal user probability and an electricity theft user probability; and trains and tests a preset model based on the predicted probability corresponding to each data item in the training dataset and the test dataset to obtain an electricity theft detection model. Compared with the traditional electricity theft detection method, the above method of this embodiment obtains an electricity theft detection model by training and testing a preset model constructed based on OS_CNN technology and AutoXGB technology. Therefore, it is possible to quickly and accurately detect whether there is electricity theft at the electricity terminal through the electricity theft detection model, thereby avoiding the technical disadvantages brought about by the traditional manual detection method.
[0092] In addition, an embodiment of the present application further provides a storage medium, on which a power theft detection program is stored. When the power theft detection program is executed by a processor, the steps of the power theft detection method described above are implemented.
[0093] 9 , which is a structural block diagram of a first embodiment of an electricity theft detection device of the present application.
[0094] As shown in FIG9 , the electricity theft detection device proposed in the embodiment of the present application includes: a label marking module 901 , a data processing module 902 , a model building module 903 and an electricity theft detection module 904 .
[0095] The label marking module 901 is used to obtain historical electricity usage data of the electricity terminal in the first detection cycle and assign data labels to the historical electricity usage data, wherein the data labels include normal users and electricity theft users.
[0096] The data processing module 902 is configured to perform data preprocessing on the missing data in the historical electricity usage data to obtain preprocessed data.
[0097] The model building module 903 is used to train and test the preset model based on the preprocessed data and the historical electricity usage data with the data labels to obtain a power theft detection model, where the preset model is built based on the OS_CNN technology and the AutoXGB technology.
[0098] The electricity theft detection module 904 is configured to detect whether the electricity terminal has committed electricity theft through the electricity theft behavior detection model.
[0099] This embodiment obtains historical electricity usage data of an electricity terminal during a first detection cycle and assigns data labels to the historical electricity usage data, wherein the data labels include normal users and electricity theft users; preprocesses missing data in the historical electricity usage data to obtain preprocessed data; trains and tests a preset model based on the preprocessed data and the historical electricity usage data with the data labels to obtain an electricity theft detection model, wherein the preset model is constructed based on OS_CNN technology and AutoXGB technology; and detects whether the electricity terminal has engaged in electricity theft using the electricity theft detection model. Compared to traditional electricity theft detection methods, the method of this embodiment trains and tests a preset model constructed based on OS_CNN technology and AutoXGB technology to obtain an electricity theft detection model. Therefore, the electricity theft detection model can quickly and accurately detect whether the electricity terminal has engaged in electricity theft, thereby avoiding the technical drawbacks of traditional manual detection methods.
[0100] Based on the first embodiment of the electricity theft detection device of the present application, a second embodiment of the electricity theft detection device of the present application is proposed.
[0101] In this embodiment, the data processing module 902 is also used to perform piecewise cubic Hermite interpolation on the historical electricity consumption data to obtain a difference function; based on the difference function, data filling is performed on the missing data in the historical electricity consumption data to obtain filled historical electricity consumption data; and the filled historical electricity consumption data is standardized to obtain preprocessed data.
[0102] Exemplarily, the model building module 903 is further used to divide the data set consisting of the preprocessed data and the historical electricity consumption data with the data labels into an original training sample set and a test data set according to a preset ratio; perform sample enhancement on the original training sample set through synthetic minority class oversampling technology and edited nearest neighbor node algorithm to obtain a training data set; train and test the preset model based on the training data set and the test data set to obtain a power theft detection model.
[0103] Exemplarily, the model building module 903 is further used to extract features from the training data set through a feature extraction network to obtain training data features; input the training data features into a classification network to perform classification task prediction to obtain a prediction probability corresponding to each data in the training data set; and train and test a preset model based on the prediction probability corresponding to each data in the training data set and the test data set to obtain an electricity theft detection model.
[0104] Exemplarily, the model building module 903 is also used to stack a preset number of full-scale convolutional neural networks to obtain a feature extraction network; and perform feature extraction on the training data set through the feature extraction network to obtain training data features.
[0105] Exemplarily, the model building module 903 is also used to build a classification network based on the extreme gradient boosting algorithm with automatic hyperparameter optimization, input the training data features into the classification network to perform classification task prediction, and obtain the predicted probability corresponding to each data in the training data set, wherein the predicted probability includes the probability of a normal user and the probability of a power theft user.
[0106] Exemplarily, the electricity theft detection module 904 is further used to input the electricity usage data of the electricity terminal in the second detection cycle into the electricity theft behavior detection model to obtain a model output result; based on the model output result, it is determined whether the electricity terminal has committed electricity theft, and an alarm is issued when the electricity terminal has committed electricity theft.
[0107] Other embodiments or specific implementations of the electricity theft detection device of the present application can refer to the above-mentioned method embodiments and will not be described in detail here.
[0108] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0109] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0110] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a non-temporary storage medium (such as read-only memory / random access memory, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0111] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for detecting electricity theft behavior, characterized in that, The electricity theft behavior detection method includes the following steps: Obtain the historical electricity consumption data of the electricity consumption terminal within the first detection period, and assign data labels to the historical electricity consumption data. The data labels include normal users and electricity theft users; Perform data preprocessing on the missing data in the historical electricity consumption data to obtain preprocessed data; Train and test a preset model based on the preprocessed data and the historical electricity consumption data with the data labels to obtain an electricity theft behavior detection model. The preset model is constructed based on the OS_CNN technology and the AutoXGB technology; Detect whether there is an electricity theft behavior in the electricity consumption terminal through the electricity theft behavior detection model.
2. The electricity theft detection method according to claim 1, wherein The step of performing data preprocessing on the missing data in the historical electricity consumption data to obtain preprocessed data includes: Perform piecewise cubic Hermite interpolation on the historical electricity consumption data to obtain a difference function; Based on the difference function, fill in the missing data in the historical electricity consumption data to obtain the filled historical electricity consumption data; Perform standardization processing on the filled historical electricity consumption data to obtain preprocessed data.
3. The electricity theft detection method according to claim 1, wherein, The step of training and testing a preset model based on the preprocessed data and the historical electricity consumption data with the data labels to obtain an electricity theft behavior detection model includes: Divide the data set composed of the preprocessed data and the historical electricity consumption data with the data labels into an original training sample set and a test data set according to a preset ratio; Perform sample enhancement on the original training sample set through the synthetic minority over-sampling technique and the edited nearest neighbor node algorithm to obtain a training data set; Train and test a preset model based on the training data set and the test data set to obtain an electricity theft behavior detection model.
4. The electricity theft behavior detection method according to claim 3, wherein, The step of training and testing a preset model based on the training data set and the test data set to obtain an electricity theft behavior detection model includes: Extract features from the training data set through a feature extraction network to obtain training data features; Input the training data features into a classification network to perform classification task prediction, and obtain the prediction probability corresponding to each piece of data in the training data set; Train and test a preset model based on the prediction probability corresponding to each piece of data in the training data set and the test data set to obtain an electricity theft behavior detection model.
5. The electricity theft behavior detection method according to claim 4, characterized in that, The step of extracting features from the training data set through a feature extraction network to obtain training data features includes: Stack a preset number of full-scale convolutional neural networks to obtain a feature extraction network; Extract features from the training data set through the feature extraction network to obtain training data features.
6. The electricity theft behavior detection method according to claim 5, wherein, The step of inputting the training data features into a classification network to perform classification task prediction and obtaining the prediction probability corresponding to each piece of data in the training data set includes: Construct a classification network based on the extreme gradient boosting algorithm with automatic hyperparameter optimization, input the training data features into the classification network to perform classification task prediction, and obtain the prediction probability corresponding to each piece of data in the training data set. The prediction probability includes the normal user probability and the electricity theft user probability.
7. The electricity theft behavior detection method according to claim 1, wherein The steps of detecting whether there is electricity theft behavior in the electricity consumption terminal through the electricity theft behavior detection model include: Input the electricity consumption data of the electricity consumption terminal in the second detection period into the electricity theft behavior detection model to obtain a model output result; Judge whether there is electricity theft behavior in the electricity consumption terminal based on the model output result, and give an alarm when there is electricity theft behavior in the electricity consumption terminal.
8. A power theft behavior detection device, characterized in that, The electricity theft behavior detection device includes: A label marking module, configured to obtain the historical electricity consumption data of the electricity consumption terminal in the first detection period and assign data labels to the historical electricity consumption data, where the data labels include normal users and electricity theft users; A data processing module, configured to perform data preprocessing on the missing data in the historical electricity consumption data to obtain preprocessed data; A model construction module, configured to train and test a preset model based on the preprocessed data and the historical electricity consumption data with the data labels to obtain an electricity theft behavior detection model, where the preset model is constructed based on OS_CNN technology and AutoXGB technology; An electricity theft detection module, configured to detect whether there is electricity theft behavior in the electricity consumption terminal through the electricity theft behavior detection model.
9. A power theft behavior detection device, characterized in that, The electricity theft behavior detection device includes: a memory, a processor, and an electricity theft behavior detection program stored on the memory and executable on the processor, where the electricity theft behavior detection program is configured to implement the steps of the electricity theft behavior detection method according to any one of claims 1 to 7.
10. A non-transitory storage medium, characterized in that, An electricity theft behavior detection program is stored on the storage medium, and when the electricity theft behavior detection program is executed by a processor, it implements the steps of the electricity theft behavior detection method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Electricity stealing analysis method and device
CN107492043A
User electricity stealing behavior detection method and system, terminal and medium
CN113095391A
Power consumer electricity stealing identification method and system based on deep learning
CN113901977A
Electricity stealing behavior detection method based on multi-source information
CN117034002A
Electricity stealing user identification method and device, storage medium and terminal
CN117034132A
Cited By
Electricity stealing behavior detection method, device and system
CN116561659A
Electricity stealing behavior detection method, device and system
CN116561659B
Electricity stealing behavior detection method and device, computer equipment, readable storage medium and program product
CN120687793A
Edge collaborative electricity stealing analysis method for electric energy meter
CN121051393A