Electricity stealing detection method and system based on active learning

Through the combination of active learning and convolutional neural network, a CNN model of electricity theft detection was constructed, which solved the problem of poor adaptability of existing electricity theft detection methods to small sample data, and achieved efficient and accurate electricity theft detection.

CN120372273APending Publication Date: 2025-07-25GUANGXI POWER GRID CORP
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510235823.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing power theft detection methods rely on a large amount of labeled data, making it difficult to adapt to scenarios with few samples and unbalanced data. The detection capabilities of new power theft methods are limited and dynamic adjustment capabilities are lacking, resulting in high missed and false alarm rates.

Method used

Using an active learning method, a CNN model for power plagiarism detection is constructed by obtaining power consumption data, using convolutional neural network learning combined with Monte Carlo dropout, selecting the most valuable examples for model training, reducing the cost of data labeling.

Benefits of technology

The data marking cost is significantly reduced without sacrificing the reliability of theft detection, and the accuracy of the power detection and the generalization ability of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120372273A_ABST
    Figure CN120372273A_ABST
Patent Text Reader

Abstract

The invention discloses an active learning-based electricity stealing detection method and system, and relates to the technical field of deep learning, and the method comprises the steps: obtaining first power consumption data, and obtaining a first data set and a second data set according to the first power consumption data; determining a first data matrix according to the first power consumption data; constructing an electricity larceny detection CNN model based on the first data matrix; and training the electricity larceny detection CNN model according to the first data set and the second data set, and determining an electricity larceny detection result according to the trained first data set and the electricity larceny detection CNN model. According to the method, the data marking cost is reduced under the condition that the reliability of electricity stealing detection is not sacrificed, convolutional neural network learning and Bayesian active query based on Monte Carropout are seamlessly combined by utilizing an active learning scheme, and the most valuable instance is effectively selected for model training; a reliable electricity larceny detection CNN model can be deduced under a limited mark learning instance, and the data marking cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of deep learning, and particularly to an electricity theft detection method and system based on active learning. Background Art

[0002] Since the 19th century, electricity has gradually integrated into all aspects of human society, providing an indispensable driving force for the progress of modern civilization; usually, power losses can be divided into technical losses and non-technical losses; as one of the main non-technical losses, electricity theft is mainly caused by physical attacks (such as bypassing the electricity meter), firmware attacks (such as disconnecting the electricity meter), and cyber attacks (such as session hijacking); electricity theft will not only cause huge economic losses to power companies, but also pose major safety hazards to the power system, electrical equipment, and even people's lives, so it is urgent to carry out electricity theft detection.

[0003] Among them, due to the wide deployment of smart meters and advanced metering infrastructure, it has become possible to collect large-scale real-time electricity consumption data, thus providing a new and effective way for electricity theft detection; the large amount of data generated by smart meters provides a great opportunity to solve the electricity theft detection problem from the perspective of data analysis. Summary of the Invention

[0004] The purpose of this part is to outline some aspects of the embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this part, as well as in the abstract and title of the present application, to avoid obscuring the purpose of this part, the abstract, and the title, and such simplifications or omissions shall not be used to limit the scope of the present invention.

[0005] In view of the above problems, the present invention is proposed.

[0006] Therefore, the present invention provides an electricity theft detection method and system based on active learning, which can solve the problems mentioned in the background art.

[0007] To solve the above technical problems, the present invention provides the following technical solutions:

[0008] In the first aspect, an embodiment of the present invention provides an electricity theft detection method based on active learning, which includes obtaining first electricity consumption data, and obtaining a first data set and a second data set according to the first electricity consumption data; determining a first data matrix according to the first electricity consumption data; constructing an electricity theft detection CNN model based on the first data matrix; training the electricity theft detection CNN model according to the first data set and the second data set, and determining an electricity theft detection result according to the trained first data set and the electricity theft detection CNN model.

[0009] As a preferred embodiment of the electricity theft detection method based on active learning according to the present invention, the steps of obtaining the first power consumption data and obtaining the first data set and the second data set based on the first power consumption data include: obtaining the first power consumption data; preprocessing the first power consumption data to obtain a first power consumption data set; obtaining instances from the first power consumption data set and labeling them to obtain a first data set, and the remaining data is recorded as a second data set.

[0010] As a preferred embodiment of the electricity theft detection method based on active learning according to the present invention, the electricity theft detection CNN model includes a feature learning module and an anomaly classification module; the connection between the feature learning module and the anomaly classification module adopts any layer that reshapes the three-dimensional output of the feature learning module into one-dimensional data and transmits the one-dimensional data to the anomaly classification module for binary classification.

[0011] As a preferred embodiment of the electricity theft detection method based on active learning according to the present invention, the electricity theft detection CNN model further includes: connecting the anomaly classification module to binary classification, and calculating a probability value according to the output of the anomaly classification module to obtain the possibility that the predicted instance i is abnormal; inferring the possibility y that the predicted instance i is abnormal i to obtain the final output of the electricity theft detection CNN model.

[0012] As a preferred embodiment of the electricity theft detection method based on active learning according to the present invention, training the electricity theft detection CNN model according to the first data set and the second data set includes: inputting the first data set into the electricity theft detection CNN model for training; inputting the second data set into the electricity theft detection CNN model, selecting instances according to the query strategy and labeling them, and adding the labeled instances to the first data set; repeating the operation multiple times, and inputting the final first data set into the electricity theft detection CNN model for training and classification.

[0013] As a preferred embodiment of the electricity theft detection method based on active learning according to the present invention, the query strategy refers to embedding the training and application processes of the electricity theft detection CNN model into an active learning framework for iterative data annotation, and selecting the most valuable instances from the second data set in each iteration.

[0014] As a preferred embodiment of the electricity theft detection method based on active learning according to the present invention, selecting the most valuable instances includes using entropy measurement that measures the amount of information carried by the instance itself, or measuring the prediction entropy of the instance.

[0015] In a second aspect, to further solve the security problems existing in deep learning, an embodiment of the present invention provides an electricity theft detection system based on active learning, which includes: a data acquisition module for acquiring first power consumption data and obtaining a first data set and a second data set according to the first power consumption data; a data reshaping module for determining a first data matrix according to the first power consumption data; a model construction module for constructing an electricity theft detection CNN model based on the first data matrix; a training and detection module for training the electricity theft detection CNN model according to the first data set and the second data set, and determining an electricity theft detection result according to the trained first data set and the electricity theft detection CNN model.

[0016] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and: when the computer program is executed by the processor, any step of the electricity theft detection method based on active learning as described in the first aspect of the present invention is implemented.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and: when the computer program is executed by the processor, any step of the electricity theft detection method based on active learning as described in the first aspect of the present invention is implemented.

[0018] The beneficial effects of the present invention: The present invention proposes an economical and effective data-driven electricity theft detection method, which significantly reduces the data labeling cost without sacrificing the reliability of electricity theft detection and is systematically realized through a deep active learning scheme; the convolutional neural network learning is seamlessly combined with the Bayesian active query based on Monte Carlo dropout by using the active learning scheme, effectively selecting the most valuable instances for model training. In this way, a reliable electricity theft detection CNN model can be derived under limited labeled learning instances, thereby greatly reducing the data labeling cost. Description of the Drawings

[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. Among them:

[0020] Figure 1 It is the overall flowchart of the electricity theft detection method based on active learning in Embodiment 1.

[0021] Figure 2 It is the main architecture schematic diagram of the CNN for electricity theft detection in Embodiment 1.

[0022] Figure 3It is the flowchart for implementing the active learning strategy in Embodiment 1.

[0023] Figure 4 It is the schematic structural diagram of the computer device in Embodiment 3. Detailed implementation manners

[0024] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will describe the detailed implementation manners of the present invention with reference to the accompanying drawings of the specification.

[0025] Many specific details are set forth in the following description to facilitate a thorough understanding of the present invention. However, the present invention may be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.

[0026] Secondly, the so-called "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation manner of the present invention. The appearances of "in one embodiment" in different places in this specification do not all refer to the same embodiment, nor are they separate or alternative embodiments that exclude each other with other embodiments.

[0027] Embodiment 1

[0028] Refer to Figures 1 to 3 , which is the first embodiment of the present invention. This embodiment provides an electricity theft detection method based on active learning.

[0029] The existing electricity theft detection methods mainly have the following problems: First, the existing machine learning and deep learning models usually rely on a large amount of labeled data, while electricity theft behavior belongs to a typical scenario of few-shot and imbalanced data. Labeling a large amount of electricity theft behavior data not only consumes time and manpower, but also may be difficult to obtain due to the scarcity in the actual scenario. Second, the existing models have limited detection capabilities for new electricity theft means, and some electricity theft behaviors with strong concealment cannot be detected by simple rule matching or traditional feature extraction methods, resulting in high false negative and false positive rates. Finally, the current methods lack the ability to dynamically adjust according to the actual scenario. For example, the electricity consumption patterns of different users may vary greatly due to seasonal and regional factors, and fixed detection models are difficult to adapt to the changing actual situations.

[0030] This application can effectively solve the above-mentioned problems. Next, multiple embodiments will be combined to elaborate in detail how to implement the electricity theft detection method based on active learning.

[0031] Figure 1 The overall flowchart of the electricity theft detection method based on active learning is shown, including:

[0032] S1: Obtain the first power consumption data, and obtain the first data set and the second data set based on the first power consumption data.

[0033] In an optional embodiment, the first power consumption data may be data information such as the user's real-time power consumption, historical power consumption, daily power consumption, weekly power consumption, or monthly power consumption; in addition, the first power consumption data may also be auxiliary information related to the power consumption behavior such as the user's base load level, variable load fluctuation situation, type of power-consuming equipment, or distribution of power consumption time periods.

[0034] In the embodiment of the present application, obtaining the first power consumption data and obtaining the first data set and the second data set based on the first power consumption data includes: obtaining the first power consumption data.

[0035] Fill in the missing values in the first power consumption data, and then perform normalization processing on the filled first power consumption data to obtain the first power consumption data set.

[0036] Select n q instances from the first power consumption data set by random sampling and label them to obtain the first data set, and record the remaining data as the second data set.

[0037] In an optional embodiment, due to reasons such as smart meter failures, data transmission or storage failures, missing values marked as non-numeric (NaN) will inevitably appear in the smart meter data. Multiple data interpolation methods can be used to process the first power consumption data, and then fill in the missing values, such as linear interpolation, spline interpolation, K-nearest neighbor interpolation, or based on time series prediction models, etc. Select the most appropriate interpolation rule according to the context characteristics of the data to improve the integrity and accuracy of the data; in addition, in order to make the individual user profiles in different energy consumption ranges comparable on the same basis, the original power consumption data is normalized by min-max normalization.

[0038] In an optional embodiment, the system may further include a data quality assessment mechanism that can assess the quality of the interpolated and normalized data. The assessment indicators may include mean square error, mean absolute error, and similarity measure of data distribution, etc.; if the data quality does not meet the preset standard, a secondary processing process will be triggered, such as reselecting the interpolation method or adjusting the normalization parameters to further optimize the data quality; finally, the processed data will be used as the input of the subsequent electricity theft detection model to ensure that the model can achieve efficient and accurate detection performance based on high-quality data.

[0039] In an optional embodiment, for the electricity consumption data used in this embodiment, the electricity consumption data of each user can be obtained in real time online, or after a period of collection and storage, it can be obtained from the storage medium. This embodiment does not limit this.

[0040] Exemplarily, in the embodiment of the present application, for the electricity consumption data x of the user ij , if there is a missing value, the following formula is used to fill the missing value:

[0041]

[0042] where x' ij is the filled result; x i(j-1) is the electricity consumption of the i-th user at the (j - 1)-th moment; NaN is the missing value.

[0043] Furthermore, since the power load characterizes the rate of change of power consumption data, including the base load and the variable load, standardizing the load data is beneficial to model training and convergence. The min-max standardization method is used to remove the base load and highlight the trend of the variable load, while avoiding the influence of large differences in the order of magnitude. Standardizing the daily load can weaken the influence of abnormal days and seasons with critical peaks or false data injection. The specific formula is as follows:

[0044]

[0045] where x' ij is the filled result; x' i,max and x' i,min are the maximum and minimum values of the electricity consumption data of the i-th user respectively; x max = 1 and x min = 0 are the upper and lower bounds of the standardized value.

[0046] It should be noted that in the data of the smart meter, missing values inevitably exist, which brings challenges to data analysis and model training. By filling the missing values through the data point interpolation rule and standardizing the data through min-max normalization, the consistency and comparability of the input data can be ensured; in addition, this processing step can effectively eliminate the errors caused by data missing or deviation, ensure that the training data of the electricity theft detection model is within the same scale range, and avoid non-convergence or overfitting of the training caused by abnormal data, thereby improving the robustness of the electricity theft detection model.

[0047] Exemplarily, for the first dataset and the second dataset, without knowing the inherent data structure, 1500 instances are randomly selected from the dataset and sent to experts for marking, the electricity theft thieves are marked out, and n qThe first dataset contains the first set of data, and the remaining data is recorded as the unlabeled dataset, i.e., the second dataset. The labeled dataset will be used for the initialization of active learning in the second stage. The remaining unsampled instances contain only inputs, and they are put together to form an unlabeled dataset, which remains to be annotated. The instances in it will be gradually labeled through active learning strategies to support the construction of electricity theft detection models.

[0048] It should be noted that instances are selected from the power consumption dataset by random sampling and labeled, thereby obtaining the first dataset and the second dataset, i.e., the labeled dataset and the unlabeled dataset, wherein the labeled dataset is used for initial training, and the unlabeled dataset is gradually labeled through active learning, ensuring that the most informative data in the training set of the model is used to optimize the model; at the same time, the random sampling method can reduce the workload of expert labeling and quickly improve the training efficiency and accuracy of the model. Especially in the field of electricity theft detection, the instances in the unlabeled dataset have great potential value. By intelligently selecting the most useful instances, the learning process can be effectively accelerated.

[0049] S2: Determine a first data matrix according to the first power consumption data.

[0050] It should be noted that since daily electricity consumption fluctuations are relatively independent, it is difficult to identify the periodicity or non-periodicity of electricity consumption from one-dimensional electricity consumption data; however, if the electricity consumption data for several weeks are comprehensively analyzed, abnormal electricity consumption can be more easily identified.

[0051] In an optional embodiment, multiple strategies may be adopted to reshape the first power consumption data into a first data matrix to capture power consumption patterns and potential abnormal characteristics at different time scales, such as decomposing the first power consumption data into trend components, seasonal components, and residual components through a time series decomposition method, and constructing corresponding data matrices respectively. Regardless of the strategy adopted, it is necessary to ensure that the reshaped first data matrix can fully reflect the key characteristics of power consumption behavior while maintaining data integrity, so as to provide support for the efficient operation of subsequent models.

[0052] In the embodiment of the present application, the specific formula for determining the first data matrix according to the first power consumption data is as follows:

[0053]

[0054] Among them, X iis the original power consumption data of the i-th user, which is the input data of the electricity theft detection CNN model; i is the i-th user; N[T / 7] is the number of complete weeks involved in ≥1, and the entire profile can be represented by a two-dimensional heatmap, where each row of pixels corresponds to the energy consumption of a certain week; paying full attention to the weekly energy consumption pattern hidden behind individual instances through the guided supervised learning process helps improve the overall electricity theft detection performance.

[0055] It should be noted that by organizing the user's power consumption data into a two-dimensional matrix, the electricity theft detection CNN model can capture the periodic characteristics of power consumption within a weekly time window, which not only enhances the model's recognition ability for periodic and non-periodic changes but also reveals potential abnormal patterns in the input data, thus providing a clearer learning path for the model; secondly, the electricity theft detection CNN model can identify the electricity theft patterns hidden in multi-week data and effectively improve the overall detection performance.

[0056] S3: Construct an electricity theft detection CNN model based on the first data matrix.

[0057] In the embodiment of this application, as Figure 2 shown in the schematic diagram of the main architecture of the CNN for electricity theft detection, a convolutional neural network architecture is built using a two-dimensional convolutional layer, an activation function layer, a dropout layer, and a fully connected layer. The electricity theft detection CNN model consists of a feature learning module and an anomaly classification module.

[0058] It should be noted that in the present invention, the original power consumption data X of the i-th user i is used as the model input, and y i is used as the model output. y i being 0 indicates that the user is a normal user, and y i being 1 indicates that the user steals electricity. Furthermore, an electricity theft detection CNN model is constructed to infer the potential relationship between the original power consumption data X of the i-th user i and y i

[0059] Furthermore, the feature learning module is used to learn the inherent features from the model input, that is, the original power consumption data X of the i-th user i and the anomaly classification module is used to construct a classifier for electricity theft detection based on the features learned by the feature learning module.

[0060] In the embodiment of this application, the connection between the feature learning module and the anomaly classification module uses a flatten layer. The flatten layer reshapes the three-dimensional output of the feature learning module into one-dimensional data and transmits the one-dimensional data to the anomaly classification module for binary classification.

[0061] ​In the embodiment of the present application, the feature learning module is implemented by connecting N fully convolutional blocks. Each fully convolutional block includes a two-dimensional convolutional layer, an activation layer, and a dropout layer, where the dropout layer means discarding a specified number of neurons.

[0062] In the embodiment of the present application, the anomaly classification module consists of M fully connected blocks. Each fully connected block includes a fully connected layer, a prelu-based activation layer, and a dropout layer.

[0063] In an alternative embodiment, the connection between the feature learning module and the anomaly classification module can also adopt methods such as global average pooling or global max pooling to compress the three-dimensional output of the feature learning module into one-dimensional data, or adopt techniques such as a feature pyramid network to fuse different-level features of the feature learning module and generate one-dimensional data through a dimensionality reduction operation; regardless of the technique adopted, it is necessary to ensure that the output of the feature learning module can be effectively compressed and reshaped into a form suitable for the classification task before being passed to the anomaly classification module, while retaining the key feature information of the original data. Through this flexible connection method, multi-source feature information can be fully utilized in the anomaly classification module, thereby achieving more efficient and accurate electricity theft detection performance.

[0064] In an alternative embodiment, an attention mechanism, such as self-attention or multi-head attention, can also be introduced between the feature learning module and the anomaly classification module to perform weighted processing on the output of the feature learning module, highlight important features and suppress redundant information, enhance the model's attention to key features, and further improve the accuracy of electricity theft detection.

[0065] Exemplarily, in the embodiment of the present application, the feature learning module can be implemented by connecting three fully convolutional blocks. Each fully convolutional block consists of a two-dimensional convolutional layer, an activation layer, and a dropout layer. The anomaly classification module consists of two fully connected blocks. Each fully connected block includes a fully connected layer, a prelu-based activation layer, and a dropout layer. The construction of the electricity theft detection CNN model is completed through the combination of the feature learning module and the anomaly classification module. For the specific structures of the feature learning module and the anomaly classification module, there are differences according to different situations, and this example does not make specific limitations.

[0066] Further, in the embodiment of the present application, in order to connect the anomaly classification module to binary classification, by connecting a softmax activation layer, assuming that α and β are the outputs of the fully connected layer, the outputs α and β of the fully connected layer abstract the learning representation of the electricity theft detection CNN model and associate it with two potential classes of a given instance i, namely the normal class and the abnormal class. The probability value is calculated through softmax-based exponential normalization, representing the possibility that the predicted instance i is abnormal. The specific formula is as follows:

[0067]

[0068] wherein, is the probability that the prediction instance i is abnormal.

[0069] Using the binary IF-THEN decision rule to infer the probability that the prediction instance i is abnormal to obtain the final output of the electricity theft detection CNN model. The specific formula is as follows:

[0070]

[0071] where ε ∈ (0, 1) is the threshold of the binary decision. In order to make a fair decision, the threshold ε of the binary decision is specified as ε = 0.5. When it means that the corresponding user is an electricity thief.

[0072] In an alternative embodiment, in order to connect the anomaly classification module to binary classification, a distance-based classification method can also be introduced, such as support vector machine or K-nearest neighbor algorithm, etc., to further process the output of the anomaly classification module, and then distinguish normal users and electricity theft users according to the distance metric in the feature space, thereby improving the robustness of the classification. Or an ensemble learning method, such as random forest or gradient boosting decision tree, can be used to perform secondary classification on the output of the anomaly classification module as input features, and combine the prediction results of multiple weak classifiers to further improve the accuracy and stability of the classification; No matter which technology is adopted, it is necessary to ensure that the output of the anomaly classification module can be effectively mapped to the results of the binary classification task while maintaining the interpretability and fairness of the model.

[0073] It should be noted that in the prior art, the key to using the convolutional neural network CNN for electricity theft detection is that it can automatically extract useful features in the power consumption data. In the present invention, the convolutional neural network CNN extracts spatio-temporal features in the data through the feature learning module and performs electricity theft classification through the anomaly classification module; among them, the convolutional neural network CNN can automatically learn the hidden electricity theft patterns without manual feature extraction and continuously optimize its classification accuracy through the backpropagation algorithm; Compared with traditional machine learning methods, this automated feature learning not only reduces manual intervention but also greatly improves the accuracy of electricity theft detection and the generalization ability of the model.

[0074] S4: Train the electricity theft detection CNN model according to the first data set and the second data set, and determine the electricity theft detection result according to the trained first data set and the electricity theft detection CNN model.

[0075] In the embodiments of the present application, training the electricity theft detection CNN model according to the first dataset and the second dataset means inputting the data in the first dataset into the electricity theft detection CNN model for training, inputting the second dataset into the electricity theft detection CNN model, selecting the most valuable data according to the designed query strategy, sending this data to an expert for annotation, and adding the annotated data to the first dataset; repeating the operation multiple times, and inputting the final first dataset into the electricity theft detection CNN model for training and classification.

[0076] Further, the query strategy means using the electricity theft detection CNN model as the basic learner for electricity theft detection, embedding the model training and application process into an active learning framework for iterative data annotation. The core goal is to select the most valuable instances from the second dataset in each iteration to maximize the performance of the electricity theft detection CNN model currently trained by the small-scale first dataset; through this process, the electricity theft detection CNN model can be gradually optimized on the premise of minimizing the label query requirements for the second dataset, and finally achieve an ideal electricity theft detection effect.

[0077] Therefore, one of the key issues in this example is how to determine the value of a single instance in assisting CNN learning; from the perspective of information theory, the value of an instance can be estimated by the entropy metric that measures the amount of information (uncertainty) carried by the instance itself; mathematically, the most valuable instance can be selected by finding the instance with the largest prediction entropy.

[0078] In an alternative embodiment, multiple methods can be used to judge the value of an instance. For example, a diversity-based sampling method can be used to select the most representative instance by calculating the distance between instances, or a model confidence-based method can be introduced, such as minimum confidence sampling or margin sampling, etc., to judge the value of an instance according to the prediction probability of the model; regardless of the technology adopted, it is necessary to ensure that the selected instances can maximize the generalization ability and detection accuracy of the model while reducing the annotation requirements for unlabeled data. Through this diverse technology selection, the active learning strategy can achieve more efficient and intelligent sample selection in the electricity theft detection task, thereby supporting the continuous optimization of the CNN model.

[0079] In the embodiments of the present application, the specific formula for the value of an instance is as follows:

[0080]

[0081] where D u is the second dataset, that is, the unlabeled dataset; D l is the first dataset, that is, the labeled dataset; E(y i |X i ,D l) is the predicted entropy of instance i; arg max is to find the model output y that maximizes the predicted entropy E(y i , D l under the condition of, for instance i, where E(y i |X i , D l ); uncertainty refers to the uncertainty of the information carried by instance i. i

[0082] In the embodiments of the present application, the predicted entropy E(y i |X i , D l ) of instance i is used as the criterion for selecting the most valuable unlabeled instances to support the implementation of the entire method for supporting active learning. More specifically, the predicted entropy E(y i |X i , D l ) of instance i is calculated through entropy estimation based on logarithms, and the specific formula is as follows:

[0083]

[0084] where p(y i = c|X i , D l ) is the probability that the CNN model derived from the first dataset predicts instance i as class c, where c ∈ {0, 1} (0 → normal, 1 → abnormal); the electricity theft detection CNN model involves multiple dropout operations during model training; when using the electricity theft detection CNN model for classification prediction, the probability p(y i = c|X i , D l ) that the CNN model derived from the first dataset predicts instance i as class c is estimated based on K - time repeated MC dropouts approximation.

[0085] In the embodiments of the present application, as Figure 3 shown is the flowchart of the implementation of the active learning strategy. Training the electricity theft detection CNN model according to the first dataset and the second dataset includes the following steps: the active learning initialization step, using the prepared labeled dataset and unlabeled dataset as the labeled pool and unlabeled pool for active learning respectively; then, specifying the main parameters of active learning, namely the number of iterations n q per iteration, the number of queries K, and the maximum number of iterations N, and initializing the number of iterations as q = 1. Furthermore, on the basis of deep learning, a preliminary electricity theft detection CNN model is trained for subsequent active queries.

[0086] The active query step based on Monte Carlo dropouts, based on the preliminary electricity theft detection CNN model, makes K predictions on the class labels of all instances in the unlabeled dataset by using Monte Carlo dropouts, and sorts all instances in descending order, where the top n q instances with the largest entropy values are selected as the most valuable unlabeled instances and sent to domain experts for label query; this is the main step in which the selection of the most valuable unlabeled instances plays a role in the entire active learning implementation process. As these newly labeled instances are added to the labeled dataset, both the labeled dataset and the unlabeled dataset will be updated accordingly.

[0087] The electricity theft detection CNN model update step retrains a new electricity theft detection CNN model using the updated pool labeled dataset obtained from the active query step based on Monte Carlo dropouts, which is used to assist active query in the next iteration.

[0088] The active query step based on Monte Carlo dropouts and the electricity theft detection CNN model update step are iteratively executed until the iteration number q reaches the maximum value N; after the entire iterative active learning process is completed, the electricity theft detection CNN model trained in the last round of iteration is used as the final data-driven electricity theft detection model and further applied.

[0089] It should be noted that the active learning strategy selects the most valuable unlabeled instances for annotation by maximizing the uncertainty of the data, i.e., entropy measurement. This process can significantly improve the learning efficiency and accuracy of the model under a small amount of labeled data. Through interaction with experts, active learning ensures the gradual optimization of the training set, thus avoiding excessive invalid annotations; when the active learning strategy is used for a large amount of unlabeled data in electricity theft detection, it can reduce the annotation cost while improving the performance of the model, ensuring that electricity theft behaviors can be accurately identified.

[0090] In summary, the present invention proposes an economical and effective data-driven electricity theft detection method, which significantly reduces the data labeling cost without sacrificing the reliability of electricity theft detection, and is systematically realized through a deep active learning scheme; the convolutional neural network learning is seamlessly combined with the Bayesian active query based on Monte Carlo dropout by using the active learning scheme to effectively select the most valuable instances for model training. In this way, a reliable electricity theft detection CNN model can be derived under a limited number of labeled learning instances, thus greatly reducing the data labeling cost.

[0091] Embodiment 2 is an embodiment of the present invention, which provides an electricity theft detection system based on active learning, including: a data acquisition module for acquiring first power consumption data and obtaining a first data set and a second data set according to the first power consumption data; a data reshaping module for determining a first data matrix according to the first power consumption data; a model construction module for constructing an electricity theft detection CNN model based on the first data matrix; a training and detection module for training the electricity theft detection CNN model according to the first data set and the second data set, and determining an electricity theft detection result according to the trained first data set and the electricity theft detection CNN model.

[0092] Embodiment 3 is an embodiment of the present invention, which is different from the previous embodiment in that:

[0093] As Figure 4 shown, if the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0094] The logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch instructions from the instruction execution system, apparatus, or device and execute the instructions), or used in combination with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device.

[0095] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection (electronic device) having one or more wirings, a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or other suitable processing as necessary, and then stored in a computer memory.

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

[0097] Example 4, an embodiment of the present invention, provides a method for detecting electricity theft based on active learning. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through simulation experiments.

[0098] In this embodiment, for the data set, electricity theft detection tests are carried out by randomly dividing it into two groups, where 70% of the instances are used for the training data set and 30% of the instances are used for the test data set; in the training data set, 1000 instances in the training set are randomly sampled to initialize a labeled pool Dl, and the remaining instances are integrated into an unlabeled pool Du.

[0099] Secondly, for the implementation of active learning, based on first-hand experience of active learning, the main parameters are specified as nq = 1000, K = 50, and N = 10; it should be noted that this is only an initial parameter setting; the values of these parameters will be fine-tuned based on subsequent comprehensive tests and result analysis, where the training and testing of the electricity theft detection CNN model are repeated 5 times to evaluate the average electricity theft detection performance.

[0100] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered within the scope of the claims of the present invention.

Claims

1. A method for detecting electricity theft based on active learning, characterized in that: Including: Obtain first power consumption data, and obtain a first data set and a second data set according to the first power consumption data; Determine a first data matrix according to the first power consumption data; Construct a power theft detection CNN model based on the first data matrix; Train the power theft detection CNN model according to the first data set and the second data set, and determine a power theft detection result according to the trained first data set and the power theft detection CNN model.

2. The electricity theft detection method based on active learning according to claim 1, wherein: The obtaining of the first power consumption data and obtaining the first data set and the second data set according to the first power consumption data includes: Obtain first power consumption data; Preprocess the first power consumption data to obtain a first power consumption data set; Obtain instances from the first power consumption data set and label them to obtain a first data set, and record the remaining data as a second data set.

3. The electricity theft detection method based on active learning according to claim 2, wherein: The power theft detection CNN model includes a feature learning module and an anomaly classification module; The connection between the feature learning module and the anomaly classification module adopts any layer that reshapes the three-dimensional output of the feature learning module into one-dimensional data and transmits the one-dimensional data to the anomaly classification module for binary classification.

4. The power theft detection method based on active learning according to claim 3, characterized in that: The power theft detection CNN model further includes: Connect the anomaly classification module to binary classification, and calculate a probability value according to the output of the anomaly classification module to obtain the possibility that the predicted instance i is abnormal; The possibility y that the prediction instance i is abnormal i is inferred to obtain the final output of the electricity theft detection CNN model.

5. The power theft detection method based on active learning according to claim 4, wherein: Training the power theft detection CNN model according to the first data set and the second data set includes: Input the first data set into the power theft detection CNN model for training; Input the second data set into the power theft detection CNN model, select instances according to an interrogation strategy and label them, and add the labeled instances to the first data set; Repeat the operation multiple times, and input the final first data set into the power theft detection CNN model for training and classification.

6. The power theft detection method based on active learning according to claim 5, wherein: The interrogation strategy refers to embedding the training and application processes of the power theft detection CNN model into an active learning framework for iterative data annotation, and selecting the most valuable instances from the second data set in each iteration.

7. The electricity theft detection method based on active learning according to claim 6, wherein: The selection of the most valuable instances includes entropy measurement by measuring the amount of information carried by the instance itself, or by measuring the prediction entropy of the instance.

8. An electricity theft detection system based on active learning, based on the electricity theft detection method based on active learning according to any one of claims 1 to 7, characterized in that: Including, A data acquisition module, configured to obtain first power consumption data, and obtain a first data set and a second data set according to the first power consumption data; A data reshaping module, configured to determine a first data matrix according to the first power consumption data; A model construction module, configured to construct a power theft detection CNN model based on the first data matrix; A training and detection module, configured to train the power theft detection CNN model according to the first data set and the second data set, and determine a power theft detection result according to the trained first data set and the power theft detection CNN model.

9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of the power theft detection method based on active learning according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the power theft detection method based on active learning according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Neural network model training method and ion implantation process simulation method

    CN121211993A

  • Training method of neural network model and simulation method of ion implantation process

    CN121211993B