A power stealing prevention method and system of a code scanning power sharing device

By collecting residual current and voltage after a power outage at a shared electricity terminal after a session ends, constructing a graph, and combining it with a lightweight deep learning model and context-aware reasoning, the problem of identifying electricity theft after a session ends is solved, improving the accuracy and adaptability of identification.

CN122631940APending Publication Date: 2026-08-25STATE GRID HUNAN ELECTRIC POWER COMPANY LIMITED +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611109322.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

Existing QR code-based shared power terminals have difficulty identifying electricity theft behaviors such as bypassing power supply, abnormal parallel connection, reverse power supply from external energy storage, and relay bypass after the session ends. Traditional methods are insufficient in terms of detection timing and basis, leading to false alarms or missed alarms.

Method used

By collecting residual current and voltage after the power outage ends, a residual response map is constructed. Combined with a lightweight deep learning model and a context-aware reasoning mechanism, the risk of electricity theft can be identified and classified.

Benefits of technology

It improves the accuracy of identifying electricity theft after the session ends, adapts to image-based lightweight network structures, dynamically adjusts feature importance, and avoids false alarms and missed alarms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122631940A_ABST
    Figure CN122631940A_ABST
Patent Text Reader

Abstract

The application discloses a kind of power stealing prevention method and system of code scanning shared power equipment, the method is after the end of code scanning shared power session, first confirm that relay reliably disconnects, again establish power-off collection window, obtain residual current, voltage and environmental information, calculate residual admittance and stack into three-channel power-off residual response atlas.Improved MobileNetV2 is used to extract atlas features, combined with session, port, relay and historical baseline context information for gating modulation, obtain deep residual response features, and generate abnormal scores compared with normal center.Finally, the electrical rule evidence is fused, the risk score of bypassing power stealing is calculated, and the grading disposal instruction is executed according to the corresponding threshold.The method can detect bypassing, abnormal connection, external energy storage reverse power supply and relay bypassing and other hidden power stealing risks after the relay is disconnected, and realize port-level identification and active defense.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power management technology, and in particular to a method and system for preventing electricity theft in QR code-based shared power equipment. Background Technology

[0002] Existing smart meters and IoT data acquisition systems typically collect data such as current, voltage, power, cumulative electricity consumption, and load curves during operation, and then use threshold rules, machine learning, or deep learning models to identify abnormal electricity consumption behavior. These methods can identify long-term load anomalies, metering anomalies, and deviations in electricity consumption curves to a certain extent, but they primarily focus on operational characteristics during normal power supply. Traditional operational data detection methods struggle to accurately characterize hidden risks that may still occur in shared electricity usage scenarios, such as bypassing power connections, abnormal parallel connections, reverse power supply from external energy storage, relay bypassing, or unauthorized port coupling, even after the session ends and power is cut off.

[0003] Furthermore, existing deep learning-based electricity theft detection methods primarily process one-dimensional electricity consumption sequences or conventional meter data, with model inputs mainly consisting of power, electricity consumption, or load curves. These methods do not fully match the session isolation requirements of shared electricity terminals. While some models employ CNNs, LSTMs, autoencoders, or adversarial networks for complex feature extraction, they suffer from issues such as large parameter counts, difficulties in edge deployment, unclear judgment criteria, and insensitivity to historical baseline differences across different ports. For multi-port shared electricity terminals, the same residual current or voltage change may have different risk implications on different ports, under different power outage reasons, with different historical baselines, and under different communication states. Simply relying on fixed thresholds or the output of a single deep learning model can easily lead to false alarms or missed detections.

[0004] Therefore, it is necessary to propose an anti-theft detection method for the end stage of QR code-based shared electricity use sessions. This method can collect residual current and residual voltage after the relay is disconnected, obtain residual response maps of electrical coupling relationships, and combine a lightweight deep learning model with a context-aware reasoning mechanism to identify and classify risks of bypass power supply, abnormal parallel connection, reverse power supply from external energy storage, and relay bypass. Summary of the Invention

[0005] This invention provides a method and system for preventing electricity theft in QR code-based shared power devices. The method addresses the problems of existing QR code-based shared power terminal anti-theft methods, which mainly rely on current, voltage, power, or power data during operation, making it difficult to identify bypass power access and abnormal residual power consumption after the session ends; and the problems of existing deep learning models directly processing ordinary load curves, having a large computational load, lacking contextual interpretation, and port-level dynamic criteria.

[0006] In a first aspect, the present invention provides a method for preventing electricity theft from QR code-based shared power equipment, comprising: S1: Continuously acquire electricity metering, cost control, and status monitoring data during the user's QR code-based shared electricity session, and determine whether the session termination conditions are met; S2: When the session termination condition is met, generate session termination security status information, send a disconnect command to the corresponding port relay, and confirm whether the relay has been reliably disconnected; S3: Establish a residual current acquisition window and a residual current environment measurement window for power outages, acquire residual current and residual voltage on the total input side of the authorized port, and obtain surrounding environmental information. Construct an environmental intervention context vector and obtain the environmental intervention residual response coupling coefficient. ; S4: Standardize the residual current and residual voltage, calculate the residual admittance, construct the residual current correlation diagram, residual voltage correlation diagram and residual admittance correlation diagram respectively, and stack them to obtain the three-channel power-off residual response spectrum; S5: Input the three-channel power outage residual response map into the improved MobileNetV2 network to obtain the power outage residual response characteristics; S6: Obtain the session context, port context, relay and control context, and historical baseline context; construct context information; and encode the context information to obtain the context embedding vector. ; S7: Obtain deep features of residual response by performing context-gated modulation on the residual response features after power failure based on the context embedding vector. And generate the feature centers of the normal residual response under the current context conditions. ,according to and The distance between them is used to obtain a context-aware anomaly score. ; S8: Obtain electrical rule evidence data and construct electrical rule evidence vectors , combined , , and Calculate the risk score for electricity theft through wire looping; and issue action execution instructions for shared power terminals based on the action threshold range corresponding to the risk score for electricity theft through wire looping.

[0007] Furthermore, in S1, during the session, the session termination condition is met when any one of the following conditions is met: the user actively ends the electricity use, the prepaid balance is exhausted, the cloud platform issues a remote fee control power-off command, or the terminal detects an abnormal state and triggers a safety protection power-off.

[0008] Furthermore, the specific process of S3 is as follows: S301: After the relay is confirmed to be disconnected, a residual acquisition window is established to obtain residual current and residual voltage information during the process of the port recovering from the power supply operation state to the safe idle state; S302: Establish a measurement window for power outage environments to collect surrounding environmental information during the recovery process from a powered operation state to a safe idle state. This surrounding environmental information includes human intervention information and environmental influencing factors. Human intervention information includes the status of the protective cover being open. Vibration state Abnormal posture Abnormal lighting conditions Environmental influencing factors include the status of personnel presence. Abnormal temperature conditions ; S303: Calculate human intervention factors based on the acquired surrounding environmental information. Environmental Influencing Factors Furthermore, the coupling coefficient of the residual response to environmental intervention was calculated. ; Among them, human intervention factors Environmental Influencing Factors The calculation formula is: ; ; in, The weighting of various information items by human intervention; All of these represent the weights of each item in the environmental impact information; Environmental intervention residual response coupling coefficient The calculation formula is: ; in, This indicates that the weighting was manipulated manually. This indicates the weighting of natural intervention adjustments.

[0009] Furthermore, the specific process of S4 is as follows: S401: Standardize the acquired residual current and residual voltage, and further calculate the residual admittance; Among them, the The formula for calculating the standardized residual current at each sampling point is: ; No. The formula for calculating the standardized residual voltage at each sampling point is: ; in, This represents the standardized residual current; This represents the standardized residual voltage; , These represent the average residual current and residual voltage, respectively. , These represent the standard deviations of residual current and residual voltage, respectively. This represents a small constant to prevent the denominator from being zero.

[0010] The formula for calculating residual admittance based on residual current and residual voltage is as follows: ; in, Residual admittance indicates the residual admittance after power failure. Residual admittance is used to characterize whether the relay port still has electrical coupling with external load paths, abnormal wiring channels, or energy storage devices after the relay is disconnected.

[0011] S402: The terminal constructs the residual current correlation diagram, residual voltage correlation diagram, and residual admittance correlation diagram respectively: ; ; ; in, Indicates the residual current in the first... The sampling point and the first The difference between each sampling point; Indicates the residual voltage at the 1st The sampling point and the first The difference between each sampling point; Indicates the residual admittance in the first... The sampling point and the first The difference between each sampling point; S403: Stack the residual current correlation diagram, residual voltage correlation diagram and residual admittance correlation diagram into a three-channel power-off residual response spectrum.

[0012] Furthermore, the specific process of S5 is as follows: S501: Three-channel power-off residual response graph Input to an improved MobileNetV2 network; S502: Three-channel power-off residual response spectrum of the input obtained through a convolutional layer. Preliminary feature extraction is performed to obtain preliminary feature vectors. ; S503: Initial feature vector By inputting multiple cascaded inverse residual modules, the residual response feature map is obtained. ; S504: Residual response feature map Environmental intervention residual response coupling coefficient and environmental intervention context vector The input environment is used to modulate the residual response layer, and the modulated feature map is obtained. ; S505: Modulate the feature map A global average pooling layer is used to obtain the residual response characteristics after power failure. Finally, the output layer outputs: ; in, This is global average pooling.

[0013] Furthermore, the first The specific processing procedure for each inverse residual module is as follows: First, perform dimension-up convolution, using 1×1 convolution to increase the number of channels. ,in, For the first The up-dimensional feature map is obtained by performing a 1×1 up-dimensional convolution on each inverse residual module; For the first The input feature maps of each inverse residual module are used; depthwise convolution is used to convolve the feature values ​​in each channel separately, and local changes in different residual response modes are extracted to obtain high-dimensional features. Finally, a linear bottleneck layer is used to compress the high-dimensional features back to low dimensions, yielding the residual response feature map. When the input and output feature sizes are the same and the step size is 1, add a residual connection: ,in, For the first The transformed output feature map obtained after processing the inverse residual module by the linear bottleneck layer; For the first The input feature map of each inverted residual module.

[0014] Furthermore, the specific processing procedure of S504 is as follows: S5041: Context vector of environmental intervention Coupling coefficient with residual response to environmental intervention By concatenating the vectors and combining the parameters of the environment coding layer with the activation function, the loop residual embedding vector is obtained. : ; in, This is the activation function. The environment coding layer weight matrix, This is the bias vector for the environment coding layer.

[0015] S5042: Based on ring residual embedding vector Calculate the generation channel modulation weights The calculation process is as follows: ; in, Represents the Sigmoid function; The weight matrix for the channel modulation weight generation layer; This is the bias vector for the channel modulation weight generation layer.

[0016] S5043: Feature map modulation layer is based on the generated modulation weights and residual response feature maps of each channel. Modulation is performed using the modulation forcing coefficient to generate a residual response feature map after environmental modulation. Let the residual response characteristic map be: ; This represents the residual response feature map output by the MobileNetV2 inverse residual module and the up-dimensional convolutional layer; Indicates the feature map height. Indicates the width of the feature map. This indicates the number of channels in the feature map.

[0017] Among them, the c-th channel after modulation is at position The eigenvalues ​​at this location are: ; in, Characteristic map after modulation In the c-th channel, at position Eigenvalues ​​at; Representing the residual response feature map In the c-th channel, at position The original feature map at the location; This represents the environmental modulation weight of the c-th channel; This represents the modulation forcing coefficient.

[0018] Furthermore, in step S6, the context information is encoded to obtain a context embedding vector. The specific process is as follows: ; ; ; in, , Indicates an intermediate hidden layer; Represents the context embedding vector; Indicates the activation function; , , Represents the weight matrix; , , The bias vector for the context encoding network.

[0019] Furthermore, in S7, the context embedding vector is utilized. Residual response characteristics of MobileNetV2 output after power failure Context-gated modulation is performed to obtain the residual response depth features after context modulation. The process is as follows: ; ; in, Indicates context-gating weights; Represents the Sigmoid function; This is the weight matrix of the context-gated mapping layer; This is the weight matrix of the context-gated mapping layer; This represents the depth features of the residual response after context modulation. This indicates element-wise multiplication.

[0020] The formula for calculating the feature center of the normal residual response under the current context is: ; in: It is the feature center of the normal residual response under the current context conditions; Context embedding vector; , For the parameters of the center mapping layer; Context-aware anomaly scoring The calculation formula is: ; in, Scoring for context-aware anomalies; These are residual response features after context modulation; The feature center of the normal residual response under the current context; The square of the L2 distance is used to measure the degree of deviation between the current residual response depth feature and the center of the normal residual response feature.

[0021] Furthermore, the specific process of S8 is as follows: S801: The electrical regulation evidence obtained includes evidence of residual admittance after the relay is disconnected. Evidence of residual current area at the tail end Evidence of residual voltage energy Evidence of residual current-residual voltage coupling Evidence of historical deviation ; S802: Constructing an Evidence Vector for Electrical Rules : ; S803: Risk Assessment of Electricity Theft via Connection Retrieval The calculation formula is: ; in, For the Sigmoid function; The weight matrix for the risk scoring fusion layer; This is the bias vector of the risk scoring fusion layer.

[0022] S804: Issue a shared power terminal action execution command based on the action threshold range corresponding to the bypass electricity theft risk score; wherein, the shared power terminal action execution command is based on the bypass electricity theft risk score. With preset threshold , Risk level assessment of the relationship: ; in, The threshold for medium risk. It is a high-risk threshold, and < .

[0023] Secondly, the present invention provides an anti-theft system for QR code-based shared power equipment, the system being used to perform the steps of the method described above, including: Session End Judgment Module: Continuously acquires electricity metering, fee control, and status monitoring data during the user's QR code-based shared electricity session, and determines whether the session end conditions are met; when the session end conditions are met, it generates session end safety status information, sends a disconnect command to the corresponding port relay, and confirms whether the relay has been reliably disconnected; The environmental intervention residual response coupling coefficient acquisition module establishes a power outage residual acquisition window and a power outage environment measurement window to acquire residual current and residual voltage on the authorized port's total input side, as well as surrounding environmental information. It then constructs an environmental intervention context vector to obtain the environmental intervention residual response coupling coefficient. ; The three-channel power-off residual response spectrum acquisition module: standardizes the residual current and residual voltage, calculates the residual admittance, constructs residual current correlation graphs, residual voltage correlation graphs and residual admittance correlation graphs respectively, and stacks them to obtain the three-channel power-off residual response spectrum; Power outage residual response feature acquisition module: Input the three-channel power outage residual response map into the improved MobileNetV2 network to obtain the power outage residual response features; Context-aware anomaly scoring acquisition module: Acquires session context, port context, relay and control context, and historical baseline context; constructs context information; and encodes the context information to obtain a context embedding vector. ; Context-gated modulation of the residual response features after power outage based on context embedding vectors yields deep features of the residual response. And generate the feature centers of the normal residual response under the current context conditions. ,according to and The distance between them is used to obtain a context-aware anomaly score. ; Shared power terminal action execution instruction generation module: acquires electrical rule evidence data and constructs electrical rule evidence vectors. , combined , , and Calculate the risk score for electricity theft through wire looping; and issue action execution instructions for shared power terminals based on the action threshold range corresponding to the risk score for electricity theft through wire looping.

[0024] This invention proposes a method and system for preventing electricity theft in QR code-based shared power equipment. Compared with existing technologies, the method has the following advantages:

[0025] (1) The present invention extends the detection time from the normal power supply operation period to the power outage recovery period after the QR code shared power session ends and the relay is disconnected. It can capture whether the port has truly entered a safe idle state, thus making it more suitable for identifying the risks of bypass power supply, abnormal parallel connection, external energy storage reverse power supply and relay bypass after the session ends.

[0026] (2) This invention no longer uses instantaneous power, cumulative power or load curve as the detection basis, but collects residual current and residual voltage after power failure, and constructs residual current correlation diagram, residual voltage correlation diagram and residual admittance correlation diagram to form a three-channel residual response spectrum after power failure, so that the one-dimensional residual sequence after power failure has a structured expression that is adapted to image-type lightweight deep network.

[0027] (3) The present invention uses MobileNetV2 as a lightweight deep feature extraction network. An environmental intervention residual response modulation layer is added between the MobileNetV2 inverse residual feature extraction layer and the global average pooling layer. This modulation layer introduces the environmental residual response coupling coefficient of the scanning terminal into the feature extraction process, dynamically adjusts the importance of different channel features of the residual response spectrum, thereby improving the model's ability to distinguish between human intervention-type wire theft and natural environmental disturbance-type residual anomalies.

[0028] (4) The present invention introduces a context-aware reasoning module, which dynamically generates normal residual response feature centers based on session state, port historical baseline, relay feedback, historical anomaly score, communication state and environment state, and modulates deep features based on context gating to avoid false alarms caused by fixed thresholds and single deep feature judgments. Attached Figure Description

[0029] 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, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a flowchart of a method for preventing electricity theft using QR code-based shared power equipment, provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the changes in residual current and residual voltage under different operating conditions provided in the embodiments of the present invention; wherein, Figure 2 (a) is a schematic diagram of the residual current change curve after power failure; Figure 2 (b) is a schematic diagram of the residual voltage change curve after power failure. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0032] Example 1

[0033] like Figure 1 As shown, this embodiment provides a method for preventing electricity theft from QR code-based shared power equipment, including the following steps: S1: Continuously acquire electricity metering, cost control, and status monitoring data during the user's QR code-based shared electricity session, and determine whether the session termination conditions are met.

[0034] In practice, the QR code-based shared electricity terminal manages each complete user QR code-based authorization process as an independent session. A session refers to a user initiating an electricity request by scanning a QR code, which, after cloud authentication and authorization, controls the corresponding port relay to close and start supplying power, while simultaneously performing metering, fee control, and status monitoring until the electricity usage ends.

[0035] Specifically, users first scan the QR code on the shared power terminal using their mobile devices to initiate a power request to the cloud platform. After receiving the user's identity information, port information, and fee information, the shared power terminal performs identity verification, port availability verification, and payment status verification. When identity authentication is successful and the port is in an allocable state, the terminal generates session information and establishes a session record. After successful session establishment, the terminal controls the corresponding port's relay to close, entering normal power supply operation. During session operation, the terminal collects port operating current, operating voltage, instantaneous power, cumulative power consumption, relay status, port status, communication status, and local fee control status at a preset sampling frequency to complete routine metering and fee control (i.e., deducting fees or updating balances based on real-time power consumption). The terminal continuously determines whether the session termination conditions are met during session operation.

[0036] More specifically, during the session, the session is considered to be terminated when any one of the following conditions is met: the user actively ends the electricity use, the prepaid balance is exhausted, the cloud platform issues a remote prepaid power-off command, or the terminal detects an abnormal state and triggers a safety protection power-off.

[0037] S2: When the session termination condition is met, generate session termination security status information, send a disconnect command to the corresponding port relay, and confirm whether the relay has been reliably disconnected.

[0038] In practice, when the terminal determines that the session termination conditions are not met, the session continues to run, and the terminal continues to perform metering, fee control, and status monitoring. When the terminal determines that the session termination conditions are met, it generates session termination safety status information; subsequently, the terminal controls the corresponding port relay to disconnect and reads the relay auxiliary contact feedback, output port status feedback, or related voltage feedback information to confirm whether the relay has reliably disconnected. If the relay has not reliably disconnected, the terminal issues a power outage abnormality warning and prohibits the port from being released immediately; if the relay is confirmed to have reliably disconnected, the subsequent power outage residual response detection stage begins.

[0039] More specifically, the session end security status information includes: session number, user ID, port number, session end time, power outage reason, final metering value, balance status, relay control status, and communication status.

[0040] S3: After confirming that the relay is reliably disconnected, establish a power outage residual acquisition window and a power outage environment measurement window to obtain residual current and residual voltage on the total input side of the authorized port, surrounding environment information, construct an environmental intervention context vector, and form a power outage residual current-voltage joint sequence and an environmental intervention residual response coupling coefficient.

[0041] Once the shared power session meets the termination conditions, the shared power terminal sends a disconnect control command to the corresponding port relay, causing the authorized port to stop supplying power. After sending the disconnect control command, the terminal reads the status of the relay auxiliary contacts to confirm whether the relay has reliably disconnected. If the relay feedback status indicates that the power supply circuit has been disconnected, and the port output status meets the power outage conditions, the terminal confirms that the relay has reliably disconnected and enters the stage of collecting residual current and voltage after the power outage.

[0042] S301: After the relay is confirmed to be disconnected, the shared power terminal establishes a residual acquisition window to collect residual current and residual voltage information during the process of the port recovering from the power supply operation state to the safe idle state.

[0043] Define the power outage residual acquisition window as follows: ; in, This is the data acquisition window for residual data after a power outage; The moment the relay disconnects; This is the length of the data acquisition window after a power outage.

[0044] Within the residual current acquisition window after a power outage, the terminal acquires the residual current and residual voltage at the port at a sampling frequency higher than that during normal operation, forming a combined residual current-voltage sequence after the power outage: ; in, This represents the residual current-voltage joint sequence after power failure; Indicates the first The residual current at each sampling point Indicates the first The residual voltage at each sampling point; Indicates the number of sampling points.

[0045] S302: The terminal establishes a power outage environment measurement window to collect surrounding environmental information during the recovery process from the power-on operation state to the safe idle state. This surrounding environmental information includes human intervention information and environmental influencing factors. Human intervention information includes the status of the protective cover being open. Vibration state Abnormal posture Abnormal lighting conditions Environmental influencing factors include the status of personnel presence. Abnormal temperature conditions .

[0046] Define the measurement window for power outage environments as follows: ; in, For environmental measurement window; Indicates the reference time of the environment before the power outage; The moment the relay disconnects; This is the length of the data acquisition window after a power outage.

[0047] Protective cover open = ; Vibration state = ; abnormal posture = ,in, This refers to the tilt angle of the corresponding port module relative to ground. To install the reference angle, The threshold for angle change; Personnel stationing status = ; Abnormal lighting conditions = ,in, This is the current illumination value. As the reference value for illumination, The illumination threshold; abnormal temperature conditions = ; Constructing environmental intervention context vectors : .

[0048] S303: Calculate human intervention factors based on the acquired surrounding environmental information. Environmental Influencing Factors Furthermore, the coupling coefficient of the residual response to environmental intervention was calculated. ; Among them, human intervention factors Environmental Influencing Factors The calculation formula is: ; ; in, The weighting of various information items by human intervention; All of these represent the weights of each item in the environmental impact information.

[0049] Environmental intervention residual response coupling coefficient The calculation formula is: ; in, This indicates that the weighting was manipulated manually. This indicates the weighting of natural intervention adjustments.

[0050] S4: Standardize the residual current and residual voltage, calculate the residual admittance based on the residual current and residual voltage, construct the residual current correlation diagram, residual voltage correlation diagram and residual admittance correlation diagram respectively, and stack the residual current correlation diagram, residual voltage correlation diagram and residual admittance correlation diagram into a three-channel power-off residual response spectrum.

[0051] S401: The acquired residual current and residual voltage are standardized to eliminate amplitude differences caused by different ports, different sampling environments and different ranges, and the residual admittance is further calculated. Among them, the The formula for calculating the standardized residual current at each sampling point is: ; No. The formula for calculating the standardized residual voltage at each sampling point is: ; in, This represents the standardized residual current; This represents the standardized residual voltage; , These represent the average residual current and residual voltage, respectively. , These represent the standard deviations of residual current and residual voltage, respectively. This represents a small constant to prevent the denominator from being zero.

[0052] The formula for calculating residual admittance based on residual current and residual voltage is as follows: ; in, Residual admittance indicates the residual admittance after power failure. Residual admittance is used to characterize whether the relay port still has electrical coupling with external load paths, abnormal wiring channels, or energy storage devices after the relay is disconnected.

[0053] S402: The terminal constructs the residual current correlation diagram, residual voltage correlation diagram, and residual admittance correlation diagram respectively: ; ; ; in, Indicates the residual current in the first... The sampling point and the first The difference between each sampling point; Indicates the residual voltage at the 1st The sampling point and the first The difference between each sampling point; Indicates the residual admittance in the first... The sampling point and the first The difference between sampling points. By setting sampling points on both the horizontal and vertical axes, the one-dimensional data sequence is transformed into a two-dimensional map. Each pixel represents the difference between two sampling points. If the residual response changes smoothly, the map texture is relatively regular; if there are abnormal tails, abrupt changes, or persistent coupling, the map texture will show abnormal structures.

[0054] S403: Stacks the residual current correlation diagram, residual voltage correlation diagram, and residual admittance correlation diagram into a three-channel power-off residual response spectrum: ; in, This represents the residual response spectrum after a power outage. This indicates a channel stacking operation.

[0055] This step converts the one-dimensional residual current and voltage sequences into a two-dimensional graph, enabling it to be adapted for lightweight deep feature extraction using the MobileNetV2 network. This graph simultaneously contains the residual current variation relationship, the residual voltage variation relationship, and the residual admittance coupling relationship. Specifically, the first channel is the residual current correlation graph, the second channel is the residual voltage correlation graph, and the third channel is the residual admittance correlation graph. Based on these conditions, MobileNetV2 can process the power-off residual response graph in the same way as a three-channel image.

[0056] S5: Input the three-channel power outage residual response map into the improved MobileNetV2 network to obtain the power outage residual response characteristics. The improved MobileNetV2 network includes an input layer, convolutional layers, multiple cascaded inverse residual modules, an environmental intervention residual response modulation layer, a global average pooling layer, and an output layer. The environmental intervention residual response modulation layer includes an environmental input layer, an environmental coding layer, a channel modulation weight generation layer, a feature map modulation layer, and a modulation feature output layer. The specific process is as follows: S501: Three-channel power-off residual response graph The input is an improved MobileNetV2 network; specifically, in this embodiment, the input layer receives a power-off residual response spectrum with a size of 224×224×3, i.e. ; S502: Three-channel power-off residual response spectrum of the input obtained through a convolutional layer. Preliminary feature extraction is performed to obtain preliminary feature vectors. In this specific implementation, the initial convolutional layer uses a 3×3 convolutional kernel, a stride of 2, and 32 output channels to extract the basic texture features of the residual response map after power failure. The initial feature vector... : .

[0057] Convolutional layers primarily extract basic texture features from residual response maps, namely residual current change edges, residual voltage abrupt change regions, local anomalies in residual admittance, and striped, blocky, or tail-like structures in the map.

[0058] S503: Initial feature vector By inputting multiple cascaded inverse residual modules, the residual response feature map is obtained. Among them, the first The specific processing procedure for each inverse residual module is as follows: First, perform dimension-up convolution, using 1×1 convolution to increase the number of channels. The input residual response map is expanded to a higher-dimensional space to give the model sufficient expressive power. Then, depthwise convolution is used to convolve the features in each channel separately without mixing them, extracting local changes in different residual response modes to obtain high-dimensional features. Finally, a linear bottleneck layer is used to compress the high-dimensional features back to low dimensions, yielding the residual response feature map. The linear bottleneck layer is the one in MobileNetV2. A linear convolutional projection layer, which does not use a non-linear activation function during the channel compression stage, is used to avoid non-linear truncation of effective residual response information in low-dimensional bottleneck features. Strong non-linear activation is avoided to prevent the destruction of low-dimensional features. Residual connections are added when the input and output feature sizes are the same and the stride is 1. ,in Indicates the first The transformed output feature map is obtained after processing the inverse residual modules through dimensionality-up convolution, depthwise convolution, and a linear bottleneck layer. In this specific implementation, the network is set up with seven groups of inverse residual bottleneck modules in sequence. The parameters of the seven groups of inverse residual bottleneck modules are (t=1,c=16,n=1,s=1), (t=6,c=24,n=2,s=2), (t=6,c=32,n=3,s=2), (t=6,c=64,n=4,s=2), (t=6,c=96,n=3,s=1), (t=6,c=160,n=3,s=2), and (t=6,c=320,n=1,s=1); where t represents the channel expansion factor, c represents the number of output channels, n represents the number of module repetitions, and s represents the stride of the first inverse residual bottleneck module in the group. After extracting the inverse residual bottleneck module, the network increases the number of feature channels to 1280 through 1×1 up-dimensional convolution.

[0059] S504: Residual response feature map Environmental intervention residual response coupling coefficient and environmental intervention context vector The input environment is used to modulate the residual response layer, and the modulated feature map is obtained. The specific processing procedure is as follows: S5041: The environmental input layer will use the environmental intervention context vector Coupling coefficient with residual response to environmental intervention The input vector is concatenated to obtain the environmental modulation input vector. The environment coding layer modulates the environment input vector. Mapping yields the ring residual embedding vector : ; ; in, This is the activation function. The environment coding layer weight matrix, This is the bias vector for the environment coding layer. The function of this layer is to encode the discrete environment state and the coupling coefficient of the continuous environment into an embedded representation that can be used for feature modulation.

[0060] S5042: Channel modulation weight generation layer based on loop residual embedding vector Calculate the generation channel modulation weights The calculation process is as follows: ; in, Represents the Sigmoid function; The weight matrix for the channel modulation weight generation layer; This is the bias vector for the channel modulation weight generation layer. If the residual response feature map... The number of channels is ,but ; This represents the environmental modulation weight corresponding to the c-th channel. This represents the number of channels in the residual response feature map.

[0061] S5043: Feature map modulation layer is based on the generated modulation weights and residual response feature maps of each channel. Modulation is performed using the modulation forcing coefficient to generate a residual response feature map after environmental modulation. Let the residual response characteristic map be: ; This represents the residual response feature map output by the MobileNetV2 inverse residual module and the up-dimensional convolutional layer; Indicates the feature map height. Indicates the width of the feature map. This indicates the number of channels in the feature map.

[0062] The characteristic value of the modulated c-th channel at position (h, w) is: ; in, Characteristic map after modulation The feature value at position (h, w) in the c-th channel; Representing the residual response feature map The original feature map at position (h, w) in the c-th channel; This represents the environmental modulation weight of the c-th channel; This represents the modulation forcing coefficient.

[0063] S505: Modulate the feature map Inputting the global average pooling layer yields the residual response characteristics after power failure. Finally, the output layer outputs: ; in, This is global average pooling.

[0064] S6: Get Session Context Port context Relays and Control Context and historical baseline context Build context information Encoding the context information yields the context embedding vector. : ; in, The session context includes session duration, cumulative electricity consumption, average power, reason for power outage, and billing status. In practice, if a user uses the power for a very short time with very low power consumption, the residual response after a power outage should typically be weak. If a user's session duration is long, cumulative electricity consumption is high, and average power is high, a brief residual response after a power outage may be abnormal. Therefore, the session context is used to determine whether the current residual response matches the scale of the current electricity consumption session.

[0065] Port context refers to the port number, historical alarm count, and most recent risk level. Different ports may have different hardware aging levels, wiring conditions, and sensor noise levels. In practice, if a port has a high historical alarm count or a high recent risk level, the same residual response should be assigned a higher risk weight in the current detection. Therefore, port context is used to determine whether the current residual response deviates from the port's historical normal state.

[0066] This indicates the relay and control context, including relay feedback state, action delay, number of actions, and local control state. In practice, if the relay fails to reliably disconnect, the subsequently acquired residual current and voltage cannot be interpreted as a residual response after a power outage. If the relay has disconnected, but residual current, residual voltage, or residual admittance persists, the risk is even higher. Therefore, the relay context is used to determine whether the current residual response occurred after the actual power outage.

[0067] This section represents the historical baseline context, including the mean and standard deviation of historical normal / abnormal scores, residual admittance, and recovery time. This part essentially creates a normal power outage recovery profile for each port.

[0068] The context embedding vector is obtained after encoding: ; ; ; in, , Indicates an intermediate hidden layer; Represents the context embedding vector; Indicates the activation function; , , Represents the weight matrix; , , The bias vector for the context encoding network.

[0069] S7: Context-based embedding vectors Residual response characteristics after power failure Context-gated modulation is performed to obtain the residual response depth features after context modulation. And generate the feature centers of the normal residual response under the current context conditions. Based on the depth characteristics of the modulated residual response With the characteristic center of normal residual response The distance between them is used to obtain a context-aware anomaly score.

[0070] Specifically, using context embedding vectors Residual response characteristics of MobileNetV2 output after power failure The process of obtaining the residual response depth features after context-gated modulation is as follows: ; ; in, Indicates context-gating weights; Represents the Sigmoid function; This is the weight matrix of the context-gated mapping layer; This is the weight matrix of the context-gated mapping layer; This represents the depth features of the residual response after context modulation. This represents element-wise multiplication. Here... and The dimensions are consistent, indicating the weight adjustment for each feature channel of MobileNetV2.

[0071] Specifically, the formula for calculating the feature center of the normal residual response under the current context is as follows: ; in: It is the feature center of the normal residual response under the current context conditions; Context embedding vector; , For the center mapping layer parameters. The center represents the location of the residual response in the feature space under the conditions of the current port, current session, current power outage reason, and current relay state. In the safety protection power outage scenario, It will allow for a stronger short-term residual response than if the user had actively terminated the response.

[0072] Context-aware anomaly scoring The calculation formula is: ; in, Scoring for context-aware anomalies; These are residual response features after context modulation; The feature center of the normal residual response under the current context; The square of the L2 distance is used to measure the deviation between the current residual response depth feature and the center of the normal residual response feature. This step enables the system to dynamically adjust the anomaly judgment criteria based on different ports, different power outage reasons, different historical baselines, and different communication environments, avoiding misjudgments caused by fixed thresholds or a single depth feature. A smaller residual response indicates that the current residual response is close to the normal power outage recovery mode in the current scenario; if A large value indicates that the current residual response deviates from the normal power outage recovery mode in the current scenario.

[0073] S8: Obtain electrical rule evidence data and construct electrical rule evidence vectors Combining context-aware anomaly scoring Depth characteristics of the modulated residual response Context embedding vector Coupling coefficient with residual response to environmental intervention Calculate the risk score for electricity theft through wire looping; and issue action execution instructions for the shared power terminal based on the action threshold range corresponding to the risk score for electricity theft through wire looping.

[0074] S801: The electrical rule evidence obtained includes evidence of residual admittance after relay disconnection, evidence of residual current area at the tail, evidence of residual voltage energy, evidence of residual current-residual voltage coupling, and evidence of historical deviation.

[0075] Residual admittance evidence after relay disconnection Represented as: ; in, This is an indicator function that takes the value 1 when the condition inside the parentheses is true, and 0 otherwise. This indicates that the relay feedback state is open. This is the residual admittance.

[0076] Evidence of residual current area at the tail Represented as: ; ; in, The area of ​​the residual current at the tail end. Indicates the first The residual current at each sampling point This indicates the starting sampling point number of the tail detection interval. This indicates the total number of sampling points within the residual acquisition window after a power outage.

[0077] Evidence of residual voltage energy Represented as: ; ; in, For residual voltage energy, Indicates the first The residual voltage at each sampling point This indicates the total number of sampling points within the residual acquisition window after a power outage.

[0078] Evidence of residual current-residual voltage coupling Represented as: ; ; in, This is the correlation coupling coefficient between residual current and residual voltage. , These represent the mean values ​​of the residual current sequence and the residual voltage sequence, respectively. To prevent extremely small positive numbers with a denominator of 0.

[0079] Evidence of historical deviation Represented as: ; in, The mean of the context-aware anomaly score for the historical normal power outage samples of the corresponding port. The standard deviation of the context-aware anomaly score for the corresponding port's historical normal power outage samples; To prevent extremely small positive numbers with a denominator of 0; Scoring for context-aware anomalies; S802: Constructing an Evidence Vector for Electrical Rules : ; S803: Risk Assessment of Electricity Theft via Connection Retrieval The calculation formula is: ; in, For the Sigmoid function; The weight matrix for the risk scoring fusion layer; This is the bias vector for the risk scoring fusion layer. (This refers to the risk scoring for electricity theft via wire looping.) It integrates the deep features of the residual power failure response output by MobileNetV2 with the corresponding spectral features, environmental impact level, contextual condition judgment, and electrical rule evidence into a unified risk value for subsequent risk level determination.

[0080] S804: Issue a shared power terminal action execution command based on the action threshold range corresponding to the bypass electricity theft risk score; the shared power terminal action execution command is based on the bypass electricity theft risk score. With preset threshold , Risk level assessment of the relationship: ; in, The threshold for medium risk. It is a high-risk threshold, and < .

[0081] when When the action is executed, the charging position is released to restore safe power supply, that is, the port has been restored to a safe idle state, the port is released and the next user is allowed to scan the code to establish a new power session; when At the same time, the action execution instruction is to delay the release of the charging position and keep it closely monitored. That is, the terminal does not release the port immediately, but delays the release of the port, extends the detection window, increases the sampling frequency, and generates a minor anomaly record. when When the action is executed, the command is to lock the charging position and report it. The terminal performs port locking, secondary power-off, prohibits the start of the next session, and reports it.

[0082] To further illustrate the feasibility of the anti-theft method for QR code-based shared power equipment described in this invention, this embodiment constructs a set of simulation data on residual power outage responses after the end of a QR code-based shared power usage session. The simulation object is a multi-port QR code-based shared power terminal. After each QR code-based shared power usage session ends and the relay is confirmed to be disconnected, the terminal enters the residual power outage acquisition window to collect residual current, residual voltage, and environmental status information, and constructs a three-channel residual power outage response spectrum based on the residual current, residual voltage, and residual admittance.

[0083] In this embodiment, the residual power outage sampling window length is set to 2 seconds, and the sampling frequency is 1000 Hz, meaning that 2000 residual current and residual voltage sampling points are generated after each session. To simulate the different states of actual QR code-based shared power terminals after a session, five typical scenarios are set: normal power outage, bypass power supply, external energy storage reverse power supply, relay bypass, and temperature environmental disturbance. Table 1 shows the settings for the five residual power outage response simulation scenarios in this embodiment.

[0084] Table 1 Simulation Scenarios of Five Types of Residual Responses After Power Outage

[0085] Among them, the normal power outage scenario is used to simulate the rapid decay of residual current and residual voltage at the port to a safe idle state after the relay is disconnected; the bypass power supply scenario is used to simulate the situation where residual current and residual admittance still exist after the session ends; the external energy storage reverse power supply scenario is used to simulate the situation where residual voltage at the port continues to exist after a power outage; the relay bypass scenario is used to simulate the situation where the relay feedback is disconnected but there is still an abnormal electrical path at the port; and the temperature environment disturbance scenario is used to simulate the situation where abnormal temperature causes a slight increase in residual response, but there is no obvious human intervention.

[0086] In the simulation, residual current and residual voltage are generated using an exponential decay model. Under normal power outage scenarios, residual current and residual voltage decay rapidly; under scenarios involving bypass power extraction and external energy storage, a tail-end residual term is superimposed on top of the exponential decay term; under relay bypass scenarios, the port maintains relatively high residual current and residual voltage even after the relay is disconnected; under temperature disturbance scenarios, the abnormal temperature state is high, but human intervention characteristics such as protective cover opening, vibration, abnormal posture, abnormal lighting, and personnel presence are low. Schematic diagrams of residual current and residual voltage changes under different operating conditions are shown below. Figure 2 As shown: Among them, Figure 2 (a) is a schematic diagram of the residual current change curve after power failure; Figure 2 (b) is a schematic diagram of the residual voltage change curve after power failure.

[0087] In a set of simulation examples, the recognition performance of three methods is compared: the first method is a detection method that uses only residual current, residual voltage, and residual admittance rule features; the second method is a detection method that uses a three-channel power-off residual response spectrum and a standard MobileNetV2 network; and the third method is a detection method that uses a three-channel power-off residual response spectrum, an improved MobileNetV2 network, and the residual response coupling coefficient of the barcode scanning terminal environment intervention.

[0088] Simulation results show that the detection method using regular features can identify obvious relay bypasses and bypass power supply, but it is prone to false alarms in temperature-related environmental disturbance scenarios. After adopting the standard MobileNetV2 network, the system has a stronger ability to identify tailing, abrupt changes, and persistent admittance features in the residual response spectrum. By further adding the environmental intervention-residual response coupling coefficient of the barcode scanning terminal and the environmental intervention residual response modulation layer, the system can dynamically adjust the residual response feature weights according to the protective cover opening status, vibration status, abnormal posture status, abnormal lighting status, personnel presence status, and abnormal temperature status, thereby further improving the accuracy of anomaly identification and reducing the false alarm rate in temperature-related environmental disturbance scenarios.

[0089] Table 2. Results of three simulation processes

[0090] As shown in Table 2, when using rule features alone, the system has a certain ability to identify obvious residual current tails and relay bypasses. However, due to the lack of consideration for environmental factors, it is prone to false alarms due to residual response increases caused by temperature anomalies. The standard MobileNetV2 method extracts texture features from the three-channel power-off residual response map, which can significantly improve the overall recognition accuracy. Furthermore, the improved MobileNetV2 method introduces a coupling coefficient for residual response under environmental intervention at the barcode scanning terminal and sets an environmental intervention residual response modulation layer between the inverse residual feature extraction layer and the global average pooling layer, enabling the model to dynamically modulate the residual response features under different environmental conditions. Therefore, this method improves the anomaly recall rate and overall accuracy while maintaining a low false alarm rate, indicating that the present invention can more effectively distinguish between human intervention-related bypass electricity theft risks and environmental disturbance-related residual anomalies.

[0091] Example 2

[0092] This embodiment provides an anti-theft system for QR code-based shared power equipment. The system is used to perform the steps of the method described above, including: Session End Judgment Module: Continuously acquires electricity metering, fee control, and status monitoring data during the user's QR code-based shared electricity session, and determines whether the session end conditions are met; when the session end conditions are met, it generates session end safety status information, sends a disconnect command to the corresponding port relay, and confirms whether the relay has been reliably disconnected; The environmental intervention residual response coupling coefficient acquisition module establishes a power outage residual acquisition window and a power outage environment measurement window to acquire residual current and residual voltage on the authorized port's total input side, as well as surrounding environmental information. It then constructs an environmental intervention context vector to obtain the environmental intervention residual response coupling coefficient. ; The three-channel power-off residual response spectrum acquisition module: standardizes the residual current and residual voltage, calculates the residual admittance, constructs residual current correlation graphs, residual voltage correlation graphs and residual admittance correlation graphs respectively, and stacks them to obtain the three-channel power-off residual response spectrum; Power outage residual response feature acquisition module: Input the three-channel power outage residual response map into the improved MobileNetV2 network to obtain the power outage residual response features; Context-aware anomaly scoring acquisition module: Acquires session context, port context, relay and control context, and historical baseline context; constructs context information; and encodes the context information to obtain a context embedding vector. ; Context-gated modulation of the residual response features after power outage based on context embedding vectors yields deep features of the residual response. And generate the feature centers of the normal residual response under the current context conditions. ,according to and The distance between them is used to obtain a context-aware anomaly score. ; Shared power terminal action execution instruction generation module: acquires electrical rule evidence data and constructs electrical rule evidence vectors. , combined , , and Calculate the risk score for electricity theft through wire looping; and issue action execution instructions for shared power terminals based on the action threshold range corresponding to the risk score for electricity theft through wire looping.

[0093] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.

[0094] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for preventing electricity theft in QR code-based shared power equipment, characterized in that, include: S1: Continuously acquire electricity metering, cost control, and status monitoring data during the user's QR code-based shared electricity session, and determine whether the session termination conditions are met; S2: When the session termination condition is met, generate session termination security status information, send a disconnect command to the corresponding port relay, and confirm whether the relay has been reliably disconnected; S3: Establish a residual current acquisition window and a residual current environment measurement window for power outages, acquire residual current and residual voltage on the total input side of the authorized port, and obtain surrounding environmental information. Construct an environmental intervention context vector and obtain the environmental intervention residual response coupling coefficient. ; S4: Standardize the residual current and residual voltage, calculate the residual admittance, construct the residual current correlation diagram, residual voltage correlation diagram and residual admittance correlation diagram respectively, and stack them to obtain the three-channel power-off residual response spectrum; S5: Input the three-channel power outage residual response map into the improved MobileNetV2 network to obtain the power outage residual response characteristics; S6: Obtain the session context, port context, relay and control context, and historical baseline context; construct context information; and encode the context information to obtain the context embedding vector. ; S7: Obtain deep features of residual response by performing context-gated modulation on the residual response features after power failure based on the context embedding vector. And generate the feature centers of the normal residual response under the current context conditions. ,according to and The distance between them is used to obtain a context-aware anomaly score. ; S8: Obtain electrical rule evidence data and construct electrical rule evidence vectors , combined , , and Calculate the risk score for electricity theft through wire looping; It also issues action execution instructions for shared power terminals based on the action threshold range corresponding to the risk score of electricity theft through bypassing connections.

2. The method according to claim 1, characterized in that, In S1, during the session, the session termination condition is met when any one of the following conditions is met: the user actively ends the electricity use, the prepaid balance is exhausted, the cloud platform issues a remote fee control power-off command, or the terminal detects an abnormal state and triggers a safety protection power-off.

3. The method according to claim 1, wherein the specific process of step S3 is as follows: S301: After the relay is confirmed to be disconnected, a residual acquisition window is established to obtain residual current and residual voltage information during the process of the port recovering from the power supply operation state to the safe idle state; S302: Establish a power outage environment measurement window to collect surrounding environmental information during the recovery process from a powered operation state to a safe idle state at the port; among which... Surrounding environmental information includes information on human interventions and environmental impact factors. Among these, information on human interventions includes the status of the protective cover being open. Vibration state Abnormal posture Abnormal lighting conditions Environmental influencing factors include the status of personnel presence. Abnormal temperature conditions ; S303: Calculate human intervention factors based on the acquired surrounding environmental information. Environmental Influencing Factors Furthermore, the coupling coefficient of the residual response to environmental intervention was calculated. ; Among them, human intervention factors Environmental Influencing Factors The calculation formula is: ; ; in, The weighting of various information items for human intervention; All of these represent the weights of each item in the environmental impact information; Environmental intervention residual response coupling coefficient The calculation formula is: ; in, This indicates that the weighting was manipulated by humans. This indicates the weighting of natural intervention adjustments.

4. The method according to claim 1, characterized in that, The specific process of S4 is as follows: S401: Standardize the acquired residual current and residual voltage, and further calculate the residual admittance; Among them, the The formula for calculating the standardized residual current at each sampling point is: ; No. The formula for calculating the standardized residual voltage at each sampling point is: ; in, This represents the standardized residual current; This represents the standardized residual voltage; , These represent the average residual current and residual voltage, respectively. , These represent the standard deviations of residual current and residual voltage, respectively. It is a constant; The formula for calculating residual admittance based on residual current and residual voltage is as follows: ; in, Indicates the residual admittance after power failure; S402: The terminal constructs the residual current correlation diagram, residual voltage correlation diagram, and residual admittance correlation diagram respectively: ; ; ; in, Indicates the residual current in the first... The sampling point and the first The difference between each sampling point; Indicates the residual voltage at the 1st The sampling point and the first The difference between each sampling point; Indicates the residual admittance in the first... The sampling point and the first The difference between each sampling point; S403: Stack the residual current correlation diagram, residual voltage correlation diagram and residual admittance correlation diagram into a three-channel power-off residual response spectrum.

5. The method according to claim 1, characterized in that, The specific process of S5 is as follows: S501: Three-channel power-off residual response graph Input to an improved MobileNetV2 network; S502: Three-channel power-off residual response spectrum of the input obtained through a convolutional layer. Preliminary feature extraction is performed to obtain preliminary feature vectors. ; S503: Initial feature vector By inputting multiple cascaded inverse residual modules, the residual response feature map is obtained. ; S504: Residual response feature map Environmental intervention residual response coupling coefficient and environmental intervention context vector The input environment is used to modulate the residual response layer, and the modulated feature map is obtained. ; S505: Modulate the feature map Entering the global average pooling layer, the residual response characteristics after power failure are obtained. Finally, the output layer outputs: ; in, This is global average pooling.

6. The method according to claim 5, characterized in that, No. The specific processing procedure for each inverse residual module is as follows: First, perform dimension-up convolution, using 1×1 convolution to increase the number of channels: ,in, For the first The up-dimensional feature map is obtained by performing a 1×1 up-dimensional convolution on each inverse residual module; For the first The input feature maps of each inverse residual module are used; depthwise convolution is used to convolve the feature values ​​in each channel separately, and local changes in different residual response modes are extracted to obtain high-dimensional features. Finally, a linear bottleneck layer is used to compress the high-dimensional features back to low dimensions, yielding the residual response feature map. When the input and output feature sizes are the same and the step size is 1, add a residual connection: ,in, For the first The transformed output feature map obtained after processing the inverse residual module by the linear bottleneck layer; For the first The input feature map of each inverted residual module.

7. The method according to claim 5, characterized in that, The specific processing procedure of S504 is as follows: S5041: Context vector of environmental intervention Coupling coefficient with residual response to environmental intervention By concatenating the vectors and combining the parameters of the environment coding layer with the activation function, the loop residual embedding vector is obtained. : ; in, For activation functions; This is the weight matrix of the environment coding layer; This is the bias vector for the environment coding layer; S5042: Based on ring residual embedding vector Calculate the generation channel modulation weights The calculation process is as follows: ; in, Represents the Sigmoid function; The weight matrix for the channel modulation weight generation layer; The bias vector for the channel modulation weight generation layer; S5043: Feature map modulation layer is based on the generated modulation weights and residual response feature maps of each channel. Modulation is performed using the modulation forcing coefficient to generate a residual response feature map after environmental modulation. Let the residual response characteristic map be: ; Represents the residual response characteristic map; Indicates the feature map height; Indicates the width of the feature map; Indicates the number of channels in the feature map; Among them, the modulated c-th channel is at position The eigenvalues ​​at this location are: ; in, Characteristic map after modulation At the c-th channel position Eigenvalues ​​at; Representing the residual response feature map At the c-th channel position The original feature map at the location; This represents the environmental modulation weight of the c-th channel; This represents the modulation forcing coefficient.

8. The method according to claim 1, characterized in that, In step S6, the context information is encoded to obtain a context embedding vector. The specific process is as follows: ; ; ; in, , Indicates an intermediate hidden layer; Represents the context embedding vector; Indicates the activation function; , , Represents the weight matrix; , , The bias vector for the context encoding network.

9. The method according to claim 1, characterized in that, In step S7, the context embedding vector is used. Residual response characteristics of MobileNetV2 output after power failure Context-gated modulation is performed to obtain the residual response depth features after context modulation. The process is as follows: ; ; in, Indicates context-gating weights; Represents the Sigmoid function; This is the weight matrix of the context-gated mapping layer; This is the weight matrix of the context-gated mapping layer; This represents the depth features of the residual response after context modulation. This represents element-wise multiplication; The formula for calculating the feature center of the normal residual response under the current context is: ; in: It is the feature center of the normal residual response under the current context conditions; Context embedding vector; , For the parameters of the center mapping layer; Context-aware anomaly scoring The calculation formula is: ; in, Scoring for context-aware anomalies; These are residual response features after context modulation; The feature center of the normal residual response under the current context; It is the square of the L2 distance.

10. The method according to claim 1, characterized in that, The specific process of S8 is as follows: S801: The electrical regulation evidence obtained includes evidence of residual admittance after the relay is disconnected. Evidence of residual current area at the tail end Evidence of residual voltage energy Evidence of residual current-residual voltage coupling Evidence of historical deviation ; S802: Constructing an Evidence Vector for Electrical Rules : ; S803: Risk Assessment of Electricity Theft via Connection Retrieval The calculation formula is: ; in, For the Sigmoid function; The weight matrix for the risk scoring fusion layer; The bias vector of the risk scoring fusion layer; S804: Issue a shared power terminal action execution command based on the action threshold range corresponding to the bypass electricity theft risk score; wherein, the shared power terminal action execution command is based on the bypass electricity theft risk score. With preset threshold , Risk level assessment of the relationship: ; in, The threshold for medium risk is [missing information]. It is a high-risk threshold, and < .

11. A system for preventing electricity theft in QR code-based shared power equipment, the system being used to perform the steps of the method according to any one of claims 1-7, characterized in that, include: Session End Judgment Module: Continuously acquires electricity metering, fee control, and status monitoring data during the user's QR code-based shared electricity session, and determines whether the session end conditions are met; when the session end conditions are met, it generates session end safety status information, sends a disconnect command to the corresponding port relay, and confirms whether the relay has been reliably disconnected; The environmental intervention residual response coupling coefficient acquisition module establishes a power outage residual acquisition window and a power outage environment measurement window to acquire residual current and residual voltage on the authorized port's total input side, as well as surrounding environmental information. It then constructs an environmental intervention context vector to obtain the environmental intervention residual response coupling coefficient. ; The three-channel power-off residual response spectrum acquisition module: standardizes the residual current and residual voltage, calculates the residual admittance, constructs residual current correlation graphs, residual voltage correlation graphs and residual admittance correlation graphs respectively, and stacks them to obtain the three-channel power-off residual response spectrum; Power outage residual response feature acquisition module: Input the three-channel power outage residual response map into the improved MobileNetV2 network to obtain the power outage residual response features; Context-aware anomaly scoring acquisition module: Acquires session context, port context, relay and control context, and historical baseline context; constructs context information; and encodes the context information to obtain a context embedding vector. ; Context-gated modulation of residual response features based on context embedding vectors yields deep features of residual response. And generate the feature centers of the normal residual response under the current context conditions. ,according to and The distance between them is used to obtain a context-aware anomaly score. ; Shared power terminal action execution instruction generation module: acquires electrical rule evidence data and constructs electrical rule evidence vectors. , combined , , and Calculate the risk score for electricity theft through wire looping; It also issues action execution instructions for shared power terminals based on the action threshold range corresponding to the risk score of electricity theft through bypassing connections.