A non-invasive load identification method based on Gram angle difference field feature fusion
By using a neural network with Gram angle difference field feature fusion and convolutional block attention module, the problem of difficult appliance identification caused by overlapping VI trajectories is solved, and high-precision non-invasive load identification is achieved.
Patent Information
- Application Number
- CN202310178005.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-02-28
AI Technical Summary
In the existing technology, the non-intrusive load identification method based on VI trajectory has difficulty effectively identifying different electrical devices because the operating voltage and current of electrical appliances are similar, resulting in overlapping VI trajectories.
The Gram angle difference field feature fusion method is adopted to convert one-dimensional voltage and current signals into two-dimensional feature maps, and load identification is performed through a neural network with convolutional block attention module to construct a load identification model.
It improved the accuracy and recognition of load identification, with an average recognition accuracy of 98.36% and an F1 score of 98.46%, thus enhancing the overall performance of load identification.
Smart Images

Figure CN116127409B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a non-intrusive load identification method based on Gram angle difference field feature fusion. Background Technology
[0002] The power industry is facing a new round of reforms, transitioning comprehensively to a green and low-carbon model. The most important pathway to this transformation is strengthening refined demand-side management. Non-intrusive load monitoring (NILM), as a key technology for refined demand-side management in smart grids, can monitor in real time information such as the types of appliances, operating status, and energy consumption of users through data collected by smart meters. This provides users with decision-making support for optimizing their electricity consumption patterns, guiding them to reasonably reduce household electricity consumption, improve household electricity efficiency, and promote energy conservation and emission reduction.
[0003] Non-intrusive load identification, as a key subtask of NILM, comprises two crucial steps: feature extraction and load classification. Early domestic and international scholars primarily employed mathematical optimization or traditional machine learning algorithms for feature extraction and classification. The paper "[A Non-intrusive Load Identification Method Based on DTW Algorithm and Steady-State Current Waveform]" utilizes the Dynamic Time Warping (DTW) algorithm to calculate the distance between the load's steady-state waveform and the template library waveform to achieve load identification. This algorithm effectively reduces phase errors generated during steady-state current extraction by leveraging the additivity of steady-state current waveforms, thus improving load identification capabilities. The paper "[Modern development of an Adaptive Non-Intrusive Appliance Load Monitoring system inelectricity energy conservation]" proposes two load identification methods: one based on the k-nearest neighbor algorithm and the other on a backpropagation neural network. Furthermore, it employs an Artificial Immune Algorithm (AIA) with Fisher's criterion to adaptively adjust model parameters and improve identification accuracy. The literature [A Non-Intrusive Load Monitoring Method Based on k-NN Combined with Kernel Fisher Discriminant Analysis] constructs a feature library characterized by odd harmonics of load current, and uses the AdaBoost algorithm to filter effective features, resulting in a more concise load feature library. Finally, it combines the k-nearest neighbor algorithm with kernel Fisher discriminant analysis to achieve household load identification. This method balances identification accuracy and computational complexity. The aforementioned methods mainly achieve load identification by extracting frequency, phase, or other statistical features from sampled data. While the computational load is not high, the identification accuracy is difficult to achieve at a high level.
[0004] With the continuous development of deep learning technology and the reduced difficulty of acquiring high-frequency data, research on extracting fine-grained features from steady-state or transient data for non-intrusive load identification is increasing. Some scholars have explored using VI trajectories to describe the characteristics of electrical appliances. The paper "[Electric Load Classification by Binary Voltage–CurrentTrajectory Mapping]" explains in detail the physical characteristics that can be described by VI trajectories and verifies that different types of loads can be characterized by their unique shape features through VI trajectories, achieving good load identification results. The paper "[Non-intrusive Load Identification Algorithm Based on Feature Fusion and Deep Learning]" proposes a load identification method based on feature fusion and deep learning. By incorporating power features into the VI trajectory, it solves the problem that the VI trajectory cannot reflect the power of the equipment and improves the multi-state load identification capability. The paper "[Non-intrusive Load Identification Method Based on VI Trajectory Color Encoding]" first uses the K-means clustering algorithm for preliminary classification, and then inputs the color-coded VI trajectory features into the AlexNet neural network for refined load classification. The above studies show that VI trajectories and their two-dimensional image representations can be effectively used for non-intrusive load identification tasks, and can utilize deep learning algorithms to extract deeper features to improve the overall performance of load identification.
[0005] Although the above method has successfully applied VI trajectories to non-intrusive load identification tasks, the VI trajectories are mainly obtained by plotting normalized voltage and current. Since the operating voltage and current of some electrical appliances are similar, their VI trajectories overlap, making it difficult to identify them effectively. Summary of the Invention
[0006] To address the aforementioned technical problems, this invention provides a non-invasive load identification method based on Gram angle difference field feature fusion, which features a simple algorithm and high recognition accuracy.
[0007] The technical solution of this invention to solve the above problems is: a non-invasive load identification method based on Gram angle difference field feature fusion, comprising the following steps:
[0008] Step 1: Preprocess the high-frequency steady-state data collected by the equipment to obtain a complete fundamental cycle current and voltage signal;
[0009] Step 2: Encode the one-dimensional voltage and current signals using the Gram angle difference field to generate corresponding two-dimensional feature maps;
[0010] Step 3: By superimposing and fusing the inputs into a neural network based on convolutional block attention modules, a load recognition model is constructed to complete load recognition.
[0011] The above-mentioned non-invasive load identification method based on Gram angle difference field feature fusion, the specific process of step one is as follows:
[0012] The prerequisite for load identification is to first extract load features from the high-frequency aggregated signal. Assuming only one electrical device experiences a switching event at any given time, the load features of a single device can be extracted by calculating the difference in the steady-state aggregated signal within a short time window before and after the switching event. The difference in active power change ΔP is used as the criterion for detecting electrical device switching events. The steady-state voltage and current signals of each electrical device are extracted from the aggregated voltage and current signals as load features. For ease of calculation, v is used... off i off and v on i on This represents the steady-state aggregate voltage and current before and after the switching event of the electrical equipment. The voltage v of a single electrical equipment is taken as the average of the steady-state aggregate voltages before and after the switching event, i.e.:
[0013]
[0014] Conversely, the steady-state aggregated current signal changes due to the occurrence of electrical equipment switching events. The current i of a single electrical equipment is obtained by calculating the difference between the steady-state aggregated current before and after the switching event, i.e.:
[0015] i = i on -i off (2)
[0016] Because of v off With v on and i off with i on Since addition and subtraction operations need to be performed at the same voltage phase, and the waveform of the steady-state voltage signal is approximately sinusoidal, alignment is chosen at the positive zero-crossing point of the voltage. Furthermore, the steady-state voltage and current signals exhibit periodic changes, so a single fundamental cycle of the steady-state voltage and current signal is used to characterize the load characteristics of the electrical equipment. However, the state of the electrical equipment still changes during stable operation. To better characterize the load characteristics of the electrical equipment, continuous N-wavelength voltage and current signals are extracted. t The steady-state voltage and current signals of each fundamental frequency cycle are averaged to obtain the steady-state voltage and current signals of one complete fundamental frequency cycle. t >1;
[0017] First, assume that the sampling frequency of the steady-state voltage and current signals of the electrical equipment is f. s If the fundamental frequency is f, then the number of samples per fundamental period is N. s =f s / f, N t The number of samples for each fundamental frequency period is N. ts =Nt ×N s N of electrical equipment k t The fundamental frequency cycle steady-state voltage signal and steady-state current signal Then let v k i k In v k Alignment is achieved at the positive zero-crossing point of each fundamental frequency cycle, resulting in the aligned steady-state voltage signal. and steady-state current signal as follows:
[0018]
[0019]
[0020] In the formula: Indicates the Nth electrical device k ts The aligned steady-state voltage value Indicates the Nth electrical device k ts The aligned steady-state current value;
[0021] Finally, for and By averaging each column, a one-dimensional vector of steady-state voltage and current signals for a complete fundamental frequency cycle is obtained. and
[0022] The above-mentioned non-invasive load identification method based on Gram angle difference field feature fusion, in step two, uses the Gram angle difference field as an encoding method to convert a one-dimensional time-series signal into a two-dimensional image. The specific encoding steps are as follows:
[0023] First, for N s The voltage of electrical device k obtained through preprocessing of timestamps or current Normalization is performed to normalize the timing signal to the range [-1, 1], as shown in the following formula:
[0024]
[0025] In the formula: x p express or The p-th value in the middle, x represents p The normalized values, where max represents the function for finding the maximum value and min represents the function for finding the minimum value;
[0026] Then, normalized The conversion from Cartesian coordinates to polar coordinates involves converting the numerical values to the angle cosine φ in polar coordinates and converting the timestamp to the radius r in polar coordinates. The conversion formulas are as follows:
[0027]
[0028] Where: φ p Let r represent the angle cosine of the p-th value in polar coordinates. p Let t represent the radius of the p-th value in the polar coordinate system. p The timestamp represents the p-th value; N represents the constant factor generated by the regularization polar coordinate system. Indicates containing N s A normalized time series signal This method of representing time-series signals in polar coordinates provides a new approach to understanding them. After the time-series signal is converted to polar coordinates, each time stamp of the time-series signal is treated as a one-dimensional space. As time goes on, the amplitude of the time-series signal bends between different corners on the circle.
[0029] Finally, the Gram angle difference field feature map is obtained by taking the angle difference of the points transformed to the polar coordinate system using a sine function, and the temporal correlation within different time intervals is identified by the angle change; the Gram angle difference field GADF definition formula is as follows:
[0030]
[0031] In the formula: Represents the Nth element in the polar coordinate system s Let I represent the cosine of the angle with respect to each value, and let I denote the unit row vector. express The transpose of .
[0032] The above-mentioned non-invasive load identification method based on Gram angle difference field feature fusion, the specific process of step two is as follows:
[0033] First, the one-dimensional voltage signal obtained through preprocessing... and current signal Normalize to the interval [-1, 1] according to equation (5);
[0034] Next, the normalized voltage and current signals are converted to polar coordinates using equation (6), and the angles in the polar coordinates are used. The radius r represents its amplitude and timestamp;
[0035] Then, GADF matrix transformation is performed using equation (7) to generate two N-sized matrices. s ×N s Two-dimensional feature map;
[0036] Finally, they are superimposed and merged to generate a 2×N size. s ×N s The three-dimensional feature map is used as a load imprint. In order to enhance the feature representation capability of the three-dimensional feature map, the value of each pixel in the feature map is multiplied by 256 and rounded down, so that the gray value range of the feature map changes from [0,1] to [0,255].
[0037] In the above-mentioned non-invasive load identification method based on Gram angle difference field feature fusion, in step three, the convolutional block attention module (CBAM) consists of a channel attention submodule and a spatial attention submodule.
[0038] Suppose we have a feature map F∈R C×H×W As input, CBAM sequentially infers the one-dimensional channel attention map M. c ∈R C ×1×1 And two-dimensional spatial attention diagram M s ∈R 1×H×W The entire attention process can be summarized as follows:
[0039]
[0040]
[0041] In the formula: This indicates that corresponding elements are multiplied one by one. During the multiplication operation, the channel attention value is broadcast along the spatial dimension, and the spatial attention value is broadcast along the channel dimension. F′ represents the channel attention weight, F″ represents the final output attention weight, R represents the real number space, C represents the number of channels in the feature map, H represents the length of the feature map, and W represents the width of the feature map.
[0042] In the channel attention module, the input feature map is first compressed in the spatial dimension using max pooling and average pooling respectively, and then aggregated to obtain two different spatial feature descriptors: and These two spatial feature descriptors are then passed to a shared network consisting of multilayer perceptrons to generate a channel attention map M. c ∈R C×1×1 To reduce parameter overhead, the hidden activation size of the multilayer perceptron is set to R. C / r×1×1 Where r is the compression ratio, the channel attention calculation formula is as follows:
[0043]
[0044] In the formula: σ represents the sigmoid function, MLP represents the multilayer perceptron, AvgPool represents average pooling, MaxPool represents max pooling, and W0∈R C / r×Cand W1∈R C×C / r Represents the weights of the multilayer perceptron;
[0045] Similarly, the spatial attention module first uses max pooling and average pooling to compress the feature map in the channel dimension, generating two two-dimensional feature maps. and Then and Two feature maps are concatenated to obtain a three-dimensional feature map with two channels. Next, a convolutional layer with a kernel size of 7×7 is used to process the feature map. Perform convolution operations to obtain a two-dimensional feature map. Finally, the input is fed into the sigmoid function to generate a two-dimensional spatial attention feature map M. s ∈R H×W The calculation process for spatial attention is as follows:
[0046]
[0047] In the formula: f 7×7 This indicates that the kernel size of the convolutional layer is 7×7.
[0048] The above-mentioned non-intrusive load identification method based on Gram angle difference field feature fusion, in step three, the structure of the constructed load identification model includes an input unit, a residual unit, a CBAM unit, and an output unit;
[0049] In the input unit, a 2×N size is first input through the input layer. s ×N s The load imprint is then used to perform preliminary feature extraction on the load imprint using convolutional layers. To reduce the influence of data distribution, the features extracted by the convolutional layers are made to have zero mean and unit variance. A batch normalization layer is added after the convolutional layers, and finally, a max pooling layer is used to reduce the feature dimensionality, thereby reducing the computational cost of subsequent units and improving the model training speed. The calculation formula for the input unit convolutional layer is as follows:
[0050]
[0051]
[0052] In the formula: Indicates the convolution operation; This represents the ω-th weight on the τ-th convolutional kernel; The input value represents the ω-th input value in the convolution operation; b represents the bias; relu represents the ReLU activation function; x l This represents the features obtained through convolution operations;
[0053] The residual unit consists of an identity mapping part and a residual part. It performs deep feature extraction based on the input unit, and its expression is:
[0054] x l+1 =h(x l )+F(xl,W l (13)
[0055] In the formula: h(x) l )=W′ l x l , where W′ l F(x) represents a 1×1 convolution operation in the identity mapping, used to adjust the number of input and output channels; l W l ) represents the mapping function of the residual part; x l+1 This represents the feature obtained after processing the residual unit;
[0056] The residual unit consists of one 3×3 convolutional layer and two 1×1 convolutional layers, with each convolutional layer followed by a batch normalization layer and a ReLU activation function. The residual unit is first connected to a 1×1 convolutional layer with 128 channels, then to a 3×3 convolutional layer with 128 channels, and finally to another 1×1 convolutional layer with 512 channels. The feature maps extracted by the identity mapping part and the residual part are fused through pixel-by-pixel addition. A CBAM unit is connected to the last 1×1 convolutional layer of the residual part, enabling the entire neural network to focus on important regions of the load imprint image during feature extraction, ignoring irrelevant regions, thus enhancing the network's feature learning ability and improving the performance of the load recognition task.
[0057] The output unit consists of two fully connected layers and is the last unit of the entire neural network, connected to the residual unit. The number of neurons in the two fully connected layers are 128 and K, respectively, and the activation functions are ReLU and softmax, respectively, where K is determined by the number of types of electrical appliances. In order to train the entire neural network to obtain the optimal parameters, the multi-class cross-entropy loss function defined in backpropagation optimization formula (14) is used:
[0058]
[0059] In the formula, Represents the true class one-hot vector of sample ζ; denoted by ζ, which represents the predicted class one-hot vector; Num represents the number of samples; and k represents the class to which the sample belongs.
[0060] The beneficial effects of this invention are as follows: This invention applies Gram angle difference field theory to load imprint construction, enhancing the representation capability of one-dimensional voltage and current signals, thereby improving the distinguishability between different load characteristics. Furthermore, the introduction of a convolutional block attention module into the load identification model helps the model obtain more useful information needed for load identification from the load imprint, suppressing other useless information, further improving the load identification capability. Through numerical examples, the average recognition accuracy of the method of this invention reaches 98.36%, and the average F1 score reaches 98.46%. In-depth discussion and analysis through comparative experiments demonstrate that this method has better recognition capabilities. Attached Figure Description
[0061] Figure 1 This is the overall flowchart of the present invention.
[0062] Figure 2 A schematic diagram for constructing load imprints.
[0063] Figure 3 This is a diagram of the structure of the convolutional block attention model.
[0064] Figure 4 Note the sub-model structure diagram.
[0065] Figure 5 This is a structural diagram of the load identification model.
[0066] Figure 6 This is a statistical chart showing the sample data volume of each electrical device in the PLAID 2018 dataset.
[0067] Figure 7 This is a schematic diagram of the training process of a CBAM-based neural network on the PLAID dataset.
[0068] Figure 8 This is the confusion matrix diagram of the final test results in the example.
[0069] Figure 9 For different N t The experimental results of the value are shown in the figure.
[0070] Figure 10 This is a diagram of the ResNet-18 network structure.
[0071] Figure 11 This is a diagram of the LeNet-5 network architecture. Detailed Implementation
[0072] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0073] like Figure 1 As shown, a non-invasive load identification method based on Gram angle difference field feature fusion includes the following steps:
[0074] Step 1: Preprocess the high-frequency steady-state data collected by the equipment to obtain a complete fundamental cycle current and voltage signal.
[0075] Load identification, a key step in non-intrusive load monitoring (NILM), aims to identify operating appliances from aggregated signals. Therefore, load identification requires extracting load characteristics from high-frequency aggregated signals. Assuming only one appliance switches at a time, the load characteristics of a single appliance can be extracted by calculating the difference in steady-state aggregated signals within a short time window before and after the switching event. The difference in active power change ΔP is used as the criterion for detecting appliance switching events, and the steady-state voltage and current signals of each appliance are extracted from the aggregated voltage and current signals as load characteristics. For ease of calculation, v is used as the basis for further analysis. off i off and v on i on This represents the steady-state aggregate voltage and current before and after the switching event of the electrical equipment. The voltage v of a single electrical equipment is taken as the average of the steady-state aggregate voltages before and after the switching event, i.e.:
[0076]
[0077] Conversely, the steady-state aggregated current signal changes due to the occurrence of electrical equipment switching events. The current i of a single electrical equipment is obtained by calculating the difference between the steady-state aggregated current before and after the switching event, i.e.:
[0078] i = i on -i off (2)
[0079] Because of v off With v on and i off with i on Since addition and subtraction operations need to be performed at the same voltage phase, and the waveform of the steady-state voltage signal is approximately sinusoidal, alignment is chosen at the positive zero-crossing point of the voltage. Furthermore, the steady-state voltage and current signals exhibit periodic changes, so a single fundamental cycle of the steady-state voltage and current signal is used to characterize the load characteristics of the electrical equipment. However, the state of the electrical equipment still changes during stable operation. To better characterize the load characteristics of the electrical equipment, continuous N-wavelength voltage and current signals are extracted. t The steady-state voltage and current signals of each fundamental frequency cycle are averaged to obtain the steady-state voltage and current signals of one complete fundamental frequency cycle. t >1;
[0080] First, assume that the sampling frequency of the steady-state voltage and current signals of the electrical equipment is f. s If the fundamental frequency is f, then the number of samples per fundamental period is N. s =f s / f, N t The number of samples for each fundamental frequency period is N. ts =N t ×N s N of electrical equipment k t The fundamental frequency cycle steady-state voltage signal and steady-state current signal Then let v k i k In v k Alignment is achieved at the positive zero-crossing point of each fundamental frequency cycle, resulting in the aligned steady-state voltage signal. and steady-state current signal as follows:
[0081]
[0082]
[0083] Finally, for and By averaging each column, a one-dimensional vector of steady-state voltage and current signals for a complete fundamental frequency cycle is obtained. and
[0084] Step 2: Encode the one-dimensional voltage and current signals using the Gram angle difference field to generate corresponding two-dimensional feature maps. Then, construct a unique load imprint by superposition and fusion. The entire load imprint construction process is as follows: Figure 2 As shown.
[0085] Gramian Angular Field (GAF) is an encoding method that converts one-dimensional time-series signals into two-dimensional images. The specific encoding steps are as follows:
[0086] First, for a voltage or current timing signal X = {x1, x2, x3, ..., xn} containing n timestamps... n The timing signal is normalized to the range [-1, 1] using the following formula:
[0087]
[0088] In the formula: x i Represents the original timing signal. This represents the normalized time-series signal; max represents the function for finding the maximum value; and min represents the function for finding the minimum value.
[0089] Then, the normalized time-series signal is transformed from Cartesian coordinates to polar coordinates, that is, its value is converted to the angle cosine φ in polar coordinates, and the timestamp is converted to the radius r in polar coordinates. The conversion formula is as follows:
[0090]
[0091] Where: φ i Let r represent the angular cosine in polar coordinates. i t represents the radius in polar coordinates. i Represents the timestamp; N represents the spatial constant generated by the regularized polar coordinate system. This represents a sequence of n normalized time signals. This method of representing time-series signals in polar coordinates provides a new approach to understanding them. After the time-series signal is converted to polar coordinates, each time stamp of the time-series signal is treated as a one-dimensional space. As time goes on, the amplitude of the time-series signal bends between different corners on the circle.
[0092] Finally, the Gram angle difference field feature map is obtained by taking the angle difference of the points transformed to the polar coordinate system using a sine function, and the temporal correlation within different time intervals is identified by the angle change; the Gram angle difference field GADF definition formula is as follows:
[0093]
[0094] In the formula: I represents the unit row vector, express The transpose of .
[0095] The specific process of step two is as follows:
[0096] First, the one-dimensional voltage signal obtained through preprocessing... and current signal Normalize to the interval [-1, 1] according to equation (5);
[0097] Next, the normalized voltage and current signals are converted to polar coordinates using equation (6), and the angles in the polar coordinates are used. The radius r represents its amplitude and timestamp;
[0098] Then, GADF matrix transformation is performed using equation (7) to generate two N-sized matrices. s ×N s Two-dimensional feature map;
[0099] Finally, they are superimposed and merged to generate a 2×N size. s ×N sThe three-dimensional feature map is used as a load imprint. In order to enhance the feature representation capability of the three-dimensional feature map, the value of each pixel in the feature map is multiplied by 256 and rounded down, so that the gray value range of the feature map changes from [0,1] to [0,255].
[0100] Step 3: By superimposing and fusing the inputs into a neural network based on convolutional block attention modules, a load recognition model is constructed to complete load recognition.
[0101] The Convolutional Block Attention Module (CBAM) consists of a channel attention submodule and a spatial attention submodule; it can extract important features from both spatial and channel dimensions and suppress unnecessary features. Its structure is shown below. Figure 3 .
[0102] CBAM is a lightweight attention module that can be seamlessly integrated with CNNs to improve their feature extraction capabilities, guide CNNs to better capture key regions in images, suppress background and unnecessary attention areas, and enhance image recognition capabilities. Assume a feature map F∈R... C×H×W As input, CBAM sequentially infers the one-dimensional channel attention map M. c ∈R C×1×1 And two-dimensional spatial attention diagram M s ∈R 1×H×W The entire attention process can be summarized as follows:
[0103]
[0104]
[0105] In the formula: This indicates that corresponding elements are multiplied one by one. During the multiplication operation, the channel attention value is broadcast along the spatial dimension, and the spatial attention value is broadcast along the channel dimension. F′ represents the channel attention weight, F″ represents the final output attention weight, R represents the real number space, C represents the number of channels in the feature map, H represents the length of the feature map, and W represents the width of the feature map.
[0106] The specific calculation process of the channel attention module and spatial attention module of CBAM is as follows: Figure 4 As shown;
[0107] In the channel attention module, the input feature map is first compressed in the spatial dimension using max pooling and average pooling respectively, and then aggregated to obtain two different spatial feature descriptors: and These two spatial feature descriptors are then passed to a shared network consisting of multilayer perceptrons to generate a channel attention map M. c ∈R C×1×1To reduce parameter overhead, the hidden activation size of the multilayer perceptron is set to R. C / r×1×1 Where r is the compression ratio, the channel attention calculation formula is as follows:
[0108]
[0109] In the formula: σ represents the sigmoid function, MLP represents the multilayer perceptron, AvgPool represents average pooling, MaxPool represents max pooling, and W0∈R C / r×C and W1∈R C×C / r Represents the weights of the multilayer perceptron;
[0110] Similarly, the spatial attention module first uses max pooling and average pooling to compress the feature map in the channel dimension, generating two two-dimensional feature maps. and Then and Two feature maps are concatenated to obtain a three-dimensional feature map with two channels. Next, a convolutional layer with a kernel size of 7×7 is used to process the feature map. Perform convolution operations to obtain a two-dimensional feature map. Finally, the input is fed into the sigmoid function to generate a two-dimensional spatial attention feature map M. s ∈R H×W The calculation process for spatial attention is as follows:
[0111]
[0112] In the formula: f 7×7 This indicates that the kernel size of the convolutional layer is 7×7.
[0113] like Figure 5 As shown, the structure of the constructed load identification model includes an input unit, a residual unit, a CBAM unit, and an output unit.
[0114] In the input unit, a size of N is first input through the input layer. s ×N s The load imprint is multiplied by 2, and then a convolutional layer is used to perform preliminary feature extraction on the load imprint. To reduce the influence of data distribution, the features extracted by the convolutional layer are made to have zero mean and unit variance. A batch normalization layer is added after the convolutional layer, and finally a max pooling layer is used to reduce the feature dimensionality, thereby reducing the computational cost of subsequent units and improving the model training speed. The calculation formula for the input unit convolutional layer is as follows:
[0115]
[0116] In the formula: Indicates the convolution operation; The value represents the i-th weight on the j-th convolutional kernel; b represents the bias; relu represents the ReLU activation function; x l This represents the features obtained through convolution operations;
[0117] The residual unit consists of an identity mapping part and a residual part. It performs deep feature extraction based on the input unit, and its expression is:
[0118] x l+1 =h(x l )+F(x l W l (13)
[0119] In the formula: h(x) l )=W′ l x l , where W′ l F(x) represents a 1×1 convolution operation in the identity mapping, used to adjust the number of input and output channels; l W l ) represents the mapping function of the residual part; x l+1 This represents the feature obtained after processing the residual unit;
[0120] The residual unit consists of one 3×3 convolutional layer and two 1×1 convolutional layers, with each convolutional layer followed by a batch normalization layer and a ReLU activation function. The residual unit is first connected to a 1×1 convolutional layer with 128 channels, then to a 3×3 convolutional layer with 128 channels, and finally to another 1×1 convolutional layer with 512 channels. The feature maps extracted by the identity mapping part and the residual part are fused through pixel-by-pixel addition. A CBAM unit is connected to the last 1×1 convolutional layer of the residual part, enabling the entire neural network to focus on important regions of the load imprint image during feature extraction, ignoring irrelevant regions, thus enhancing the network's feature learning ability and improving the performance of the load recognition task.
[0121] The output unit consists of two fully connected layers and is the last unit of the entire neural network, connected to the residual unit. The number of neurons in the fully connected layers are 128 and K, respectively, and the activation functions are ReLU and softmax, respectively, where K is determined by the number of types of electrical appliances. In order to train the entire neural network to obtain the optimal parameters, the multi-class cross-entropy loss function defined in backpropagation optimization formula (14) is used:
[0122]
[0123] In the formula, Represents the true class one-hot vector of sample i; Let N represent the predicted class one-hot vector for sample i; N represents the number of samples.
[0124] Case Analysis
[0125] To verify the effectiveness and feasibility of the proposed method, this invention selects the PLAID public dataset for example analysis. The PLAID dataset records electricity consumption data from over 60 households in Pittsburgh, Pennsylvania, USA, and has been updated three times: PLAID 2014, PLAID 2017, and PLAID 2018. This invention chooses the latest version, PLAID 2018, for example verification, which contains 1876 sets of voltage and current data for 17 different electrical appliances, with a fundamental frequency of 60Hz and a sampling frequency of 30kHz. The hardware platform for this invention's example calculation is a computer with an Intel i7-9700K CPU, an NVIDIA RTX 2028 Ti GPU, and 64GB of RAM. The software platform is a Windows 10 operating system, Python 3.8 programming language, the Keras 3.4.2 deep learning framework, and Tensorflow 2.4.0.
[0126] To more comprehensively evaluate the load identification method of this invention, three evaluation metrics are used: confusion matrix, accuracy, and F1 score. The confusion matrix is used to evaluate the overall effectiveness of load identification, visually displaying the model's identification results for each category. Each row represents the true category of the load, and each column represents the predicted category. The values in the diagonal cells represent correctly identified loads, while the values in the off-diagonal cells represent incorrectly identified loads. Accuracy is used to evaluate the overall effectiveness of load identification; its value is the ratio of the number of correctly identified load instances to the total number of load instances, calculated using the following formula:
[0127]
[0128] Where: n true Indicates the number of correctly identified instances, n total This indicates the total number of load instances.
[0129] The F1 score is used to evaluate the identification effect of each load category. It can balance precision P and recall R and comprehensively evaluate the load identification method. It can be calculated by equations (16)-(18).
[0130]
[0131]
[0132]
[0133] In the formula: T P F represents the true cases, that is, the number of loads that are actually positive and are predicted as positive; P This represents false positives, i.e., the number of loads that are actually negative but are predicted as positive; F N This represents a true negative example, which is the number of instances where the load is actually positive but is predicted as negative.
[0134] This invention first visualizes the number of samples for each type of electrical device in the PLAID 2018 dataset, such as... Figure 6 As shown. By Figure 6 It was found that the sample size for five electrical appliances—soldering iron, coffee machine, kettle, electric iron, and blender—was relatively small. Therefore, during the verification process of this invention, samples of these five electrical appliances were removed, and only those samples were selected. Figure 6 The PLAID dataset is preprocessed to obtain 1824 sample instances, each containing 500 preprocessed steady-state voltage and current values. Finally, 1824 load imprints are generated using a load imprinting method, and the training and test sets are randomly divided in a 4:1 ratio. 85% of the training set is randomly selected for optimizing common model parameters, and the remaining 15% is used as a validation set for hyperparameter tuning. The test set is used to evaluate the overall model performance. Based on the constructed training and validation sets, this invention uses the Adam optimizer to train the model. During training, the batch size is set to 32, the number of training iterations is 50, and an Early-Stopping mechanism is introduced to obtain the optimal load identification model. The training process is as follows: Figure 7 As shown. The test set was input into the trained optimal load identification model for testing, and the final test results were obtained, namely, an average accuracy of 98.36% and an average F1 score of 98.45%. The confusion matrix is shown below. Figure 8 As shown. By Figure 8 It can be seen that, except for refrigerators and air conditioners, whose recognition rates are lower than the average accuracy rate, the recognition accuracy rate of other electrical appliances is 100%.
[0135] To further explore the factors affecting load identification performance, this invention designs comparative experiments to conduct in-depth analysis and discussion on key elements in the load identification model.
[0136] During the acquisition and preprocessing of load identification data, it is necessary to first extract N. t The steady-state voltage and current signals for each fundamental frequency cycle, therefore N t The value setting affects the final performance of load identification. Therefore, this invention designs comparative experiments to discuss N. t The impact of N value on load identification performance. This invention will... tThe values were set to {5, 10, 15, 20, 25} respectively, and then the corresponding load imprints were constructed to complete the comparative experiment. The experimental results are as follows: Figure 9 As shown. By Figure 9 It can be seen that when N t When the value is low, the load imprint contains insufficient load details and cannot fully reflect the load characteristics, resulting in relatively low load identification accuracy and F1 score. When N t When the value is high, the load imprint contains too much detailed load information, amplifying the noise in the load data and resulting in poor load identification. When N t When N = 20, the load recognition effect is optimal, with recognition accuracy and F1 score reaching 98.36% and 98.45% respectively. Therefore, this invention ultimately selects N... t The value is set to 20.
[0137] This invention utilizes Gram angle difference fields to achieve voltage and current feature encoding and superposition fusion, and completes load identification through a CBAM-based neural network. Therefore, it is necessary to discuss and analyze the effectiveness of feature encoding and fusion, as well as the load identification capabilities of different neural networks. Regarding load features, this invention introduces VI trajectories for comparative experiments; the VI trajectory image resolution is 128×128. Regarding neural networks, this invention introduces two classic convolutional neural networks, ResNet-18 and LeNet-5, for comparative experiments; their network structures are shown below. Figure 10 and Figure 11 The experimental results are shown in Table 1. As can be seen from Table 1, the load imprint based on Gram angle difference field feature fusion of the present invention has a better recognition effect than the VI trajectory, with certain advantages in recognition accuracy and F1 score.
[0138] Table 1 Comparison of experimental results
[0139]
[0140] To verify the superiority of the method of this invention, this invention is compared with other advanced load identification methods in other literature. The experiments of all literature were carried out on the PLAID dataset. Among them, literature
[11] fused VI trajectory images with power numerical features and realized load identification through BP neural network. Literature
[12] proposed a non-intrusive load identification method based on VI trajectory color coding, which used color-coded VI trajectories and used K-means clustering algorithm and AlexNet neural network for identification. Literature
[13] proposed a non-intrusive fine-grained load identification method based on color coding, which used RGB color coding fusion features to construct load identifiers and realized load identification through VGG16 convolutional neural network. The accuracy comparison results of each load identification method are shown in Table 2.
[0141] Table 2 Comparison of accuracy with other load identification methods
[0142]
[0143] As shown in Table 2, the method of the present invention is generally superior to the other three advanced load identification methods in terms of the overall accuracy of identifying various electrical devices.
Claims
1. A non-invasive load identification method based on Gram angle difference field feature fusion, characterized in that, Includes the following steps: Step 1: Preprocess the high-frequency steady-state data collected by the equipment to obtain a complete fundamental cycle current and voltage signal; Step 2: Encode the one-dimensional voltage and current signals using the Gram angle difference field to generate corresponding two-dimensional feature maps; The specific process of step two is as follows: First, the one-dimensional voltage signal obtained through preprocessing... and current signal Normalize to interval ; Next, the normalized voltage and current signals are converted to polar coordinates, and the angles in the polar coordinate system are used. and radius Characterized by its amplitude and timestamp; Then, perform a GADF matrix transformation to generate two matrices of size . Two-dimensional feature map; Finally, they are superimposed and merged to generate a size of The three-dimensional feature map is used as a load imprint. In order to enhance the feature representation capability of the three-dimensional feature map, the value of each pixel in the feature map is multiplied by 256 and rounded down, so that the gray value range of the feature map changes from [0,1] to [0,255]. Step 3: By superimposing and fusing the inputs into a neural network based on convolutional block attention modules, a load recognition model is constructed to complete load recognition; The Convolutional Block Attention Module (CBAM) consists of a channel attention submodule and a spatial attention submodule. Suppose we have a feature map As input, CBAM sequentially infers the one-dimensional channel attention map. and two-dimensional space attention diagram The entire attention process can be summarized as follows: (8); (9); In the formula: This indicates that corresponding elements are multiplied one by one. During the multiplication operation, channel attention values are broadcast along the spatial dimension, while spatial attention values are broadcast along the channel dimension. Indicates channel attention weights. This indicates the final output attention weights. Represents the space of real numbers. This represents the number of channels in the feature map. Indicates the length of the feature map. Indicates the width of the feature map; In the channel attention module, the input feature map is first compressed in the spatial dimension using max pooling and average pooling respectively, and then aggregated to obtain two different spatial feature descriptors: and ; These two spatial feature descriptors are then passed to a shared network consisting of multilayer perceptrons to generate a channel attention map. To reduce parameter overhead, the hidden activation size of the multilayer perceptron is set to... , The channel attention calculation formula is as follows, based on the compression ratio: (10); In the formula: denoted by sigmoid function, MLP by multilayer perceptron, AvgPool by average pooling, and MaxPool by max pooling. and Represents the weights of the multilayer perceptron; Similarly, the spatial attention module first uses max pooling and average pooling to compress the feature map in the channel dimension, generating two two-dimensional feature maps. and Then and Two feature maps are concatenated to obtain a three-dimensional feature map with two channels. ; then using a convolution kernel size of Convolutional layers on feature maps Perform convolution operations to obtain a two-dimensional feature map. Finally, the input is fed into the sigmoid function to generate a two-dimensional spatial attention feature map. The calculation process for spatial attention is as follows: (11); In the formula: The kernel size of the convolutional layer is . .
2. The non-invasive load identification method based on Gram angle difference field feature fusion according to claim 1, characterized in that, The specific process of step one is as follows: The prerequisite for load identification is to first extract load features from the high-frequency aggregated signal. Assuming that only one electrical device experiences a switching event at the same time, the load features of a single electrical device can be extracted by calculating the difference between the steady-state aggregated signal within a short time window before and after the switching event. Using the difference in active power variation As the basis for judging the switching events of electrical equipment, the steady-state voltage and current signals of each electrical device are extracted from the aggregated voltage and current signals as load characteristics; for ease of calculation, respectively using , and , This represents the steady-state aggregate voltage and current before and after the switching event of an electrical device, and the voltage of a single electrical device. Take the average value of the steady-state aggregation voltage before and after the switching event, that is: (1); Conversely, the steady-state aggregated current signal changes due to the switching events of electrical equipment, and the current of a single electrical device changes accordingly. The difference between the steady-state polymer current before and after the switching event is obtained by calculating: (2); because and and and Since addition and subtraction operations need to be performed at the same voltage phase, and the waveform of the steady-state voltage signal is approximately sinusoidal, alignment is chosen at the positive zero-crossing point of the voltage. Furthermore, the steady-state voltage and current signals exhibit periodic changes, so a single fundamental cycle of the steady-state voltage and current signal is used to characterize the load characteristics of the electrical equipment. However, the state of the electrical equipment still changes during stable operation. To better characterize the load characteristics of the electrical equipment, continuous... The steady-state voltage and current signals of each fundamental frequency cycle are averaged to obtain the steady-state voltage and current signals of one complete fundamental frequency cycle. ; First, assume that the sampling frequency of the steady-state voltage and current signals of the electrical equipment is... The fundamental frequency is The number of samples per fundamental period is , The number of samples per fundamental frequency period is Electrical equipment of The fundamental frequency cycle steady-state voltage signal and steady-state current signal Then, let , exist Alignment is achieved at the positive zero-crossing point of each fundamental frequency cycle, resulting in the aligned steady-state voltage signal. and steady-state current signal as follows: (3); (4); In the formula: Electrical equipment No. The aligned steady-state voltage value Electrical equipment No. The aligned steady-state current value; Finally, for and By averaging each column, a one-dimensional vector of steady-state voltage and current signals for a complete fundamental frequency cycle is obtained. and .
3. The non-invasive load identification method based on Gram angle difference field feature fusion according to claim 2, characterized in that, In step two, Gram difference field is an encoding method that converts a one-dimensional time-series signal into a two-dimensional image. The specific encoding steps are as follows: First, for those containing Electrical equipment obtained through preprocessing of timestamps voltage or current Perform normalization processing to normalize the timing signal to... Within the specified range, its formula is as follows: (5); In the formula: express or The Middle One value, express The normalized value, This represents the function for finding the maximum value. This represents a function to find the minimum value; Then, normalized Transforming from Cartesian coordinates to polar coordinates involves converting the numerical values to angle cosines in polar coordinates. Convert the timestamp to a radius in polar coordinates. The conversion formula is as follows: (6); In the formula: Represents the first in the polar coordinate system The angle cosine of each value, Represents the first in the polar coordinate system The radius of each value, Indicates the first A timestamp with a value; This represents the constant factor generated by the regularization of the polar coordinate system. Indicates inclusion A normalized time series signal This method of representing time-series signals in polar coordinates provides a new approach to understanding them. After the time-series signal is converted to polar coordinates, the time-series signal at each timestamp is treated as a one-dimensional quantity space. As time goes on, the amplitude of the time-series signal bends between different corners on the circle. Finally, the Gram angle difference field feature map is obtained by taking the angle difference of the points transformed to the polar coordinate system using the sine function, and the temporal correlation within different time intervals is identified by using the angle change. Graham Point Field The formula is defined as follows: (7); In the formula: Represents the first in the polar coordinate system The angle cosine of each value, Represents a unit row vector. express The transpose of .
4. The non-invasive load identification method based on Gram angle difference field feature fusion according to claim 3, characterized in that, In step three, the structure of the constructed load identification model includes an input unit, a residual unit, a CBAM unit, and an output unit. In the input unit, the input size is first passed through the input layer. The load imprint is then used to perform preliminary feature extraction on the load imprint using convolutional layers. To reduce the influence of data distribution, the features extracted by the convolutional layers are made to have zero mean and unit variance. A batch normalization layer is added after the convolutional layers, and finally, a max pooling layer is used to reduce the feature dimensionality, thereby reducing the computational cost of subsequent units and improving the model training speed. The calculation formula for the input unit convolutional layer is as follows: (12); In the formula: Indicates the convolution operation; Indicates the first The first convolutional kernel on the _ Individual weights; Indicates the convolution operation's... One input value; Indicates bias; Represents the ReLU activation function; This represents the features obtained through convolution operations; The residual unit consists of an identity mapping part and a residual part. It performs deep feature extraction based on the input unit, and its expression is: (13); In the formula: ,in In the identity mapping Convolution is an operation used to adjust the number of input and output channels. The mapping function representing the residual part; This represents the feature obtained after processing the residual unit; The residual unit consists of one 3×3 convolutional layer and two 1×1 convolutional layers, with each convolutional layer followed by a batch normalization layer and a ReLU activation function. The residual unit is first connected to a 1×1 convolutional layer with 128 channels, then to a 3×3 convolutional layer with 128 channels, and finally to another 1×1 convolutional layer with 512 channels. The feature maps extracted by the identity mapping part and the residual part are fused through pixel-by-pixel addition. A CBAM unit is connected to the last 1×1 convolutional layer of the residual part, enabling the entire neural network to focus on important regions of the load imprint image during feature extraction, ignoring irrelevant regions, thus enhancing the network's feature learning ability and improving the performance of the load recognition task. The output unit consists of two fully connected layers and is the last unit of the entire neural network, connected to the residual unit; the two fully connected layers have 128 and 128 neurons respectively. The activation functions are ReLU and softmax, respectively. The number of electrical appliances is determined by the type of electrical equipment; in order to train the entire neural network to obtain the optimal parameters, the multi-class cross-entropy loss function defined in backpropagation optimization formula (14) is used: (14); In the formula, Indicates sample The true class one-hot vector; Indicates sample The predicted category one-hot vector; Indicates the number of samples; Indicates the category to which the sample belongs.