A power electricity larceny detection method and system based on meta-contrast learning

By employing a meta-contrastive learning approach, a cross-scenario fast-adaptive electricity theft detection model is constructed, which solves the problem of insufficient recognition capability when deploying electricity theft detection in new areas and seasons, and achieves stable electricity theft identification and line loss management with a small number of samples.

CN122087564APending Publication Date: 2026-05-26SOUTHEAST UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTHEAST UNIV
Filing Date
2026-01-14
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing electricity theft detection technologies have limited identification capabilities when faced with high-dimensional, nonlinear, and noisy electricity consumption data. Furthermore, when deployed in new regions, new seasons, or new transformer substations, the scarcity of electricity theft samples leads to high annotation costs, making it difficult to quickly adapt to actual operational needs.

Method used

We adopt a meta-contrastive learning-based approach. By constructing a task-level meta-learning framework, combining supervised contrastive learning and model-independent meta-learning, and utilizing advanced measurement infrastructure data, we segment local scenes and perform small-sample training to establish detection models for encoders, projectors, and classifiers, enabling rapid cross-scene transfer and stable recognition.

Benefits of technology

Given the scarcity of electricity theft samples and significant differences in user behavior, this technology enables rapid adaptation to new scenarios for electricity theft detection, improves feature discrimination and recognition accuracy, and possesses good engineering deployability and model scalability. It is suitable for electricity theft identification and line loss management under advanced measurement infrastructure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122087564A_ABST
    Figure CN122087564A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for detecting electricity theft based on meta-contrastive learning, belonging to the field of smart grid monitoring and power big data analysis technology. The method first acquires electricity consumption time-series data from multiple users, and preprocesses this data to form input samples for detection. Then, it constructs multiple meta-learning tasks consisting of support sets and query sets to characterize electricity consumption behavior patterns under different scenarios. A detection model is built, including a time-series encoder, a projection head, and a classification head. Supervised contrastive learning improves the aggregation degree of samples of the same category in the embedding space, and cross-entropy loss is used to achieve electricity theft classification. In newly deployed scenarios, the system requires only a small number of labeled samples to achieve rapid adaptation, realizing high accuracy and strong generalization ability in electricity theft detection. This invention overcomes the detection difficulties caused by extreme class imbalance, behavioral camouflage, and user heterogeneity, and is applicable to distribution network line loss management and intelligent inspection operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of smart grid monitoring and power big data analysis technology, specifically relating to a method and system for detecting electricity theft based on meta-comparative learning. Background Technology

[0002] With the rapid development of smart grids and distribution automation, advanced metering infrastructure has been widely deployed in power systems. It enables high-frequency, fine-grained data collection of user electricity consumption behavior, providing a rich data foundation for line loss management, load forecasting, and electricity theft detection. Against this backdrop, how to accurately identify electricity theft using large-scale electricity consumption time-series data has become one of the key issues in smart distribution systems.

[0003] Existing electricity theft detection technologies can be broadly categorized into traditional machine learning methods and deep learning methods. Traditional methods, such as support vector machines, decision trees, random forests, and K-nearest neighbors, typically rely on manually constructed statistical features to model user behavior. These methods are low-cost and easy to deploy, but their recognition capabilities are limited when faced with high-dimensional, non-linear, and noisy electricity consumption data. Especially in real-world scenarios with a large number of users and diverse behavior patterns, their detection performance often fails to meet engineering requirements. More importantly, existing deep learning models typically rely on large amounts of labeled data for training. However, when power companies deploy electricity theft detection models in new regions, seasons, or transformer substations, they often have only a very limited number of theft samples available. If training from scratch or large-scale transfer learning is still employed, it will result in huge labeling costs and model retraining overhead, hindering rapid deployment and dynamic adaptation to actual operational needs. Therefore, how to construct an electricity theft detection method that can quickly adapt to new scenarios based on a small number of samples while balancing recognition accuracy and engineering deployment efficiency is a crucial issue facing current technological development.

[0004] In recent years, meta-learning has demonstrated its potential to solve cross-scenario generalization problems by learning transferable initial parameters of a model across multiple tasks, enabling the model to quickly adapt to new tasks with a very small number of samples. Meanwhile, contrastive learning, by bringing samples of the same class closer together and distancing samples of different classes further apart, allows the model to achieve stronger class discrimination in the embedding space, helping to alleviate training bias caused by class imbalance. However, research combining meta-learning and supervised contrastive learning for electricity theft detection remains limited, and existing methods have not yet developed a systematic approach capable of synergistically optimizing for data characteristics, heterogeneous user behavior, and abnormal camouflage phenomena. Summary of the Invention

[0005] The technical problem to be solved by this invention is to address the shortcomings of existing electricity theft detection methods in terms of generalization ability, feature separability, and rapid adaptation across scenarios. This invention proposes a new electricity theft detection technology that can maintain stable recognition performance in the context of significant differences in user behavior, scarce electricity theft samples, and camouflaged features. It can also quickly adapt the model to different regions or time periods using a small number of labeled samples. This technology can be applied to the identification of abnormal user electricity consumption, analysis of electricity theft behavior, and management of distribution network line losses in advanced measurement infrastructure environments.

[0006] To solve the above technical problems, the present invention adopts the following technical solution:

[0007] First, this invention proposes a power theft detection method based on meta-contrast learning, primarily applied to advanced metering infrastructure scenarios in distribution networks. It aims to address the shortcomings of existing power theft identification models in handling user behavior heterogeneity, data imbalance, and insufficient transferability across multiple scenarios. The method includes the following steps:

[0008] S1. Acquire and preprocess user electricity consumption time series data:

[0009] Electricity consumption time series data from multiple users across multiple time periods are collected from advanced metering infrastructure systems. These data are then normalized, partitioned into sliding windows, and sampled to form a labeled or partially labeled electricity consumption sequence dataset, providing a unified data input structure for subsequent model training.

[0010] S2. Constructing task-level meta-learning scenarios based on region or user characteristics:

[0011] Based on distribution area, transformer substation structure, seasonal characteristics, or user clustering results, the total electricity consumption data is divided into several local scenarios, which are regarded as multiple heterogeneous learning tasks. Each task contains a small number of normal user samples and electricity theft user samples to construct the support set and query set, realizing a task-level small-sample training mode.

[0012] S3. Construct a meta-comparative detection model that includes an encoder, a projection head, and a classification head:

[0013] A basic detection network consisting of a time-series encoder, a contrast feature projection head, and an electricity theft classification head is established to achieve feature extraction of electricity consumption behavior, generation of contrast embeddings, and output of electricity theft probability. The encoder models the periodic patterns and local anomalies of users, the projection head is used to construct a more separable contrast feature space, and the classification head outputs the final electricity theft determination result.

[0014] S4. A centralized training mechanism that integrates supervised contrastive learning and model-independent meta-learning:

[0015] On the support set of each meta-learning task, supervised contrastive loss and cross-entropy classification loss are jointly computed to form a task-level objective function, and task adaptive parameters are generated based on the inner loop update rule. Then, the performance of the task adaptive parameters is evaluated on the query set, and the initial parameters of the model are optimized through the outer loop update mechanism, so that the model can achieve rapid transfer capability between multiple scenarios.

[0016] S5. Rapid few-sample adaptation and online electricity theft detection in new regions or scenarios:

[0017] In the newly deployed area, new tasks are built using only a small number of labeled users. Starting from the meta-initialization parameters, several steps of internal loop updates are performed to obtain local adaptation parameters. Then, the adaptation model is used to predict the probability of electricity theft for unlabeled users, enabling rapid migration and online detection of real distribution network scenarios.

[0018] Furthermore, the meta-contrast learning framework in this invention supports the introduction of similarity metrics with temperature parameters, embedding normalization strategies, and convolutional coding structures based on sequence features to enhance the feature separability and temporal modeling capabilities of anomaly detection.

[0019] Furthermore, the meta-learning optimization process in this invention adopts a second-order gradient strategy of model-independent meta-learning (MAML), and can be accelerated by first-order approximation in actual engineering deployment to meet the model training needs of large-scale distribution network users.

[0020] Secondly, this invention also proposes an electricity theft detection system for performing the above method, comprising:

[0021] The data processing module is used to collect, normalize, and window electricity consumption data.

[0022] The task construction module is used to generate meta-learning tasks based on scene features;

[0023] The meta-contrastive training module is used to perform joint contrastive learning and meta-optimization processes;

[0024] An adaptive detection module is used to perform rapid model adaptation and electricity theft detection in new scenarios;

[0025] The results output module is used to provide information on electricity theft probability, abnormal alarms, and auxiliary analysis.

[0026] Furthermore, the present invention proposes an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed, it performs the steps described in the method of the present invention.

[0027] Meanwhile, the present invention proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method of the present invention.

[0028] Finally, the present invention proposes a computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the method proposed in this invention.

[0029] The technical advantages of this invention compared to existing technologies are as follows:

[0030] This invention constructs a task-partition-based meta-learning framework, enabling the electricity theft detection model to rapidly transfer across regions and time periods. By introducing a supervised contrastive learning mechanism, it significantly improves feature discrimination in scenarios with extreme class imbalance. By employing a two-stage optimization strategy of support set-query set, the detection model can maintain stable performance across different user groups, medium- to long-term behavioral changes, and weakly disguised electricity theft patterns. The overall solution has good engineering deployability, model scalability, and practical application value, and is suitable for electricity theft identification, line loss management, and intelligent power supply and consumption safety monitoring in advanced measurement infrastructure scenarios. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a flowchart of the meta-comparative learning process for detecting electricity theft. Detailed Implementation

[0033] This embodiment presents a method for detecting electricity theft that is transferable across regions and adaptable to small sample sizes, based on user electricity consumption time-series data collected from advanced metering infrastructure in power distribution networks. The method mainly includes steps such as data processing, task construction, model training, and scenario adaptation.

[0034] Example 1: See Figure 1 The electricity theft detection method based on meta-contrast learning in this embodiment mainly includes the following steps:

[0035] Step S1: Electricity consumption time series acquisition and preprocessing

[0036] In step S1, the system acquires electricity consumption time-series data from multiple users from an advanced measurement infrastructure acquisition platform or a historical data platform. Assuming there are N users, each user has T time points and D feature dimensions (e.g., active power, reactive power, voltage, current, etc.) within the observation period, which can be represented as an electricity consumption data set:

[0037] ;

[0038] To improve the stability of subsequent model training, this embodiment preferably performs the following preprocessing on the original data:

[0039] Anomaly filtering and missing data handling: Filter out obviously erroneous data points (such as negative values ​​or abnormal spikes caused by instrument malfunctions) by combining simple threshold rules and business rules; for a small number of missing points that are not enough to affect the overall sequence structure, the preprocessing results already completed by the business system can be used directly.

[0040] Normalization: The numerical values ​​across different dimensions are normalized, for example using min-max normalization or z-score normalization, scaling each feature to a similar numerical range. This is denoted as the preprocessed sequence. .

[0041] Sliding window partitioning: For original sequences spanning long periods, this embodiment preferably uses a sliding window to divide them into multiple fixed-length sample segments. For example, setting the window length to L (e.g., 24 points or 96 points) and the step size s, multiple subsequence samples are generated for each user, with each sample corresponding to one window segment:

[0042]

[0043] Based on the electricity theft labels or periodic labels provided by the business side, an electricity theft label is assigned to each window sample. .

[0044] After the above processing, the sample set used for model training is obtained:

[0045] ,

[0046] Where M is the total number of samples.

[0047] Step S2: Construct meta-learning tasks based on scene segmentation

[0048] To improve the model's transferability across different regions and user groups, this embodiment employs a task-level meta-learning framework. Specifically, in step S2, the sample set D is divided into multiple local scenarios based on the distribution network structure or business characteristics.

[0049] The division methods may include, but are not limited to, any one or more of the following combinations:

[0050] 1. Divide according to power distribution area or transformer substation, and treat users in the same transformer substation or on the same feeder as a single scenario;

[0051] 2. Divide users according to their type, for example, by constructing different scenarios for residential users, commercial users, and users in specific industries;

[0052] 3. Divide according to season or time period, for example, treat the summer peak season and the winter heating season as different scenarios;

[0053] 4. Based on the clustering results, perform cluster analysis on the users' historical electricity consumption curves and group users with similar electricity consumption patterns into a task scenario.

[0054] Each scenario corresponds to a meta-learning task. Within each task, a small number of samples are randomly selected from the samples corresponding to that scenario to construct a support set. and query set :

[0055] 1. Support sets It includes a small number of normal and stolen electricity samples. For example, in the 2-class K-shot setting, it supports a set of K normal samples and K stolen electricity samples.

[0056] 2. Query set It contains several samples for evaluating the generalization performance of the task, such as Q normal samples and Q samples of electricity theft.

[0057] In this way, the entire training dataset is organized into a set of several meta-learning tasks:

[0058] ,

[0059] Where B represents the number of tasks used in the meta-training phase.

[0060] Step S3: Construct a meta-contrast learning detection model

[0061] The detection model constructed in this embodiment adopts a structure of "encoder + projection head + classification head" to balance feature representation learning and electricity theft classification performance.

[0062] encoder Receive input samples By using one-dimensional convolutional layers, pooling layers, and nonlinear activation functions, local pattern information (such as daily cycles, morning and evening peaks, and anomalous abrupt changes) at multiple time scales is extracted, and a fixed-length feature vector is obtained at the end through a global pooling layer.

[0063] .

[0064] In other embodiments, the encoder may also employ a combination of one-dimensional convolutional and recurrent neural network structures to further enhance its ability to model long sequence time dependencies. Projection head eigenvectors Mapping to contrastive embedding space:

[0065] ,

[0066] It typically includes one or two fully connected layers and nonlinear activations. To calculate the supervised contrastive loss, this embodiment preferably performs L2 normalization on the embedding vector.

[0067] Classification Head Based on feature vectors Output binary classification logits:

[0068] ,

[0069] The predicted probabilities of electricity theft and legitimate users are obtained using the softmax function, which are then used to calculate the cross-entropy classification loss.

[0070] In summary, the detection model can be expressed as:

[0071] .

[0072] Step S4: Training process integrating supervised contrastive learning and meta-learning

[0073] In step S4, this embodiment adopts a joint training mechanism of "supervised contrastive learning + model-independent meta-learning (MAML)," which specifically includes inner loop updates within a task and outer loop updates between tasks.

[0074] Supervised comparison loss for a batch of samples For each sample i, the contrastive embedding Perform normalization and calculate the similarity between samples:

[0075] ,

[0076] Where τ is the temperature coefficient. This represents the normalized embedding vector.

[0077] The set of samples with the same label as sample i is denoted as the positive sample set. Samples with different labels are denoted as the negative sample set. The supervised comparison loss can be written as:

[0078] ,

[0079] Predicted probability for each sample in the batch With real labels Calculate the standard binary classification cross-entropy loss:

[0080] ,

[0081] in To predict the probability of belonging to category c

[0082] For meta-learning tasks In supporting sets Construct a task-level joint loss:

[0083] ,

[0084] in and These are the weighting coefficients.

[0085] Then, the inner loop gradient update is performed to obtain the adaptive parameters for this task:

[0086] ,

[0087] in Inner loop learning rate. In other embodiments, the inner loop update may be performed in multiple steps to improve task adaptation.

[0088] Parameters updated using the inner loop In query set Calculate the query loss above:

[0089] ,

[0090] Within a meta-training batch, multiple tasks are selected. The average of the query losses for each task is used as the meta-loss:

[0091] ,

[0092] Then, the initial parameter θ is updated using an outer loop based on the meta-loss:

[0093] ,

[0094] Where β is the outer loop learning rate. In practical deployments, a MAML approximation method can be used to reduce computational complexity.

[0095] Through multiple rounds of meta-training iterations, the model obtains meta-initialization parameters θ that can quickly adapt to different task scenarios. ∗ .

[0096] Step S5: Rapid Adaptation and Electricity Theft Detection in New Scenarios

[0097] In practical applications, when the model is deployed to a new region, station area, or time period, there are usually only a small number of labeled users. This embodiment utilizes the already obtained meta-initialization parameter θ. ∗ Perform the following process:

[0098] A support set is constructed by selecting a small number of confirmed legitimate users and electricity theft users from the new scenario. ;

[0099] From the meta-initialization parameter θ ∗ Departure, at Calculate the joint loss Perform a small number of inner loop updates to obtain scene adaptation parameters. ;

[0100] Using parameters Inference is performed on other unlabeled user samples in the new scenario to output the probability of electricity theft, enabling rapid migration to the new area and online electricity theft detection.

[0101] Through the above steps, this invention achieves efficient adaptation and robust detection based on a small number of labeled samples in power distribution network scenarios where electricity theft samples are scarce and user behavior varies significantly.

[0102] Example 2: The present invention also proposes an electricity theft detection system for performing the above method, comprising:

[0103] The data acquisition and preprocessing module is used to collect raw electricity consumption time series from advanced measurement infrastructure systems or historical data platforms, perform noise reduction, normalization, and sliding window partitioning on the data, and generate a sample set that can be used for model training and inference.

[0104] The task building module is used to divide the sample set into multiple meta-learning tasks based on region, user type, season, or clustering results, and to build support sets and query sets within each task.

[0105] The meta-contrastive training module is used to construct a detection model consisting of a time-series encoder, a projection head, and a classification head. Following a strategy of jointly optimizing supervised contrastive loss and cross-entropy loss, it performs an inner and outer loop update process of model-independent meta-learning on multiple tasks to obtain meta-initialization parameters.

[0106] The adaptive detection module is used to receive a small number of labeled user samples in a new scenario, perform a small number of inner loop updates based on the meta-initialization parameters, generate scenario adaptive parameters, and use these parameters to predict the probability of electricity theft for all users in the new scenario.

[0107] The results output and alarm module is used to generate electricity theft risk scores, alarm lists, and auxiliary analysis reports based on the prediction results. It can also be connected to the dispatch terminal or line loss management system to achieve a closed-loop business process.

[0108] The modules mentioned above can be deployed on the same server or in a distributed manner on cloud platforms, local data centers or edge computing nodes. The modules interact with each other through internal buses or communication networks.

[0109] Example 3: This example provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When executed, the computer program implements any or all of the steps in the above-described method for detecting electricity theft based on meta-contrast learning.

[0110] Example 4: This example provides a computer-readable storage medium storing a computer program. When executed by a processor, the program implements the electricity theft detection method described above. The storage medium can be a disk, optical disk, USB flash drive, solid-state drive, memory card, or any other form of non-volatile storage medium.

[0111] Example 5: This example proposes a computer program product, including a computer program / instructions, which, when executed by a processor, implements the steps of the method proposed in this invention, and will not be described again here.

[0112] It should be noted that the processing flow of embodiments 2-5 corresponds to the specific steps of the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.

[0113] The data used in this embodiment comes from the advanced metering infrastructure electricity consumption data of a distribution substation in a certain area of ​​SGCC. The data covers residential users, commercial users, and some small industrial users, and contains historical electricity consumption records of approximately 42,000 users. The data length for each user is approximately 180–365 days, with a time granularity of 15 minutes. The F1-score and AUC, commonly used in binary classification tasks, are used as performance indicators.

[0114] This experiment selected four representative benchmark models as comparison objects, including: KNN-based statistical detection (KNN), support vector machine (SVM), convolutional network (CNN), and adversarial autoencoder (AAE). These methods are the mainstream solutions in the current field of electricity theft detection and anomaly recognition, reflecting the typical detection performance of traditional shallow models, deep learning models, and semi-supervised models, and serving as benchmarks for evaluating the effectiveness of the method of this invention.

[0115] To verify the model's performance under different levels of label scarcity, this embodiment was trained with 10%, 20%, and 30% labeled samples, and the F1-score and AUC of each method were recorded. The experimental results are shown in Tables 1–3.

[0116] Table 1: Comparison of detection performance at a labeling rate of 10%

[0117]

[0118] Table 2: Comparison of detection performance at a labeling rate of 20%

[0119]

[0120] Table 3: Comparison of detection performance at a labeling rate of 30%

[0121]

[0122] Furthermore, this embodiment uses the Wilcoxon signed-rank test (p-values ​​are all less than 0.05) to test the performance difference between the method of the present invention and the other four types of methods at different labeling rates. The results show that the method of the present invention is statistically significantly better than the other comparative models.

[0123] Meanwhile, the Friedman test was used to rank the detection performance of different methods in all scenarios. The results showed that MCL had the lowest average F-rank value (better than all other methods), further proving that the model described in this invention has a stable advantage in multi-scenario and multi-task environments.

[0124] To further illustrate the actual operation process of the electricity theft detection model based on meta-contrast learning of this invention, we will now use real user electricity consumption data provided by the State Grid Corporation of China as a basis to illustrate the feature extraction and task-level adaptation process of the model on a specific user.

[0125] Suppose we select a user with user ID u=10523, who has L=96 electricity consumption observation points with a granularity of 15 minutes in the most recent billing cycle. Construct its electricity consumption time series vector. At the same time, a scene label for the user's region or station is constructed, such as the user belonging to region R7, which is used for subsequent meta-task division.

[0126] When constructing the meta-learning task, this embodiment selects several other users in the same region as user ID 10523 as the task scenario. The sample set is used, and the support set and query set are constructed according to the K-shot task template. For example, in a 5-shot setting, the support set is constructed as follows:

[0127] Among them, there are 5 normal users and 5 users who steal electricity, tagged with .

[0128] Next, the user sequence Input Time Series Encoder The temporal feature vector is obtained as follows:

[0129] ,

[0130] Then through the projection head Obtain the contrastive learning embedding vector:

[0131] ,

[0132] For the projection vectors of users of the same and different categories in the support set, construct positive and negative sample sets respectively. For example, if user ID 10523 belongs to the normal category, then its positive sample set is defined as:

[0133] ,

[0134] The negative sample set is:

[0135] .

[0136] Then, an optimization objective is constructed based on the supervised contrastive loss. For example, the supervised contrastive loss for task number 10523 is:

[0137] ,

[0138] Where τ is the temperature parameter.

[0139] The inner loop updates are performed based on the support set loss to form the task adaptive parameters:

[0140] ;

[0141] Obtaining adaptive parameters Then, the temporal feature vector of user 10523 is input into the classification head again:

[0142] ,

[0143] in This represents the predicted probability of electricity theft for this user.

[0144] Finally, through repeated training on different regional tasks, the model can learn universal initialization parameters applicable to different regions and user types in large-scale distribution networks, achieving rapid small-sample adaptation capability.

[0145] Through this process, the present invention can not only characterize the similarity of user behavior in the regional environment, but also enhance the separation effect of positive and negative classes by using supervised contrastive learning, and achieve rapid migration to new regions through meta-learning, thereby obtaining comprehensive robust performance in multi-region and multi-scenario electricity theft detection tasks.

[0146] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0147] The above embodiments are merely illustrative of the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solutions based on the technical concept proposed in this invention shall fall within the scope of protection of this invention.

Claims

1. A method for detecting electricity theft based on meta-contrast learning, characterized in that, Includes the following steps: Acquire electricity consumption time-series data from multiple users and perform preprocessing operations to form input samples for detection; Multiple meta-learning tasks consisting of support sets and query sets are constructed to characterize electricity consumption behavior patterns under different scenarios. In each meta-learning task, a model-independent meta-learning algorithm is used to perform an inner loop update on the support set and an outer loop meta update on the query set to obtain meta-initialization parameters adapted to different regions or user groups. A detection model consisting of a time-series encoder, a projection head, and a classification head is constructed to extract features from the input electricity consumption sequence, generate a contrastive embedding, and output the electricity theft classification result, respectively. Supervised contrastive learning is used to improve the aggregation degree of samples of the same category in the embedding space, and cross-entropy loss is used to achieve electricity theft classification.

2. The method for detecting electricity theft based on meta-contrast learning according to claim 1, characterized in that, The electricity consumption time-series data of the multiple users are obtained from an advanced metering infrastructure system. The preprocessing operation includes normalizing the time series, segmenting it, or dividing it into sliding windows to form an electricity consumption sample set with electricity theft labels or partial labels, wherein each sample includes a segment of the electricity consumption sequence. and corresponding tags .

3. The method for detecting electricity theft based on meta-contrast learning according to claim 1, characterized in that, The construction of multiple meta-learning tasks consisting of a support set and a query set involves dividing the electricity consumption sample set according to region, time period, substation, transformer area, or user cluster. Each meta-learning task includes: Support set S: contains at least K normal user samples and K electricity theft user samples; The query set Q contains at least Q normal user samples and Q electricity theft user samples.

4. The method for detecting electricity theft based on meta-contrast learning according to claim 3, characterized in that, The method employs a model-independent meta-learning algorithm to perform inner-loop updates on the support set and outer-loop meta-updates on the query set, obtaining meta-initialization parameters adapted to different regions or user groups. Specifically: For each meta-learning task, a supervised contrastive loss to increase the discriminative power of different classes of samples in the embedding space and a cross-entropy classification loss to train the electricity theft binary classifier are calculated on its support set. The task loss is obtained by weighted summation of the two losses, and the model parameters are updated by inner loop gradient based on the task loss to obtain the task adaptive parameters. The query loss is calculated on the query set using task-adaptive parameters. The average query loss from multiple meta-learning tasks is used as the meta-loss, and the initial parameters are updated in the outer loop based on this, resulting in meta-initialization parameters that can generalize across scenarios. When deploying to new regions, new seasons, or new user groups, a novel meta-learning task is constructed based on a small number of labeled samples, starting with the meta-initialization parameter θ. ∗ The process begins by executing several steps of inner loop updates to obtain scene adaptation parameters. The scenario adaptive parameters are used to predict the probability of electricity theft for the electricity consumption sequences of unlabeled users in the new scenario.

5. The method for detecting electricity theft based on meta-contrast learning according to claim 1, characterized in that, The time series encoder is a one-dimensional convolutional neural network used to extract the periodic patterns, peak features, and local variation features of the electricity consumption curve; the classification head includes a fully connected layer and a softmax layer, used to output the binary classification probability of normal users and electricity thieves.

6. The method for detecting electricity theft based on meta-contrast learning according to claim 1, characterized in that, The supervised contrastive learning involves normalizing the embedded vectors, using temperature-scaled inner product similarity as a metric, constructing positive sample pairs for samples with the same label, and constructing negative sample pairs for samples with different labels. The closed-loop iteration termination condition is that the improvement of the multi-objective optimization value is lower than a preset threshold or the maximum number of iterations is reached within three consecutive iterations.

7. An electricity theft detection system based on meta-contrastive learning, characterized in that, include: The data acquisition and preprocessing module is used to acquire electricity consumption time series data from advanced measurement infrastructure systems and perform normalization and segmentation processing. The task building module is used to build meta-learning tasks containing support sets and query sets according to region, time period, or user cluster; The meta-contrastive learning training module is used to build a basic detection model. It performs supervised contrastive learning and classification learning on the support set and performs outer loop meta-update on the query set to obtain meta-initialization parameters. The few-sample adaptive detection module is used to perform an inner loop update and generate scene adaptive parameters based on a small number of labeled samples in a new scene. The results output module is used to output the probability of electricity theft or abnormal alarm results for each user.

8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor is configured to execute the computer program, it implements the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.

10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method described in any one of claims 1 to 6.