A load identification model generalization improvement method, system, device and medium

CN122548288APending Publication Date: 2026-08-11GUIZHOU POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-20
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0004]鉴于上述现有存在的问题,本发明提供了一种负荷识别模型泛化性提升方法、系统、设备及介质解决现有负荷识别方法以负荷标签为单一监督信号,导致特征编码模块对kHz级电压波形与电流波形的时域结构、频域结构与幅值结构缺乏约束,训练得到的负荷识别模型在跨个体与跨场景应用中表现出泛化能力不足以及现有负荷识别方法未建立与波形重建任务、波形预测任务、波形幅值估计任务、傅里叶分解任务及时域特征计算任务一致的数据组织方式,导致多任务训练样本不对齐,无法对同一事件片段形成统一监督的问题

Benefits of technology

[0007]本优选技术方案的有益效果为,能够准确检测用电事件,剔除无效片段,提升数据集质量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122548288A_ABST
    Figure CN122548288A_ABST
Patent Text Reader

Abstract

This invention discloses a method, system, device, and medium for improving the generalization of a load identification model. The method includes: acquiring the voltage and current waveforms of a load; segmenting the voltage and current waveforms to obtain segmented voltage and current waveforms and constructing a load identification dataset; generating and organizing data for different self-supervised tasks based on the load identification dataset to construct a multivariate self-supervised task training dataset; constructing a load identification model containing a feature encoding module and a load classification module; pre-training the feature encoding module using the multivariate self-supervised task training dataset to obtain a pre-trained feature encoding module; fine-tuning the pre-trained feature encoding module and load classification module to obtain a first load identification model; and using the first load identification model for load identification. This improves the generalization of the load identification model and effectively enhances its generalization ability in actual deployment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of load identification technology, and in particular to a method, system, device and medium for improving the generalization of load identification models. Background Technology

[0002] With the continuous increase in the types of residential electricity loads and the diversified operating characteristics of household appliances, load identification based on voltage and current waveforms has become a crucial foundational technology for refined management of power distribution, energy efficiency assessment, and electricity safety analysis. In practical deployment scenarios, the acquisition end typically uses high-frequency voltage and current sensors to obtain kHz-level voltage and current waveforms. Based on event detection and segmentation processing, event fragment samples are formed, thereby constructing a load identification dataset and training a load identification model to achieve the classification of common household loads and the attribution of electricity events.

[0003] Currently, the mainstream training method for load identification models uses load labels as supervision signals, extracts event fragment representations through a feature encoding module, and outputs load category probability vectors by a load classification module. This approach is highly dependent on the quality and scale of load labels and is prone to overfitting when the number of load labels is limited. Furthermore, the model is sensitive to waveform differences between different individual appliances, state differences among similar loads, and sample differences introduced during the data acquisition process, leading to decreased recognition performance when applied across individuals and scenarios. Existing methods generally lack consistent constraints on the time-domain, frequency-domain, and amplitude structures of kHz-level voltage and current waveforms. The trained feature encoding modules struggle to stably represent the inherent characteristics of the load, resulting in insufficient generalization ability of the load identification model and failing to meet the stability and transferability requirements of practical applications. Summary of the Invention

[0004] In view of the above-mentioned existing problems, the present invention provides a method, system, device and medium for improving the generalization of load identification models. This addresses the problem that existing load identification methods use load labels as a single supervision signal, resulting in a lack of constraints on the time-domain, frequency-domain and amplitude structures of kHz-level voltage and current waveforms by the feature encoding module. Consequently, the trained load identification models exhibit insufficient generalization ability in cross-individual and cross-scenario applications. Furthermore, existing load identification methods do not establish a data organization method consistent with waveform reconstruction, waveform prediction, waveform amplitude estimation, Fourier decomposition and time-domain feature calculation tasks, leading to misalignment of multi-task training samples and the inability to form unified supervision for the same event segment.

[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, the present invention provides a method for improving the generalization of a load identification model, comprising: The voltage and current waveforms of the load are acquired, and the voltage and current waveforms are segmented to obtain the segmented voltage and current waveforms and construct a load identification dataset. Based on the load identification dataset, generate and organize data for different self-supervised tasks to construct a multivariate self-supervised task training dataset. A load identification model containing a feature encoding module and a load classification module is constructed. The feature encoding module is pre-trained using the multivariate self-supervised task training dataset to obtain the pre-trained feature encoding module. The pre-trained feature encoding module and load classification module are fine-tuned to obtain the first load identification model. The first load identification model is then used for load identification, thereby improving the generalization of the load identification model.

[0006] As a preferred embodiment of the load identification model generalization improvement method described in this invention, the segmentation processing of the voltage waveform and current waveform includes: Divide the voltage and current waveforms into periodic segments; Calculate the active power sequence and reactive power sequence of the sliding window based on periodic segments; A comprehensive event score is constructed based on the active power sequence and reactive power sequence, and electricity consumption events are detected. Centered on the detected electricity consumption events, and combined with the preset number of pre-event buffer cycles and post-event buffer cycles, the event start window and event end window are determined. The voltage and current waveforms are segmented according to the event start window and the event end window to obtain the voltage subsequence and current subsequence of the event segment; The event fragments are normalized to obtain event fragments of uniform length; Event fragments of uniform length are filtered, and the filtered event fragments are used as samples to construct a load identification dataset.

[0007] The beneficial effects of this preferred technical solution are that it can accurately detect electricity consumption events, eliminate invalid segments, and improve the quality of the dataset.

[0008] As a preferred embodiment of the load identification model generalization improvement method described in this invention, the construction of a multivariate self-supervised task training dataset includes: Based on the load identification dataset, generate input data and supervision signals for at least one self-supervised task; The input data and supervision signals of each self-supervised task are organized according to samples, with the sample as the smallest organizational unit, and a unified data record structure is established for each sample number. By summarizing the data records according to the sample numbers using a unified data record structure, we obtain a multivariate self-supervised task training dataset.

[0009] The beneficial effects of this preferred technical solution are that it aligns multi-task samples, eliminates supervision conflicts, and lays the foundation for joint training.

[0010] As a preferred embodiment of the load identification model generalization improvement method described in this invention, the construction of a load identification model including a feature encoding module and a load classification module includes: The corresponding two-channel sequences in the segmented voltage and current waveforms are processed by frame segmentation, and each frame is mapped to a frame embedding vector to obtain the frame embedding sequence. A sequence coding network is used to encode the frame embedding sequence and output the frame-level implicit representation to obtain the feature coding module; Temporal convergence of the frame-level latent representation yields sample-level feature vectors; A fully connected network is used to map the sample-level feature vectors and output the load category probability vectors to obtain the load classification module; The load identification model is obtained based on the feature encoding module and the load classification module.

[0011] The beneficial effect of this preferred technical solution is that it can extract deep temporal features and support model pre-training and fine-tuning.

[0012] As a preferred embodiment of the load identification model generalization improvement method described in this invention, the pre-training of the feature encoding module includes: The dataset was trained using a multivariate self-supervised task, and the loss for each self-supervised task was calculated separately. A joint pre-training objective function is constructed based on the weighted average of the losses from each self-supervised task; Based on the joint pre-training objective function, the backpropagation algorithm is used to jointly optimize the parameters of the feature encoding module and each output layer to obtain the pre-trained feature encoding module.

[0013] As a preferred embodiment of the method for improving the generalization of the load identification model described in this invention, the fine-tuning training of the pre-trained feature encoding module and load classification module includes: Remove the output layer of each self-supervised task, and retain the pre-trained feature encoding module and load classification module; Using cross-entropy loss as the fine-tuning objective function, the pre-trained feature encoding module and load classification module are fine-tuned using training samples with load labels. A group learning rate strategy was adopted to optimize the parameters of the pre-trained feature encoding module and load classification module, and data augmentation was applied to the input sequence during training to obtain the first load recognition model.

[0014] As a preferred embodiment of the load identification model generalization improvement method of the present invention, the load identification using the first load identification model includes: Obtain the voltage and current waveform data of the actual load; The acquired voltage and current waveforms are segmented to obtain the event segments to be identified; The event fragment to be identified is normalized into an input sequence of a preset length and input into the first load identification model to obtain a load category probability vector; The identification result is determined based on the load category probability vector, and the identification result is bound to the event timestamp to generate an electricity event record, thereby improving the generalization of the load identification model.

[0015] Secondly, the present invention provides a system for improving the generalization ability of a load identification model, comprising: The segmentation processing module is used to acquire the voltage waveform and current waveform of the load, segment the voltage waveform and current waveform to obtain the segmented voltage waveform and current waveform, and construct the load identification dataset. The dataset construction module is used to generate and organize data for different self-supervised tasks based on the load identification dataset, and to construct a multivariate self-supervised task training dataset. The pre-training module is used to construct a load identification model that includes a feature encoding module and a load classification module. The feature encoding module is pre-trained using the multivariate self-supervised task training dataset to obtain the pre-trained feature encoding module. The fine-tuning training module is used to fine-tune the pre-trained feature encoding module and load classification module to obtain the first load identification model. The first load identification model is then used for load identification, thereby improving the generalization of the load identification model.

[0016] Thirdly, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, characterized in that the processor executes the computer program to implement the steps of the method for improving the generalization of a load identification model.

[0017] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the steps of the method for improving the generalization of a load identification model.

[0018] Compared with existing technologies, the present invention has the following advantages: Based on the load identification dataset, the present invention generates input and target data for waveform reconstruction, historical and predicted sequences for waveform prediction, amplitude supervision signals for waveform amplitude estimation, frequency domain representation supervision signals for Fourier decomposition, and feature supervision signals for time-domain feature calculation. The data for each task is organized by sample to ensure that the same event segment shares a unified original segment index and a unified timestamp interval during multi-task training, thereby eliminating supervision conflicts caused by misalignment of multi-task samples. In the load identification model, the output of the feature encoding module is connected to the output layers corresponding to the waveform reconstruction, waveform prediction, waveform amplitude estimation, Fourier decomposition, and time-domain feature calculation tasks. A multivariate self-supervised task training dataset is used to jointly optimize the parameters of the feature encoding module and each output layer, ensuring that the feature encoding module simultaneously satisfies time-domain consistency, frequency-domain consistency, and amplitude consistency constraints. This results in a pre-trained feature encoding module that is insensitive to cross-individual and cross-scene differences, effectively improving the generalization ability of the load identification model in practical deployment. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. 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.

[0020] Figure 1 This is a schematic diagram of the overall process logic of a method for improving the generalization of a load identification model, provided as an embodiment of the present invention. Detailed Implementation

[0021] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0022] Example 1, referring to Figure 1 As an embodiment of the present invention, a method for improving the generalization of a load identification model is provided, comprising: S100: Acquire the voltage and current waveforms of the load, segment the voltage and current waveforms to obtain the segmented voltage and current waveforms, and construct a load identification dataset; In this embodiment of the invention, acquiring the voltage and current waveforms of the load includes connecting a high-frequency current sensor in series at the power user's incoming line and a high-frequency voltage sensor in parallel between the user's phase line and neutral line. The high-frequency voltage sensor adopts an isolated voltage sampling structure, with a rated input voltage of 220V and an output of low-voltage analog or digital signals. The high-frequency current sensor adopts a closed-loop Hall current sensor or a Rogowski coil current sensor, with a rated primary current covering 0A to 100A, and an output of analog signals. The sampling frequency is set in the data acquisition terminal to [missing information]. sampling frequency The dimension of is Hz, and it satisfies ,set up .

[0023] Set the single acquisition duration in the data acquisition terminal to... Duration of a single data collection session The dimensions are ,set up According to the sampling frequency Duration of a single data collection Determine the number of sample points in a single collection. , represented as: In the data acquisition terminal, voltage and current waveforms are sampled using the same clock trigger to obtain a voltage sequence with consistent timestamps. With current sequence ,in, Indicates the sample point index and its value range is For voltage sequences With current sequence Zero drift correction and amplitude calibration were performed separately. Zero drift correction employed mean removal within the acquisition window, while amplitude calibration used a linear mapping method based on sensor calibration coefficients. For the voltage sequence... With current sequence Bandpass filtering is performed separately, with the passband frequency range of the bandpass filter set to 50Hz to 5000Hz; the bandpass filter uses a fourth-order Butterworth IIR filter and achieves zero phase distortion in a bidirectional filtering manner; Common household loads include electric kettles, rice cookers, air conditioners, refrigerators, microwave ovens, lighting loads, and televisions. During data collection, the on / off status of each load and the start and end times of the data collection are recorded to form the original data collection records.

[0024] S200: Generate and organize data for different self-supervised tasks based on the load identification dataset, and construct a multivariate self-supervised task training dataset; S300: Construct a load identification model that includes a feature encoding module and a load classification module. Use a multivariate self-supervised task training dataset to pre-train the feature encoding module to obtain the pre-trained feature encoding module. S400: The pre-trained feature encoding module and load classification module are fine-tuned to obtain the first load identification model. The first load identification model is used for load identification, thereby improving the generalization of the load identification model.

[0025] In one alternative embodiment, fine-tuning training can be performed by layer-by-layer unfreezing. In the initial stage, all parameters of the feature encoding module are frozen, and only the load classification module is trained. The layers are unfrozen in rounds according to the depth of the encoding layer, with the deeper layers unfrozen first and the shallower layers unfrozen later. The representation learning ability is gradually released to avoid premature destruction of pre-trained knowledge. In another alternative embodiment, fine-tuning training can also be used for adapter fine-tuning by inserting lightweight adapter modules into each layer of the feature encoding module; freezing the parameters of the original encoding module and training only the adapter and classification module; achieving domain adaptation with a small number of parameters and maintaining the stability of the pre-trained representation. In this embodiment of the invention, fine-tuning training includes a group learning rate fine-tuning method; Specifically, the learning rate of the feature encoding module is set lower than that of the load classification module. Random inactivation is applied to the sample-level feature vectors output by the feature encoding module, while amplitude perturbation is applied to the input sequence. The parameters are updated using the cross-entropy loss function. Training is terminated when the validation set loss does not decrease for several consecutive rounds, resulting in a load identification model with improved generalization.

[0026] It should be noted that by integrating pre-training with multivariate self-supervised tasks, the feature encoding module can simultaneously learn temporal reconstruction, prediction consistency, and frequency and amplitude domain feature constraints, thereby obtaining a stable representation that is insensitive to individual load differences and waveform disturbances. This effectively solves the overfitting and insufficient generalization problems caused by existing methods relying on single-label supervision, and significantly improves the model's cross-scenario deployment performance.

[0027] In this embodiment of the invention, step S100 includes the following sub-steps A1-A7; In A1: the voltage waveform and current waveform are divided into periodic segments; In A2: Calculate the active power sequence and reactive power sequence of the sliding window based on periodic segments; In A3: Construct a comprehensive event score based on the active power sequence and reactive power sequence, and detect electricity consumption events; In A4: Based on the detected power consumption event, and combined with the preset number of pre-event buffer cycles and post-event buffer cycles, determine the event start window and event end window; In A5: The voltage and current waveforms are segmented according to the event start window and the event end window to obtain the voltage subsequence and current subsequence of the event segment; In A6: Normalize the event fragments to obtain event fragments of uniform length; In A7: Event fragments of uniform length are filtered, and the filtered event fragments are used as samples to construct a load identification dataset.

[0028] In one optional embodiment, the detection of power consumption events can be based on the detection of sudden changes in current waveforms, calculating the difference sequence of effective current values ​​between adjacent cycles, setting a current change threshold, and determining that an event has occurred when the absolute value of the difference exceeds the threshold, and combining voltage stability verification to eliminate grid disturbances. In another optional embodiment, the detection of power consumption events can also be based on harmonic distortion rate detection, which involves performing Fourier transform on each period segment to extract harmonic components, calculating the total harmonic distortion rate (THD) time series, and detecting THD surge points as nonlinear load switching events, which is suitable for power electronic load identification. In this embodiment of the invention, detecting electricity consumption events includes event detection based on power changes; Specifically, the voltage sequence With current sequence Divide the power frequency into periodic segments and set the power frequency to [value]. And it is 50Hz, with the preset period sample number set to [value missing]. , represented as: when and hour, point; Active power sequence calculated using periodic segments in a sliding window With sliding window reactive power sequence Set the sliding window length to Each power frequency cycle and set the sliding step size to The first power frequency cycle, will be the first The voltage and current samples within each sliding window are denoted as follows: and ,in, The sample point index within the window and its value range is... The active and reactive power of the sliding window are expressed as follows: in, For the first The active power of each sliding window For the first The reactive power of each sliding window The length of the sliding window. For the first Within the first sliding window Each voltage sample is in V. For the first Within the first sliding window One current sample; For the reason Orthogonal component current samples obtained by Hilbert transform The value is the sliding window number and is a non-negative integer.

[0029] Sliding window length The value is a positive integer and satisfies sliding step size The value is a positive integer and satisfies ,set up ; Event detection based on power changes, constructing a comprehensive event score sequence. , represented as: in, For the first The overall event score corresponding to each sliding window The reactive power variation weighting coefficient is constant, and is set as follows: ; Set the event threshold to event threshold It is constant and satisfies The average comprehensive event score based on idle background data with standard deviation Sure , represented as: in, For event threshold, This represents the average score of all events in the background data without a load. The standard deviation of the composite event score for unloaded background data; when Time to determine the first A power consumption event occurs in a sliding window, and the starting and ending window numbers of the event are determined centered on the power consumption event; the number of pre-event buffer cycles is set to [value missing]. The number of buffer cycles after the event is , and Set to positive integer. , ; Voltage sequences are determined based on the event start window number and event end window number. With current sequence Divide into segments to obtain the first segment. Voltage subsequence of segment event segments With current subsequence ,in, The event segment number is a non-negative integer. The sample point index within the segment is determined by the segment length, and the value range is defined by the segment length. Length normalization is performed on each event segment, and a uniform segment length is set. One sample point, Set to positive integer. Point; length normalization uses linear interpolation resampling method, and Resampling respectively ,in ; For each event segment, calculate the segment's apparent power and segment power factor, and remove segments that do not meet the preset range. The segment's apparent power and segment power factor are expressed as follows: in, For the first Apparent power of a segment of an event. For the first The power factor of a segment of events. For the first RMS value of segment voltage during a segment event. For the first RMS value of segment current in segment event For the first Active power of a segment of an event.

[0030] , and All from resampled Calculated after truncating the power frequency cycle to a full cycle, the power factor filtering range for each segment is set to [value missing]. ; The selected event fragments are written into the load identification dataset as samples, each sample containing a voltage sample sequence. Current sample sequence The event start and end timestamps and load category identifiers; where the load category identifier is derived from the load on / off status and the name of the measured load recorded during data acquisition, and is combined with the event segment number. One-to-one correspondence.

[0031] It should be noted that by detecting power change events and performing segmented normalization, load switching event segments are effectively extracted and the data format is unified, providing a high-quality and standardized training sample basis for subsequent multi-task learning.

[0032] In this embodiment of the invention, step S200 includes the following sub-steps B1-B3; In B1: Based on the load identification dataset, generate input data and supervision signals for at least one self-supervised task; In B2: The input data and supervision signals of each self-supervised task are organized according to samples, with the sample as the smallest organizational unit, and a unified data record structure is established for each sample number; In B3: The unified data record structure is summarized according to the sample number to obtain the multivariate self-supervised task training dataset.

[0033] In one alternative embodiment, the self-supervised task can be the phase supervision signal for generating the phase difference estimation task, performing a Hilbert transform on the voltage / current sequence to obtain the instantaneous phase, calculating the fundamental phase difference between the voltage and current as the supervision signal, and training the model to estimate the impedance angle characteristics of the load. In another optional embodiment, the self-supervised task can also be used as a harmonic supervision signal for generating harmonic content rate task, performing Fourier decomposition on the current sequence, extracting the 3rd / 5th / 7th harmonic components, calculating the content rate of each harmonic as a supervision signal, and training the model to identify the harmonic fingerprint characteristics of nonlinear loads. In this embodiment of the invention, the self-supervised task includes generating input data and target data for waveform reconstruction, generating historical sequences and sequences to be predicted for waveform prediction, generating amplitude supervision signals for waveform amplitude estimation, generating frequency domain representation supervision signals for Fourier decomposition, and generating feature supervision signals for time domain feature calculation. Specifically, let the load identification dataset contain the first... The voltage sample sequence of each sample is as follows The current sample sequence is ,in, The sample number is a non-negative integer. The sample point index within the sequence and satisfying , To ensure uniform segment length and that it is a positive integer, set Points, construct a joint input sequence for each sample. , represented as: in, For the first The sample at the th A two-channel input vector with sampling points, This is a transpose.

[0034] The input and target data for the waveform reconstruction task include: For the first Masking is applied to the joint input sequence of each sample to form the reconstructed input sequence. The original joint input sequence was used as the target sequence for reconstruction. Let the mask sequence be... ,in ; set the mask ratio to And satisfy ,set up The reconstruction input and reconstruction target are represented as follows: in, The input sequence for the waveform reconstruction task. The target sequence for waveform reconstruction task, For mask sequence, This is the mask ratio.

[0035] Data generation for waveform prediction tasks includes: Set the prediction step size to And set the history length to , and All are positive integers and satisfy ,set up point, Point; the joint input sequence is divided into historical sequences according to length. With the sequence to be predicted , represented as: in, For the historical sequence of waveform prediction tasks, The sequence to be predicted in the waveform prediction task. For historical length, To predict the step size.

[0036] The supervision signal generation for the waveform amplitude estimation task includes: For the first Calculate the voltage amplitude monitoring signal for each sample. With current amplitude monitoring signal The amplitude monitoring signal is defined using half the peak-to-peak value; the maximum voltage value within the segment is set to... The minimum voltage value is The maximum current is The minimum current value is , represented as: in, For the first The voltage amplitude monitoring signal of each sample, For the first The current amplitude monitoring signal of each sample, The maximum value of the voltage sample sequence. This represents the minimum value of the voltage sample sequence. The maximum value of the current sample sequence. The minimum value is the current sample sequence. To suppress the influence of outliers, the maximum and minimum values ​​are calculated from the sequence after quantile pruning. The pruning quantiles are set to 0.5% and 99.5%.

[0037] The frequency domain representation of the Fourier decomposition task includes the generation of the supervision signal: For the first The voltage and current sample sequences of each sample are subjected to Discrete Fourier Transform, with the number of frequency domain points set to [value missing]. And it is a positive integer, set The complex spectrum of the discrete Fourier transform is decomposed into an amplitude spectrum and a phase spectrum. The amplitude spectrum is used as the frequency domain representation of the monitoring signal, and the voltage amplitude spectrum monitoring signal is used. With current amplitude spectrum monitoring signal They are represented as follows: in, For the first The sample at the th Voltage amplitude spectrum monitoring signal at each frequency point For the first The sample at the th Current amplitude spectrum monitoring signal at each frequency point The frequency point number is and satisfies , The number of points in the Discrete Fourier Transform. The imaginary unit is retained only. to The single-sided amplitude spectrum is used as the monitoring signal. To ensure time-frequency consistency, a Hanning window is applied to the sequence before performing the discrete Fourier transform.

[0038] The generation of feature supervision signals for time-domain feature computation tasks includes: For the first For each sample, the voltage time-domain feature supervision vector and the current time-domain feature supervision vector are calculated respectively. The time-domain feature supervision vector consists of the effective value, waveform factor, peak factor, and zero crossover rate; where the effective value, waveform factor, and peak factor are respectively expressed as: in, For the first The effective voltage value of each sample For the first The effective value of the current for each sample For voltage waveform factor, For current waveform factor, For peak voltage factor, This is the peak current factor. To Maximum value operation; Zero crossover rate is calculated for both voltage and current sequences. and Represented as: in, For the first Zero crossover rate of each sample voltage For the first The sample current has zero crossover rate. This is an indicator function that takes the value 1 if the condition within the parentheses is true, and 0 otherwise. It is a symbolic function.

[0039] Construct the temporal feature supervision vector, expressed as: in, This is the voltage time-domain feature supervision vector. This is the current-time domain feature supervision vector.

[0040] Using the sample as the smallest organizational unit, for each sample number Establish a unified data recording structure, which simultaneously includes fields for waveform reconstruction, waveform prediction, waveform amplitude estimation, Fourier decomposition, and time-domain feature calculation; among which the waveform reconstruction task field includes... and Waveform prediction task fields include and The waveform amplitude estimation task field contains... and The Fourier decomposition task fields contain... and The time-domain feature calculation task fields include and ; Amplitude normalization is performed on the amplitude spectrum field. The normalization method uses the in-sample maximum amplitude normalization method, which is expressed as: in, This is the normalized voltage amplitude spectrum monitoring signal. This is the normalized current amplitude spectrum monitoring signal. To Maximum value operation.

[0041] Data records containing each field are sorted by sample number. The dataset is compiled to form a multivariate self-supervised task training dataset, and then divided into a training subset and a validation subset according to a preset ratio. In this embodiment, the sample ratio of the training subset to the validation subset is set to 8:2.

[0042] It should be noted that a unified supervision signal for five self-supervised tasks is generated based on a single dataset, and the samples are organized to ensure alignment of time and frequency features. This enables the feature encoding module to learn time-domain reconstruction, prediction consistency, and multi-dimensional constraints in the frequency domain, amplitude domain, and feature domain simultaneously. This effectively eliminates supervision conflicts caused by misalignment of multi-task samples, lays a data foundation for subsequent joint pre-training, and significantly improves the model's generalization ability.

[0043] In this embodiment of the invention, step S300 includes the following sub-steps C1-C5; In C1: The corresponding two-channel sequences in the segmented voltage and current waveforms are processed by frame segmentation, and each frame is mapped to a frame embedding vector to obtain the frame embedding sequence. In C2: a sequence coding network is used to encode the frame embedding sequence and output the frame-level implicit representation to obtain the feature coding module; In C3: Temporal convergence of the frame-level latent representation is performed to obtain the sample-level feature vector; In C4: A fully connected network is used to map the sample-level feature vectors and output the load category probability vectors to obtain the load classification module; In C5: The load identification model is obtained based on the feature encoding module and the load classification module.

[0044] In one optional embodiment, the sequence coding network can be a Transformer self-attention coding network, which adds positional encoding to the frame embedding sequence to preserve temporal positional information; a multi-head self-attention mechanism is used to calculate inter-frame correlation weights; and global dependency features are extracted through a feedforward network and layer normalization to output a frame-level latent representation. In another alternative embodiment, the sequence coding network can be a temporal convolutional network, which uses multiple layers of dilated causal convolutions to expand the receptive field and avoid information leakage; sets residual connections to alleviate gradient vanishing and enhance deep feature transfer; and captures multi-scale temporal patterns by stacking dilated convolutional layers to output encoded features. In this embodiment of the invention, the sequence coding network includes a multi-layer temporal coding network; Specifically, the load identification model is constructed as a combination of a shared coding structure and a task branching structure. The shared coding structure is a feature coding module, and the task branching structure includes a load classification module and an output layer corresponding to a multivariate self-supervised task. The input to the feature coding module is a two-channel sequence. ,in, The sample number is a non-negative integer. The sampling point number is and satisfies , To standardize segment length, point; Perform framing and embedding on the input sequence, setting the frame length to [value missing]. Point, frame shift point, and are positive integers and satisfy and Divisible ,set up point, Point; let the number of frames after framing be... , represented as: in, For frame number, To standardize segment length, Frame length; Map each frame to a frame embedding vector, and set the embedding dimension to [value]. And it is a positive integer, set ; for the first The first sample Frame construction of frame vectors And perform a linear mapping, expressed as: in, Indicates the first The first sample The embedding vector of the frame. The frame number is and satisfies , For embedding mapping matrix, For embedding bias vectors, For the first The frame vector obtained by splicing the two-channel time sequence samples of a frame; The feature encoding module uses a multi-layer temporal coding network to embed the frame sequence. Encode to output sample-level feature vectors The timing coding network employs a cascaded structure of a 4-layer one-dimensional convolutional encoder and a 1-layer bidirectional gated cyclic encoder. The kernel size of the one-dimensional convolutional encoder is K=5, and the number of channels is 64, 128, and 128 respectively. The number of hidden units in the bidirectional gated loop unit is .

[0045] The frame-level latent representations output by the feature encoding module are converged over time to obtain sample-level feature vectors. The time aggregation uses a concatenation method of mean aggregation and maximum aggregation, represented as: in, For the first Sample-level feature vectors of each sample For the feature encoding module to the first Frame-level implicit representation of frame output To Maximum value operation; The load classification module receives sample-level feature vectors. And output the load category probability vector Let the number of load categories be... And it is a positive integer. The load classification module uses a two-layer fully connected network and a Softmax output, as shown below: in, This is the probability vector for load categories. ( ) represents the ReLU activation function. , To classify the weights of fully connected layers, , To classify the bias of fully connected layers.

[0046] During the pre-training phase, the fixed-load classification module does not participate in parameter updates, and an independent output layer is set at the output of the feature encoding module for each self-supervised task. The independent output layer and the feature encoding module form a structure with a shared trunk and multiple branches. Among them, the output layer of the waveform reconstruction task receives the frame-level implicit representation sequence. And output the reconstructed sequence The output layer uses an upsampling decoder to map the frame-level representation back to the sample-point-level representation. The upsampling decoder employs a transposed one-dimensional convolution structure and ensures that the output length is strictly equal to the sample point-level representation. .

[0047] The output layer of the waveform prediction task receives the frame-level implicit representation of the historical segments and outputs the sequence to be predicted. The output length is strictly equal to The output layer of the waveform prediction task adopts a combination structure of causal one-dimensional convolution and linear mapping.

[0048] The output layer of the waveform amplitude estimation task receives sample-level feature vectors. And output voltage amplitude estimate Compared with the estimated current amplitude The output layer uses two sets of fully connected regression layers that do not share parameters. The output layer of the Fourier decomposition task receives sample-level feature vectors. And output the voltage amplitude spectrum estimation vector. With current amplitude spectrum estimation vector ,in, Given the frequency index and its value range consistent with the supervisory signal, the output dimension of the Fourier decomposition task's output layer is... ; The output layer of the temporal feature computation task receives sample-level feature vectors. And output voltage time-domain feature estimation vector With current time-domain feature estimation vector The output dimension of the output layer for the time-domain feature calculation task is 4. To ensure consistency in training objectives across output layers, the outputs of the waveform reconstruction and waveform prediction task layers use linear outputs, while the outputs of the waveform amplitude estimation, Fourier decomposition, and temporal feature calculation task layers use non-negative constraint mappings. function.

[0049] It should be noted that by sharing the feature coding module and the multi-task branch structure, the joint injection of multi-variable self-supervised signals is realized, so that the coding layer simultaneously satisfies the consistency constraints of the time domain, frequency domain and amplitude domain, and obtains a general characterization that is robust to waveform differences.

[0050] In this embodiment of the invention, after completing steps C1-C5, step S300 also includes steps C6-C8; In C6: The dataset is trained using a multivariate self-supervised task, and the loss for each self-supervised task is calculated separately. In C7: A joint pre-training objective function is constructed based on the weighted average of the losses from each self-supervised task; In C8: Based on the joint pre-training objective function, the backpropagation algorithm is used to jointly optimize the parameters of the feature encoding module and each output layer to obtain the pre-trained feature encoding module.

[0051] In this embodiment of the invention, the multivariate self-supervised task training dataset is input into the feature encoding module in batches, with the batch size set to [value missing]. And it is a positive integer, set For each sample number Calculate the loss of waveform reconstruction task Waveform prediction task loss Waveform amplitude estimation task loss Fourier decomposition task loss Loss calculation task with temporal features The joint pre-training objective function is defined as a weighted sum, expressed as: in, For the joint pre-training objective function, , , , , These are the loss weight coefficients for the waveform reconstruction task, waveform prediction task, waveform amplitude estimation task, Fourier decomposition task, and time-domain feature calculation task, respectively, and are all constants. The waveform reconstruction task loss uses the mean square error of mask consistency and is calculated only for the mask position, expressed as: in, For mask sequence, It is a 2-norm; The loss in waveform prediction tasks is expressed using mean square error, as follows: in, For historical length, To predict the step size; The waveform amplitude estimation task loss is expressed using the mean absolute error, as follows: in, , These are the estimated voltage amplitude and current amplitude, respectively. , These are the monitored voltage and current amplitudes, respectively. The Fourier decomposition task loss uses the mean square error of the logarithmic amplitude spectrum difference, and sets the stable constant as the positive body identifier. And satisfy ,set up The loss is expressed as: in, To maintain a stable constant, It is the natural logarithm function; The time-domain feature calculation task uses weighted mean square error as the loss, and sets the feature dimension weight vector as follows: And the dimension is 4, set The loss is expressed as: in, For Hadamard multiplication, The feature dimension weight vector; For the joint pre-training objective function Backpropagation is used to calculate the gradients between the feature encoding module and each output layer, and an adaptive moment estimation algorithm is used to update the parameters, with the learning rate set to [value missing]. ,set up Set the number of pre-training rounds to And it is a positive integer, set .

[0052] It should be noted that by weighted joint optimization of the multivariate self-supervised task loss, the feature encoding module can simultaneously satisfy the multidimensional consistency constraints of temporal reconstruction, prediction, amplitude, frequency domain and feature domain, and obtain a stable pre-trained representation that is insensitive to differences across individuals and scenarios.

[0053] In this embodiment of the invention, step S400 includes the following sub-steps D1-D3; In D1: Remove the output layer of each self-supervised task, and retain the pre-trained feature encoding module and load classification module; In D2: Cross-entropy loss is used as the fine-tuning objective function, and the pre-trained feature encoding module and load classification module are fine-tuned using training samples with load labels; In D3: A group learning rate strategy is used to optimize the parameters of the pre-trained feature encoding module and load classification module, and data augmentation is applied to the input sequence during training to obtain the first load recognition model.

[0054] In this embodiment of the invention, after pre-training, the forward computation and parameter updates of the waveform reconstruction task output layer, waveform prediction task output layer, waveform amplitude estimation task output layer, Fourier decomposition task output layer, and time-domain feature calculation task output layer are stopped. The above output layers are disconnected from the computation graph of the load identification model and removed from the model parameter set. The pre-trained feature encoding module and load classification module are retained to form a fine-tuned model, wherein the structure of the load classification module remains consistent with that before pre-training and the output dimension is fixed to the number of load categories. , .

[0055] Let the parameters of the pre-trained feature encoding module be denoted as... And load them as the initialization parameters for fine-tuning the model, denoted as the parameters of the load classification module. And load them as the initialization parameters for fine-tuning the model. The identifier is a positive body that randomly initializes parameters and satisfies zero mean and variance. It follows a normal distribution.

[0056] Construct a labeled fine-tuning training set, let the first... The input sequence of each training sample is And the length is The corresponding load label is ;in It is a category index and satisfies ;Will Convert to a one-dimensional heat vector Based on the calculation of participating losses; During fine-tuning training, The pre-trained feature encoding module is input to obtain sample-level feature vectors. Then input the data into the load classification module to obtain the load category probability vector. We use cross-entropy loss as the fine-tuning objective function, expressed as: in, To fine-tune the objective function, This represents the number of samples within a batch. For the batch sample index set, For the number of load categories, For the first The one-dimensional heat vector of each sample in the th case... Components on class, For the first The load class probability vector of each sample is in the th order. Components on a class.

[0057] To improve generalization and maintain the stability of pre-trained representations, a group learning rate strategy is adopted for the feature encoding module and the load classification module. The learning rate of the feature encoding module is set to... Set the learning rate of the load classification module. and satisfy ,set up ,set up The adaptive moment estimation algorithm is used to update the parameters and the weight decay coefficient is set to . ,set up .

[0058] To avoid overfitting to small samples, the sample-level feature vectors output by the feature encoding module are adjusted during fine-tuning training. Apply random inactivation, with the random inactivation rate set to... And satisfy ,set up Simultaneously, an amplitude perturbation enhancement is applied to the input sequence, with the amplitude perturbation coefficient set to... And satisfy ;set up The amplitude perturbation will update the input sequence to , represented as: In the formula, The input sequence after amplitude perturbation. For the first The perturbation coefficients of each sample and satisfying , It is a uniform distribution; Set the number of fine-tuning wheels to And it is a positive integer, set When the validation set fine-tunes the objective function In continuous Fine-tuning training terminates when the performance no longer declines within a certain evaluation period, with an early stopping cycle threshold set at [value missing]. ,set up After fine-tuning, the first load identification model is obtained, which is the load identification model with improved generalization.

[0059] In this embodiment of the invention, after completing steps D1-D3, step S400 further includes steps D4-D7; In D4: Obtain the voltage and current waveform data of the actual load; In D5: The acquired voltage and current waveforms are segmented to obtain the event segments to be identified; In D6: The event fragment to be identified is normalized into an input sequence of a preset length and input into the first load identification model to obtain the load category probability vector; In D7: the identification result is determined based on the load category probability vector, and the identification result is bound to the event timestamp to generate electricity event records, thereby improving the generalization of the load identification model.

[0060] In this embodiment of the invention, high-frequency voltage and current sensors, consistent with those used in the training phase, are employed to acquire kHz-level voltage and current waveform data. An event detection and segmentation process, consistent with that used in constructing the load identification dataset, is employed to generate event segments to be identified. These event segments are then normalized to a length of [length missing]. The input sequence is fed into the load identification model, and the output is a load category probability vector. ; Based on the load category probability vector Determine the recognition result, and index the category of the recognition result. Represented as: in, For the category index of load identification results, To find the independent variable that maximizes the objective function, For the load category probability vector in the th... Components on the class; The identification results are bound to the event timestamp and written to the electricity consumption event record. The electricity consumption event record must at least include the user identifier, the event start and end times, and the identification result category index. With load category probability vector Electricity consumption event records are stored in JSON format.

[0061] It should be noted that by removing the self-supervised output layer and retaining the load classification module, and by using a group learning rate strategy and data augmentation for fine-tuning, the class discrimination boundary is optimized while maintaining the stability of the pre-trained representation. This effectively suppresses overfitting in small samples, enabling the model to have both strong generalization ability and high-precision recognition performance, thus meeting the needs of actual deployment.

[0062] The above is an illustrative scheme of a load identification model generalization improvement method according to this embodiment. It should be noted that the technical solution of this load identification model generalization improvement system and the technical solution of the load identification model generalization improvement method described above belong to the same concept. For details not described in detail in the technical solution of the load identification model generalization improvement system in this embodiment, please refer to the description of the technical solution of the load identification model generalization improvement method described above.

[0063] This embodiment provides a load identification model generalization improvement system, comprising: The segmentation processing module is used to acquire the voltage waveform and current waveform of the load, segment the voltage waveform and current waveform to obtain the segmented voltage waveform and current waveform, and construct the load identification dataset. The dataset construction module is used to generate and organize data for different self-supervised tasks based on the load identification dataset, and to construct a multivariate self-supervised task training dataset. The pre-training module is used to construct a load identification model that includes a feature encoding module and a load classification module. The feature encoding module is pre-trained using the multivariate self-supervised task training dataset to obtain the pre-trained feature encoding module. The fine-tuning training module is used to fine-tune the pre-trained feature encoding module and load classification module to obtain the first load identification model. The first load identification model is then used for load identification, thereby improving the generalization of the load identification model.

[0064] This embodiment also provides a computer device applicable to a situation where the generalization of a load identification model is improved, including: The system includes a memory and a processor. The memory stores computer-executable instructions, and the processor executes these instructions to implement a method for improving the generalization of a load identification model as proposed in the above embodiments.

[0065] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a method for improving the generalization of a load identification model as proposed in the above embodiments.

[0066] The storage medium proposed in this embodiment and the method for improving the generalization of a load identification model proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0067] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computing device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0068] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for improving the generalization of a load identification model, characterized in that, include: The voltage and current waveforms of the load are acquired, and the voltage and current waveforms are segmented to obtain the segmented voltage and current waveforms and construct a load identification dataset. Based on the load identification dataset, generate and organize data for different self-supervised tasks to construct a multivariate self-supervised task training dataset. A load identification model containing a feature encoding module and a load classification module is constructed. The feature encoding module is pre-trained using the multivariate self-supervised task training dataset to obtain the pre-trained feature encoding module. The pre-trained feature encoding module and load classification module are fine-tuned to obtain the first load identification model. The first load identification model is then used for load identification, thereby improving the generalization of the load identification model.

2. The method for improving the generalization of a load identification model as described in claim 1, characterized in that, The segmentation of the voltage and current waveforms includes: Divide the voltage and current waveforms into periodic segments; Calculate the active power sequence and reactive power sequence of the sliding window based on periodic segments; A comprehensive event score is constructed based on the active power sequence and reactive power sequence, and electricity consumption events are detected. Centered on the detected electricity consumption events, and combined with the preset number of pre-event buffer cycles and post-event buffer cycles, the event start window and event end window are determined. The voltage and current waveforms are segmented according to the event start window and the event end window to obtain the voltage subsequence and current subsequence of the event segment; The event fragments are normalized to obtain event fragments of uniform length; Event fragments of uniform length are filtered, and the filtered event fragments are used as samples to construct a load identification dataset.

3. The method for improving the generalization of a load identification model as described in claim 2, characterized in that, Constructing a multivariate self-supervised task training dataset includes: Based on the load identification dataset, generate input data and supervision signals for at least one self-supervised task; The input data and supervision signals of each self-supervised task are organized according to samples, with the sample as the smallest organizational unit, and a unified data record structure is established for each sample number. By summarizing the data records according to the sample numbers using a unified data record structure, we obtain a multivariate self-supervised task training dataset.

4. The method for improving the generalization of a load identification model as described in claim 3, characterized in that, Constructing a load identification model that includes a feature encoding module and a load classification module includes: The corresponding two-channel sequences in the segmented voltage and current waveforms are processed by frame segmentation, and each frame is mapped to a frame embedding vector to obtain the frame embedding sequence. A sequence coding network is used to encode the frame embedding sequence and output the frame-level implicit representation to obtain the feature coding module; Temporal convergence of the frame-level latent representation yields sample-level feature vectors; A fully connected network is used to map the sample-level feature vectors and output the load category probability vectors to obtain the load classification module; The load identification model is obtained based on the feature encoding module and the load classification module.

5. A method for improving the generalization of a load identification model as described in claim 3 or 4, characterized in that, Pre-training the feature encoding module includes: The dataset was trained using a multivariate self-supervised task, and the loss for each self-supervised task was calculated separately. A joint pre-training objective function is constructed based on the weighted average of the losses from each self-supervised task; Based on the joint pre-training objective function, the backpropagation algorithm is used to jointly optimize the parameters of the feature encoding module and each output layer to obtain the pre-trained feature encoding module.

6. The method for improving the generalization of a load identification model as described in claim 5, characterized in that, Fine-tuning the pre-trained feature encoding module and load classification module includes: Remove the output layer of each self-supervised task, and retain the pre-trained feature encoding module and load classification module; Using cross-entropy loss as the fine-tuning objective function, the pre-trained feature encoding module and load classification module are fine-tuned using training samples with load labels. A group learning rate strategy was adopted to optimize the parameters of the pre-trained feature encoding module and load classification module, and data augmentation was applied to the input sequence during training to obtain the first load recognition model.

7. The method for improving the generalization of a load identification model as described in claim 6, characterized in that, Load identification using the first load identification model includes: Obtain the voltage and current waveform data of the actual load; The acquired voltage and current waveforms are segmented to obtain the event segments to be identified; The event fragment to be identified is normalized into an input sequence of a preset length and input into the first load identification model to obtain a load category probability vector; The identification result is determined based on the load category probability vector, and the identification result is bound to the event timestamp to generate an electricity event record, thereby improving the generalization of the load identification model.

8. A load identification model generalization improvement system, employing the load identification model generalization improvement method as described in any one of claims 1-7, characterized in that, include: The segmentation processing module is used to acquire the voltage waveform and current waveform of the load, segment the voltage waveform and current waveform to obtain the segmented voltage waveform and current waveform, and construct the load identification dataset. The dataset construction module is used to generate and organize data for different self-supervised tasks based on the load identification dataset, and to construct a multivariate self-supervised task training dataset. The pre-training module is used to construct a load identification model that includes a feature encoding module and a load classification module. The feature encoding module is pre-trained using the multivariate self-supervised task training dataset to obtain the pre-trained feature encoding module. The fine-tuning training module is used to fine-tune the pre-trained feature encoding module and load classification module to obtain the first load identification model. The first load identification model is then used for load identification, thereby improving the generalization of the load identification model.

9. A computer device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method for improving the generalization of a load identification model according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed by a processor, implements the steps of the method for improving the generalization of a load identification model according to any one of claims 1 to 7.