Electricity stealing behavior detection method and device, computer equipment, readable storage medium and program product
By obtaining the electricity theft characteristic relationship function and optimizing model training, combining the least squares method and linear fitting, segmenting the load sequence, and training the electricity theft detection model, the problem of low electricity theft detection accuracy is solved and higher-precision electricity theft behavior identification is achieved.
Patent Information
- Application Number
- CN202511068418.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-09-23
AI Technical Summary
The accuracy of electricity theft detection methods in existing technologies is low, making it difficult to effectively identify electricity theft.
By obtaining the relationship function corresponding to the preset electricity theft characteristics and the normal load sequence, the electricity theft data optimization model is used for training. By combining the least squares method and linear fitting, the load sequence is segmented, the electricity theft detection model is trained, and the electricity theft period is identified.
The accuracy of electricity theft detection is improved, and the electricity theft period can be identified more accurately.
Smart Images

Figure CN120687793A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electricity theft detection, and in particular to a method, apparatus, computer equipment, readable storage medium, and program product for detecting electricity theft. Background Art
[0002] Electricity theft occurs when users illegally tamper with grid energy metering devices, such as energy meters and transformers, using specific techniques and equipment to cause their metered electricity consumption to be lower than their actual usage. This behavior not only causes direct economic losses to grid companies and disrupts the normal order of the electricity market, but also potentially affects the safe and stable operation of the grid. Therefore, detecting electricity theft is essential.
[0003] In the prior art, electricity theft detection methods based on manual inspection and electrical rule identification are often used to detect electricity theft. However, the detection accuracy of such methods is low. Summary of the Invention
[0004] Based on this, it is necessary to provide a method, device, computer equipment, readable storage medium and program product for detecting electricity theft that can improve the accuracy of electricity theft detection in order to address the above technical problems.
[0005] In a first aspect, the present application provides a method for detecting electricity theft, the method comprising:
[0006] Obtaining preset relationship functions corresponding to multiple preset electricity theft characteristics, and obtaining a normal load sequence of a normal user who has not engaged in electricity theft during a historical detection period; wherein the electricity theft characteristics represent the impact of the electricity theft behavior on the load data of the electricity theft user, and the relationship function represents the relationship between the normal load data when the user has not engaged in electricity theft and the abnormal load data when the user has engaged in electricity theft;
[0007] For any preset electricity theft characteristic, the normal load sequence is input into a preset relationship function corresponding to the preset electricity theft characteristic, and an initial electricity theft load sequence corresponding to the preset electricity theft characteristic is output; the initial electricity theft load sequence and the historical detection period are input into a trained electricity theft data optimization model, and a target electricity theft load sequence corresponding to the preset electricity theft characteristic is output;
[0008] For any one of the normal load sequence and the target electricity-stealing load sequence, determining the load sequence as an initial load sequence, and performing linear fitting on the initial load sequence based on a least squares method to obtain a fitting error;
[0009] Based on the fitting error and a preset error threshold, the initial load sequence is segmented to obtain a plurality of target load sequences;
[0010] Based on the target load sequence, the time period corresponding to the target load sequence, and the electricity theft identification corresponding to the target load sequence, a power theft detection model is trained to obtain a trained power theft detection model; wherein the electricity theft identification indicates whether the load data in the corresponding load sequence is power theft load data;
[0011] Obtain a load sequence to be detected of a user to be detected, input the load sequence to be detected into the trained electricity theft detection model, and output the electricity theft period of the user to be detected.
[0012] In one embodiment, inputting the initial electricity theft load sequence and the historical detection period into a trained electricity theft data optimization model to output a target electricity theft load sequence corresponding to the preset electricity theft characteristics includes:
[0013] Based on a preset noise adding step length, gradually adding Gaussian noise to the initial electricity stealing load sequence to obtain an intermediate electricity stealing load sequence;
[0014] The intermediate electricity-stealing load sequence and the historical detection period are input into a trained electricity-stealing data optimization model, and the target electricity-stealing load sequence is output.
[0015] In one embodiment, the initial load sequence is segmented based on the fitting error and a preset error threshold to obtain multiple target load sequences, including:
[0016] For any initial load sequence, when the fitting error is greater than the preset error threshold, splitting the initial load sequence into two new initial load sequences;
[0017] For any new initial load sequence, return to the step of performing linear fitting on the initial load sequence based on the least squares method to obtain the fitting error, and continue the process until the corresponding fitting errors of all initial load sequences are no greater than the preset error threshold;
[0018] When the fitting error is not greater than the preset error threshold, determining the initial load sequence as a first intermediate load sequence;
[0019] Based on a preset probability value and a preset mask value, a plurality of target load sequences are determined from the first intermediate load sequence.
[0020] In one embodiment, determining a plurality of target load sequences from the first intermediate load sequence based on a preset probability value and a preset mask value includes:
[0021] Based on the preset probability value, randomly determine at least one second intermediate load sequence from the first intermediate load sequence, and determine the product of the second intermediate load sequence and the preset mask value as a third intermediate load sequence;
[0022] The first intermediate load sequence and the third intermediate load sequence that are not determined as the second intermediate load sequence are determined as the target load sequence.
[0023] In one embodiment, the training process of the electricity theft data optimization model includes:
[0024] Obtaining a historical electricity theft type, historical electricity theft period, historical electricity theft characteristics, and a first historical electricity theft load sequence of an electricity theft user within a historical detection period;
[0025] For the remaining time periods in the historical detection time period excluding the historical electricity theft time period, determining at least one historical electricity-free time period having the same duration as the historical electricity theft time period from the remaining time periods, and obtaining a historical electricity-free load sequence of the electricity-theft user within the historical electricity-free time period;
[0026] Obtaining a historical relationship function corresponding to the historical electricity theft characteristics, inputting the historical non-electricity theft load sequence into the historical relationship function, and outputting a second historical electricity theft load sequence;
[0027] The electricity theft data optimization model is trained based on the historical electricity theft type, the historical electricity theft time period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence.
[0028] In one embodiment, the training of the electricity theft data optimization model based on the historical electricity theft type, the historical electricity theft period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence includes:
[0029] Based on the preset noise adding step length, gradually adding Gaussian noise to the second historical electricity theft load sequence to obtain a third historical electricity theft load sequence;
[0030] The historical electricity theft type, the historical electricity theft period, the first historical electricity theft load sequence, and the third historical electricity theft load sequence are input into the electricity theft data optimization model to obtain the trained electricity theft data optimization model.
[0031] In a second aspect, the present application further provides a device for detecting electricity theft, the device comprising:
[0032] A first acquisition module is configured to acquire preset relationship functions corresponding to a plurality of preset electricity theft characteristics, and to acquire a normal load sequence of a normal user who has not engaged in electricity theft during a historical detection period; wherein the electricity theft characteristics represent the manner in which the electricity theft behavior affects the load data of the electricity theft user, and the relationship function represents the relationship between the normal load data when the user has not engaged in electricity theft and the abnormal load data when the user has engaged in electricity theft;
[0033] An input module is configured to input the normal load sequence into a preset relationship function corresponding to any preset electricity theft characteristic, output an initial electricity theft load sequence corresponding to the preset electricity theft characteristic, input the initial electricity theft load sequence and the historical detection period into a trained electricity theft data optimization model, and output a target electricity theft load sequence corresponding to the preset electricity theft characteristic;
[0034] a determination module, configured to determine, for any one of the normal load sequence and the target electricity-stealing load sequence, the load sequence as an initial load sequence, and perform linear fitting on the initial load sequence based on a least squares method to obtain a fitting error;
[0035] a segmentation module, configured to segment the initial load sequence based on the fitting error and a preset error threshold to obtain a plurality of target load sequences;
[0036] a training module, configured to train an electricity theft detection model based on the target load sequence, the time period corresponding to the target load sequence, and the electricity theft identification corresponding to the target load sequence, to obtain a trained electricity theft detection model; wherein the electricity theft identification indicates whether the load data in the corresponding load sequence is electricity theft load data;
[0037] The second acquisition module is configured to acquire a load sequence to be detected of a user to be detected, input the load sequence to be detected into the trained electricity theft detection model, and output an electricity theft period of the user to be detected.
[0038] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in any of the above embodiments when executing the computer program.
[0039] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method in any one of the above embodiments.
[0040] In a fifth aspect, the present application further provides a computer program product, which includes a computer program that implements the steps of the method in any one of the above embodiments when executed by a processor.
[0041] The above-mentioned electricity theft detection method, device, computer equipment, readable storage medium and program product obtain preset relationship functions corresponding to multiple preset electricity theft characteristics, and obtain a normal load sequence of normal users who have not committed electricity theft during a historical detection period; for any preset electricity theft characteristic, the normal load sequence is input into the preset relationship function corresponding to the preset electricity theft characteristic, and an initial electricity theft load sequence corresponding to the preset electricity theft characteristic is output; the initial electricity theft load sequence and the historical detection period are input into the trained electricity theft data optimization model, and a target electricity theft load sequence corresponding to the preset electricity theft characteristic is output; for the normal load sequence and the target electricity theft load sequence, the target electricity theft load sequence is output. For any load sequence in the load sequence, the load sequence is determined as the initial load sequence, and the initial load sequence is linearly fitted based on the least squares method to obtain a fitting error; based on the fitting error and a preset error threshold, the initial load sequence is segmented to obtain multiple target load sequences; based on the target load sequence, the time period corresponding to the target load sequence, and the electricity theft identification corresponding to the target load sequence, an electricity theft detection model is trained to obtain a trained electricity theft detection model; the load sequence to be detected for the user to be detected is obtained, the load sequence to be detected is input into the trained electricity theft detection model, and the electricity theft time period of the user to be detected is output. The method provided in this application can improve the detection accuracy of electricity theft. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 1 is a flow chart of a method for detecting electricity theft in one embodiment;
[0044] Figure 2 1 is a flow chart of a method for outputting a target electricity-stealing load sequence in one embodiment;
[0045] Figure 3 This is a structural block diagram of an electricity theft detection device in one embodiment;
[0046] Figure 4 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0048] It should be noted that the terms "first", "second", etc. used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "including" and "having" used in this application and any variations thereof are intended to cover non-exclusive inclusions. The term "plurality" used in this application refers to two or more. The term "and / or" used in this application refers to one of the solutions or any combination of multiple solutions.
[0049] In one embodiment, Figure 1 As shown, a method for detecting electricity theft is provided. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0050] S102. Obtain preset relationship functions corresponding to multiple preset electricity theft characteristics, and obtain a normal load sequence of a normal user who has not engaged in electricity theft during a historical detection period; wherein the electricity theft characteristics represent the impact of the electricity theft on the load data of the electricity theft user, and the relationship function represents the relationship between normal load data when the user has not engaged in electricity theft and abnormal load data when the user has engaged in electricity theft.
[0051] The load sequence refers to a sequence of user's electricity load data arranged in chronological order over a period of time.
[0052] Optionally, the user's load sequence may be collected in multiple sampling periods within a historical detection period. For example, the historical detection period may be 14 days before the current time point, and the sampling period may be 1 hour.
[0053] Optionally, the relationship function may be, but is not limited to, a proportional reduction function, a peak clipping function, a downward adjustment function, an interval zeroing function, a random reduction function, or a peak shift function.
[0054] Optionally, the parameter information required by the proportional reduction function is the electricity theft ratio k, and its formula is described as:
[0055]
[0056] Where P(t) and They represent the normal load data when the user does not steal electricity and the abnormal load data when the user steals electricity. Represents the user's electricity theft time period.
[0057] Optionally, the parameter information required for the peak shaving function is the maximum load threshold P max , its formula is described as:
[0058]
[0059] Optionally, the parameter information required for the down-regulation function is the down-regulation load , its formula is described as:
[0060]
[0061] Optionally, the interval zeroing function formula is described as:
[0062]
[0063] Optionally, the parameter information required for the random reduction function is the reduction amount for each period , its formula is described as:
[0064]
[0065] Optionally, the parameter information required for the peak shift method is the phase shift amount , its formula is described as:
[0066]
[0067] S104. For any preset electricity theft characteristic, input the normal load sequence into a preset relationship function corresponding to the preset electricity theft characteristic, output an initial electricity theft load sequence corresponding to the preset electricity theft characteristic, and input the initial electricity theft load sequence and historical detection periods into a trained electricity theft data optimization model to output a target electricity theft load sequence corresponding to the preset electricity theft characteristic.
[0068] Among them, the electricity theft data optimization model is used to process the electricity theft load sequence generated by the relational function into a load sequence that is closer to the actual electricity theft load sequence; the electricity theft data optimization model can be, but is not limited to, a neural network model with an "encoder-decoder" architecture, such as a one-dimensional U-net (1D-UNet) and a score-based generative modeling network (ScoreNet).
[0069] S106 , for any one of the normal load sequence and the target electricity-stealing load sequence, determine the load sequence as an initial load sequence, and perform linear fitting on the initial load sequence based on a least squares method to obtain a fitting error.
[0070] Alternatively, a top-down approach is used to perform linear fitting on each load series of the sample using the least squares method, and the fitting error is calculated. :
[0071]
[0072] Where, is the sequence length, is the result of linear fitting of the sequence.
[0073] S108 . Segment the initial load sequence based on the fitting error and a preset error threshold to obtain multiple target load sequences.
[0074] Optionally, when the fitting error is not greater than a preset error threshold, the corresponding initial load sequence is not segmented; when the fitting error is greater than the preset error threshold, an optimal segmentation point is found in the corresponding initial load sequence, and the initial load sequence is segmented into two segments based on the principle of minimizing the sum of the fitting errors of the two segmented subsequences.
[0075] S110 , training an electricity theft detection model based on a target load sequence, a time period corresponding to the target load sequence, and an electricity theft identifier corresponding to the target load sequence to obtain a trained electricity theft detection model; wherein the electricity theft identifier indicates whether load data in the corresponding load sequence is electricity theft load data.
[0076] The electricity theft detection model is used to detect the electricity theft time period corresponding to the electricity theft behavior; the electricity theft detection model can be, but is not limited to, a traditional machine learning model or other time series neural network model.
[0077] Optionally, the target load sequence may be divided into a training set, a validation set, and a test set according to a preset ratio, and the electricity theft detection model may be trained, validated, and tested based on the training set, the validation set, and the test set, respectively.
[0078] Optionally, the electricity theft detection model is first trained based on the training set data. When the accuracy of the model in the validation set does not improve for K consecutive rounds, the training is stopped and the model performance is tested using the test set.
[0079] S112 , obtaining a load sequence to be detected of the user to be detected, inputting the load sequence to be detected into a trained electricity theft detection model, and outputting an electricity theft period of the user to be detected.
[0080] Optionally, the load sequence to be detected is segmented using the least squares method. If the number of all load sequences to be detected after segmentation is K, each number is selected from 1, 2, 3...K in ascending order, and the selected number is used as the number n of load sequences to be detected for masking operation; the load sequence to be detected is masked according to the number n, and the load sequence to be detected after the masking operation is input into the electricity theft detection model; the electricity theft detection model traverses the input load sequence to be detected until all electricity theft time periods corresponding to the load sequence to be detected are identified.
[0081] In the electricity theft detection method, preset relationship functions corresponding to multiple preset electricity theft characteristics are obtained, and a normal load sequence of normal users who did not engage in electricity theft during a historical detection period is obtained. For any preset electricity theft characteristic, the normal load sequence is input into the preset relationship function corresponding to the preset electricity theft characteristic, and an initial electricity theft load sequence corresponding to the preset electricity theft characteristic is output. The initial electricity theft load sequence and the historical detection period are input into a trained electricity theft data optimization model, and a target electricity theft load sequence corresponding to the preset electricity theft characteristic is output. For any load sequence between the normal load sequence and the target electricity theft load sequence, the load sequence is determined as the initial load sequence, and a linear fit is performed on the initial load sequence based on the least squares method to obtain a fitting error. The initial load sequence is segmented based on the fitting error and a preset error threshold to obtain multiple target load sequences. The electricity theft detection model is trained based on the target load sequences, the time periods corresponding to the target load sequences, and the electricity theft identifiers corresponding to the target load sequences to obtain a trained electricity theft detection model. A load sequence to be detected for the user to be detected is obtained, and the load sequence to be detected is input into the trained electricity theft detection model, and the electricity theft time period of the user to be detected is output. The method provided in this application can improve the detection accuracy of electricity theft.
[0082] In some embodiments, as Figure 2 As shown, the initial electricity theft load sequence and the historical detection period are input into the trained electricity theft data optimization model, and the target electricity theft load sequence corresponding to the preset electricity theft characteristics is output, including:
[0083] S202 : Based on a preset noise adding step size, gradually add Gaussian noise to the initial electricity-stealing load sequence to obtain an intermediate electricity-stealing load sequence.
[0084] S204: Input the intermediate electricity theft load sequence and the historical detection period into the trained electricity theft data optimization model, and output the target electricity theft load sequence.
[0085] Optionally, according to a designed noise intensity list Gradually move towards the initial electricity stealing load sequence Add noise, where n is the noise adding step size. , then the intermediate electricity stealing load sequence at the nth noise adding step is It can be written as:
[0086]
[0087] Where, is the Gaussian noise added in the nth step, It is the Gaussian noise added in the whole noise adding process.
[0088] In this embodiment, by gradually adding Gaussian noise to the initial electricity-stealing load sequence, the target electricity-stealing load sequence finally obtained can be closer to the actual electricity-stealing load sequence.
[0089] In some embodiments, the initial load sequence is segmented based on the fitting error and the preset error threshold to obtain multiple target load sequences, including: for any initial load sequence, when the fitting error is greater than the preset error threshold, the initial load sequence is segmented into two new initial load sequences; for any new initial load sequence, returning to the step of linearly fitting the initial load sequence based on the least squares method to obtain the fitting error, and continuing to execute until the corresponding fitting errors of all initial load sequences are no greater than the preset error threshold; when the fitting error is no greater than the preset error threshold, the initial load sequence is determined as a first intermediate load sequence; based on the preset probability value and the preset mask value, multiple target load sequences are determined from the first intermediate load sequence.
[0090] The mask value is a specific numerical value or binary pattern used to mark or filter data in the mask operation. Its core function is to selectively block or retain certain parts of the data.
[0091] In this embodiment, the initial load sequence is segmented by comparing the fitting error with a preset error threshold, and a target load sequence is obtained based on the segmentation result, so that the obtained target load sequence is more accurate.
[0092] In some embodiments, based on a preset probability value and a preset mask value, multiple target load sequences are determined from a first intermediate load sequence, including: based on a preset probability value, randomly determining at least one second intermediate load sequence from the first intermediate load sequence, and determining the product between the second intermediate load sequence and the preset mask value as a third intermediate load sequence; determining the first intermediate load sequence that has not been determined as the second intermediate load sequence and the third intermediate load sequence as target load sequences.
[0093] Optionally, the preset mask value may be, but is not limited to, a negative maximum value, which is used to make the weight value of the third intermediate load sequence on the detection result in the electricity theft detection model zero.
[0094] In this embodiment, the target load sequence is obtained based on the preset probability value and the preset mask value, so that the obtained target load sequence is more accurate.
[0095] In some embodiments, the training process of the electricity theft data optimization model includes: obtaining the historical electricity theft type, historical electricity theft period, historical electricity theft characteristics, and a first historical electricity theft load sequence of the electricity theft user within the historical detection period; for the remaining periods in the historical detection period except the historical electricity theft period, determining at least one historical non-electricity theft period with the same duration as the historical electricity theft period from the remaining periods, and obtaining the historical non-electricity theft load sequence of the electricity theft user within the historical non-electricity theft period; obtaining a historical relationship function corresponding to the historical electricity theft characteristics, and inputting the historical non-electricity theft load sequence into the historical relationship function to output a second historical electricity theft load sequence; and training the electricity theft data optimization model based on the historical electricity theft type, historical electricity theft period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence.
[0096] Optionally, the types of electricity theft may include, but are not limited to, undervoltage theft, undercurrent theft, phase shift theft, modification theft, meter winding theft, and other methods.
[0097] In this embodiment, the electricity theft data optimization model is trained based on the historical electricity theft type, historical electricity theft period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence, so that the trained electricity theft data optimization model has higher optimization accuracy.
[0098] In some embodiments, a power theft data optimization model is trained based on historical power theft types, historical power theft time periods, a first historical power theft load sequence, and a second historical power theft load sequence, including: gradually adding Gaussian noise to the second historical power theft load sequence based on a preset noise addition step size to obtain a third historical power theft load sequence; and inputting the historical power theft types, historical power theft time periods, the first historical power theft load sequence, and the third historical power theft load sequence into the power theft data optimization model to obtain a trained power theft data optimization model.
[0099] Optionally, the loss function of the electricity theft data optimization model is as follows:
[0100]
[0101] Where, For man-made noise, is the difference between the electricity theft data obtained through the relationship function and the actual electricity theft data, The input sequence of the electricity theft data optimization model is , the output result of the electricity theft data optimization model when the step size is n.
[0102] After completing the model training, high-fidelity electricity theft data It can be calculated as follows:
[0103]
[0104] In this embodiment, the historical electricity theft type, historical electricity theft period, the first historical electricity theft load sequence, and the third historical electricity theft load sequence are input into the electricity theft data optimization model, and the trained electricity theft data optimization model is output, so that the optimization accuracy of the trained electricity theft data optimization model is higher.
[0105] In one embodiment, another method for detecting electricity theft is provided, the method comprising the following:
[0106] Extract electricity load data samples of normal users and electricity load data samples of electricity theft users in the electricity theft detection area, determine the type of electricity theft, electricity theft time period, electricity theft characteristics and other information of the extracted electricity theft samples, and use the formula method to generate rough simulation data corresponding to the electricity theft samples;
[0107] Gaussian noise is gradually added to the generated rough simulation data samples to destroy their load characteristic information. A power theft data generation model is constructed and trained to enable the model to recover the true power theft load data from the noisy data. User power theft information parameters are randomly set, and a formula method is used to generate an equal amount of power theft simulation data for each power theft type. After artificial noise processing, the data is input into the power theft data generation model to obtain power theft samples with high simulation accuracy.
[0108] The extracted real samples and generated simulated samples are combined, and the optimal number and position of segments in the load sequence of the electricity theft sample are determined using a piecewise linear fitting method. After feature enhancement, the data is proportionally divided into training, validation, and test sets, and then input into the electricity theft detection model for training and testing. After training is complete, the load data of the user to be tested is input into the electricity theft detection model to identify the user's electricity theft behavior.
[0109] After completing the segmentation and identification of the electricity theft sample sequence, each sequence segment is randomly masked and input into the electricity theft detection model to determine the longest segment combination in which the user has committed electricity theft, which is used as the electricity theft period interval of the user sample.
[0110] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily performed in sequence in the order indicated by the arrows. Unless clearly stated herein, the execution of these steps is not strictly limited in order, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps. It is understandable that the various steps in different embodiments can be freely combined as needed, and the various non-contradictory schemes formed by the combination all fall within the scope of protection of this application.
[0111] Based on the same inventive concept, embodiments of the present application also provide an electricity theft detection device for implementing the aforementioned electricity theft detection method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more of the following embodiments of the electricity theft detection device can be found in the above-mentioned limitations of the electricity theft detection method and will not be further elaborated here.
[0112] In an exemplary embodiment, Figure 3 As shown, a device 300 for detecting electricity theft is provided, comprising: a first acquisition module 301, an input module 302, a determination module 303, a segmentation module 304, a training module 305, and a second acquisition module 306, wherein:
[0113] The first acquisition module 301 is configured to acquire preset relationship functions corresponding to a plurality of preset electricity theft characteristics, and to acquire a normal load sequence of a normal user who has not engaged in electricity theft during a historical detection period. The electricity theft characteristics represent the manner in which the electricity theft behavior affects the load data of the electricity theft user, and the relationship functions represent the relationship between normal load data when the user has not engaged in electricity theft and abnormal load data when the user has engaged in electricity theft.
[0114] The input module 302 is configured to input the normal load sequence into a preset relationship function corresponding to any preset electricity theft characteristic, output an initial electricity theft load sequence corresponding to the preset electricity theft characteristic, input the initial electricity theft load sequence and the historical detection period into a trained electricity theft data optimization model, and output a target electricity theft load sequence corresponding to the preset electricity theft characteristic.
[0115] The determination module 303 is configured to determine any one of the normal load sequence and the target electricity-stealing load sequence as an initial load sequence, and perform linear fitting on the initial load sequence based on a least squares method to obtain a fitting error.
[0116] The segmentation module 304 is configured to segment the initial load sequence based on the fitting error and a preset error threshold to obtain a plurality of target load sequences.
[0117] The training module 305 is configured to train the electricity theft detection model based on the target load sequence, the time period corresponding to the target load sequence, and the electricity theft identification corresponding to the target load sequence, to obtain a trained electricity theft detection model; wherein the electricity theft identification indicates whether the load data in the corresponding load sequence is electricity theft load data.
[0118] The second acquisition module 306 is configured to acquire a load sequence to be detected of the user to be detected, input the load sequence to be detected into the trained electricity theft detection model, and output an electricity theft period of the user to be detected.
[0119] In some embodiments, the input module 302 is further configured to gradually add Gaussian noise to the initial electricity-stealing load sequence based on a preset noise addition step size to obtain an intermediate electricity-stealing load sequence; input the intermediate electricity-stealing load sequence and the historical detection period into the trained electricity-stealing data optimization model, and output the target electricity-stealing load sequence.
[0120] In some embodiments, the segmentation module 304 is further used to, for any initial load sequence, split the initial load sequence into two new initial load sequences when the fitting error is greater than the preset error threshold; for any new initial load sequence, return to the step of performing linear fitting on the initial load sequence based on the least squares method to obtain the fitting error, and continue executing until the corresponding fitting errors of all initial load sequences are no greater than the preset error threshold; when the fitting error is no greater than the preset error threshold, determine the initial load sequence as a first intermediate load sequence; and determine multiple target load sequences from the first intermediate load sequence based on a preset probability value and a preset mask value.
[0121] In some embodiments, the segmentation module 304 is also used to randomly determine at least one second intermediate load sequence from the first intermediate load sequence based on the preset probability value, and determine the product of the second intermediate load sequence and the preset mask value as a third intermediate load sequence; and determine the first intermediate load sequence that is not determined as the second intermediate load sequence and the third intermediate load sequence as the target load sequence.
[0122] In some embodiments, the electricity theft behavior detection device 300 is specifically used to obtain the historical electricity theft type, historical electricity theft period, historical electricity theft characteristics and a first historical electricity theft load sequence of the electricity theft user within a historical detection period; for the remaining periods of the historical detection period except the historical electricity theft period, determine at least one historical non-electricity theft period with the same duration as the historical electricity theft period from the remaining periods, and obtain the historical non-electricity theft load sequence of the electricity theft user within the historical non-electricity theft period; obtain a historical relationship function corresponding to the historical electricity theft characteristics, input the historical non-electricity theft load sequence into the historical relationship function, and output a second historical electricity theft load sequence; and train the electricity theft data optimization model based on the historical electricity theft type, the historical electricity theft period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence.
[0123] In some embodiments, the electricity theft detection device 300 is further configured to train the electricity theft data optimization model based on the historical electricity theft type, the historical electricity theft time period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence, including: gradually adding Gaussian noise to the second historical electricity theft load sequence based on the preset noise addition step size to obtain a third historical electricity theft load sequence; and inputting the historical electricity theft type, the historical electricity theft time period, the first historical electricity theft load sequence, and the third historical electricity theft load sequence into the electricity theft data optimization model to obtain the trained electricity theft data optimization model.
[0124] Each module in the electricity theft detection device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or stored in a computer device memory in software form, so that the processor can call and execute the corresponding operations of each module.
[0125] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 4As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via wired or wireless communication, and the wireless communication can be achieved via Wi-Fi, a mobile cellular network, near field communication (NFC), or other technologies. When executed by the processor, the computer program implements a method for detecting electricity theft.
[0126] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0127] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0128] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0129] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0130] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0131] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0132] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0133] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for detecting electricity theft, characterized in that: The method comprises: Obtaining preset relationship functions corresponding to multiple preset electricity theft characteristics, and obtaining a normal load sequence of a normal user who has not engaged in electricity theft during a historical detection period; wherein the electricity theft characteristics represent the impact of the electricity theft behavior on the load data of the electricity theft user, and the relationship function represents the relationship between the normal load data when the user has not engaged in electricity theft and the abnormal load data when the user has engaged in electricity theft; For any preset electricity theft characteristic, the normal load sequence is input into a preset relationship function corresponding to the preset electricity theft characteristic, and an initial electricity theft load sequence corresponding to the preset electricity theft characteristic is output; the initial electricity theft load sequence and the historical detection period are input into a trained electricity theft data optimization model, and a target electricity theft load sequence corresponding to the preset electricity theft characteristic is output; For any one of the normal load sequence and the target electricity-stealing load sequence, determining the load sequence as an initial load sequence, and performing linear fitting on the initial load sequence based on a least squares method to obtain a fitting error; Based on the fitting error and a preset error threshold, the initial load sequence is segmented to obtain a plurality of target load sequences; Based on the target load sequence, the time period corresponding to the target load sequence, and the electricity theft identification corresponding to the target load sequence, a power theft detection model is trained to obtain a trained power theft detection model; wherein the electricity theft identification indicates whether the load data in the corresponding load sequence is power theft load data; Obtain a load sequence to be detected of a user to be detected, input the load sequence to be detected into the trained electricity theft detection model, and output the electricity theft period of the user to be detected.
2. The method according to claim 1, characterized in that The step of inputting the initial electricity theft load sequence and the historical detection period into the trained electricity theft data optimization model and outputting the target electricity theft load sequence corresponding to the preset electricity theft characteristics includes: Based on a preset noise adding step length, gradually adding Gaussian noise to the initial electricity stealing load sequence to obtain an intermediate electricity stealing load sequence; The intermediate electricity-stealing load sequence and the historical detection period are input into a trained electricity-stealing data optimization model, and the target electricity-stealing load sequence is output.
3. The method according to claim 1, characterized in that The initial load sequence is segmented based on the fitting error and a preset error threshold to obtain multiple target load sequences, including: For any initial load sequence, when the fitting error is greater than the preset error threshold, splitting the initial load sequence into two new initial load sequences; For any new initial load sequence, return to the step of performing linear fitting on the initial load sequence based on the least squares method to obtain the fitting error, and continue the process until the corresponding fitting errors of all initial load sequences are no greater than the preset error threshold; When the fitting error is not greater than the preset error threshold, determining the initial load sequence as a first intermediate load sequence; Based on a preset probability value and a preset mask value, a plurality of target load sequences are determined from the first intermediate load sequence.
4. The method according to claim 3, characterized in that The determining of a plurality of target load sequences from the first intermediate load sequence based on a preset probability value and a preset mask value includes: Based on the preset probability value, randomly determine at least one second intermediate load sequence from the first intermediate load sequence, and determine the product of the second intermediate load sequence and the preset mask value as a third intermediate load sequence; The first intermediate load sequence and the third intermediate load sequence that are not determined as the second intermediate load sequence are determined as the target load sequence.
5. The method according to claim 1, wherein The training process of the electricity theft data optimization model includes: Obtaining a historical electricity theft type, historical electricity theft period, historical electricity theft characteristics, and a first historical electricity theft load sequence of an electricity theft user within a historical detection period; For the remaining time periods in the historical detection time period excluding the historical electricity theft time period, determining at least one historical electricity-free time period having the same duration as the historical electricity theft time period from the remaining time periods, and obtaining a historical electricity-free load sequence of the electricity-theft user within the historical electricity-free time period; Obtaining a historical relationship function corresponding to the historical electricity theft characteristics, inputting the historical non-electricity theft load sequence into the historical relationship function, and outputting a second historical electricity theft load sequence; The electricity theft data optimization model is trained based on the historical electricity theft type, the historical electricity theft time period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence.
6. The method according to claim 5, characterized in that The training of the electricity theft data optimization model based on the historical electricity theft type, the historical electricity theft period, the first historical electricity theft load sequence, and the second historical electricity theft load sequence includes: Based on a preset noise adding step length, gradually adding Gaussian noise to the second historical electricity theft load sequence to obtain a third historical electricity theft load sequence; The historical electricity theft type, the historical electricity theft period, the first historical electricity theft load sequence, and the third historical electricity theft load sequence are input into the electricity theft data optimization model to obtain the trained electricity theft data optimization model.
7. A device for detecting electricity theft, characterized in that: The device comprises: A first acquisition module is configured to acquire preset relationship functions corresponding to a plurality of preset electricity theft characteristics, and to acquire a normal load sequence of a normal user who has not engaged in electricity theft during a historical detection period; wherein the electricity theft characteristics represent the manner in which the electricity theft behavior affects the load data of the electricity theft user, and the relationship function represents the relationship between the normal load data when the user has not engaged in electricity theft and the abnormal load data when the user has engaged in electricity theft; An input module is configured to input the normal load sequence into a preset relationship function corresponding to any preset electricity theft characteristic, output an initial electricity theft load sequence corresponding to the preset electricity theft characteristic, input the initial electricity theft load sequence and the historical detection period into a trained electricity theft data optimization model, and output a target electricity theft load sequence corresponding to the preset electricity theft characteristic; a determination module, configured to determine, for any one of the normal load sequence and the target electricity-stealing load sequence, the load sequence as an initial load sequence, and perform linear fitting on the initial load sequence based on a least squares method to obtain a fitting error; a segmentation module, configured to segment the initial load sequence based on the fitting error and a preset error threshold to obtain a plurality of target load sequences; a training module, configured to train an electricity theft detection model based on the target load sequence, the time period corresponding to the target load sequence, and the electricity theft identification corresponding to the target load sequence, to obtain a trained electricity theft detection model; wherein the electricity theft identification indicates whether the load data in the corresponding load sequence is electricity theft load data; The second acquisition module is configured to acquire a load sequence to be detected of a user to be detected, input the load sequence to be detected into the trained electricity theft detection model, and output an electricity theft period of the user to be detected.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Transform neural network-based electricity larceny detection method and device
CN115018512A
Electricity stealing detection method, device, equipment, medium and program product
CN115982598A
Electricity theft behavior detection method, apparatus, and device, and storage medium
WO2025152643A1