Electric power consumption activity real-time identification method based on convolutional neural network
By using a convolutional neural network based on the LeNet-5 architecture and the Gramian Angular Field method, one-dimensional power data is converted into two-dimensional images, which solves the problems of high deployment cost, privacy leakage, insufficient real-time performance and low recognition accuracy in existing power consumption activity identification. It achieves intelligent recognition with a response time of seconds and a recognition accuracy of 95.14%.
Patent Information
- Application Number
- CN202511017391.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-11-07
AI Technical Summary
Existing electricity consumption activity identification technologies suffer from high deployment costs, privacy leaks, insufficient real-time performance, limited identification accuracy, lack of deep feature extraction capabilities and overall scenario considerations, and lack of lightweight real-time solutions.
A convolutional neural network based on the LeNet-5 architecture, combined with the Gramian Angular Field method, is used to convert one-dimensional power data into two-dimensional images. Real-time recognition is achieved in seconds through sliding window processing, and the feature extraction capability of CNN is used for intelligent identification of power consumption activities.
It achieves intelligent recognition of the entire scene, significantly improving recognition accuracy and real-time performance, automatically extracting deep features, meeting the requirements of second-level response, and achieving a recognition accuracy rate of 95.14%.
Smart Images

Figure CN120912902A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of electric power, and particularly to a real-time identification method for electric power consumption activities based on a convolutional neural network. BACKGROUND
[0002] With the deepening of the digitalization and intelligentization transformation of global energy systems, the intelligentization level of terminal electricity consumption scenarios has become an important part of promoting the modernization development of the entire energy system. According to the forecast of the International Energy Agency, by 2050, the proportion of electric power in terminal consumption will increase from 20% to nearly 50%. Under this background, accurate identification and real-time monitoring of electric power consumption activities have become a key technical requirement for realizing intelligent electricity consumption.
[0003] Currently, electric power consumption activity identification technology mainly focuses on research in the directions of advanced metering infrastructure (AMI), user energy management system (UEMS), and non-intrusive load monitoring (NILM). AMI, as a key infrastructure for building smart grids, can automatically collect, transmit, and store user electricity consumption data, providing data support for upper-layer applications. Its core function is to realize high-precision automatic collection, transmission, storage, and preliminary analysis of user electricity consumption information through an integrated system composed of smart sockets, electricity meters, edge computing gateways, and other devices. UEMS realizes fine monitoring and control of user electricity consumption behavior through the integration of powerful sensing capabilities and complex optimization algorithms.
[0004] In terms of specific technical implementation of electric power consumption activity identification, existing research mainly adopts methods based on statistical learning. Non-intrusive load monitoring (NILM) technology identifies the working state of various electrical devices by analyzing the total electricity consumption of users, but this method mainly targets device-level identification and lacks in-depth analysis of user activity patterns. The smart socket load type identification system realizes the classification and identification of socket loads through hardware architecture, but the identification range is limited and the real-time performance is insufficient.
[0005] In recent years, the rapid development of deep learning technology has brought new technical paths for electric power consumption activity identification. Convolutional neural networks (CNN), as an important branch of deep learning, have shown strong feature extraction capabilities and excellent classification performance in image recognition, pattern classification, and other tasks. In particular, classic CNN architectures such as LeNet-5 provide a technical foundation for real-time identification tasks due to their simple and effective network structure and lightweight characteristics. Image processing methods for time series data, such as Gramian Angular Field (GAF) technology, provide an effective way to convert one-dimensional electric power data into two-dimensional images.
[0006] Defects and deficiencies of existing technologies:
[0007] High deployment cost and privacy issues: Existing user energy management systems require a large number of invasive data collection devices and accurate power consumption data collection as support, resulting in high deployment costs and privacy issues such as user privacy leakage.
[0008] Lack of overall scene consideration: The existing device-centric control method does not consider the connection and conflict between the power consumption activity of a single device and the overall scene power consumption activity, making it difficult to solve the problem of how to make the overall scene power consumption more intelligent.
[0009] Insufficient real-time performance: Traditional power consumption activity recognition methods are mostly based on batch processing mode, and the calculation time is longer when processing continuous power data stream, which cannot meet the real-time recognition demand of seconds or minutes.
[0010] Limited recognition accuracy: Existing non-intrusive load monitoring technology mainly targets device-level recognition, and the recognition accuracy is low for complex power consumption patterns, especially when facing different activities with similar power characteristics, which is prone to misjudgment and omission.
[0011] Lack of deep feature extraction capability: Traditional methods mainly rely on manually designed features, lack of automatic extraction capability of deep features of power consumption data, and are difficult to capture the implicit patterns and rules in the data.
[0012] Limitations of time series processing: Existing methods often cannot fully utilize the time dependence and spatial correlation characteristics in the data when processing one-dimensional time series power data, affecting the recognition effect.
[0013] Lack of lightweight real-time solution: Existing technologies lack lightweight deep learning models specifically designed for real-time recognition of power consumption activities, making it difficult to balance recognition accuracy, computational efficiency and response speed. SUMMARY
[0014] The purpose of the present application is to provide a power consumption activity real-time recognition method based on convolutional neural network to solve the problems raised in the above background art.
[0015] To achieve the above purpose, the present application provides the following technical solutions:
[0016] A power consumption activity real-time recognition method based on convolutional neural network, comprising the following steps:
[0017] S1. Data preprocessing: Collect the original power data of the power consumption scene, resample to generate equal-interval power sequence P=p1, p2,..., p T , where T is the sequence length, and the GAF method is used to convert the one-dimensional power sequence into two-dimensional image data;
[0018] S2. CNN model construction: a convolutional neural network based on LeNet-5 architecture is constructed, and optimization and improvement are made for the power consumption activity recognition task, including:
[0019] (1) Input layer: receiving 64x64 GAF image data;
[0020] (2) First convolutional layer: 32 5x5 convolutional kernels, step size 1, using ReLU activation function;
[0021] (3) First pooling layer: 2x2 max pooling, step size 2;
[0022] (4) Second convolutional layer: 64 5x5 convolutional kernels, step size 1, using ReLU activation function;
[0023] (5) Second pooling layer: 2x2 max pooling, step size 2;
[0024] (6) Fully connected layer 1: 120 neurons, using ReLU activation function;
[0025] (7) Fully connected layer 2: 84 neurons, using ReLU activation function;
[0026] (8) Output layer: K neurons, K is the number of activity categories, using Softmax activation function;
[0027] S3 Real-time recognition:
[0028] S3.1 Sliding window processing: for real-time data stream, sliding window method is adopted: set window size w, step size s, for power data at time t, extract sequence P t = p t-w+1 ,p t-w+2 , …, p t , then perform GAF conversion and CNN recognition;
[0029] S3.2 Recognition decision:
[0030] In the probability vector Y = [y1, y2, …, y K ] output by the network, the class with the maximum probability is selected as the recognition result:
[0031] Activity = argmax i (y i ) (18)
[0032] At the same time, the confidence of recognition is judged by the probability value:
[0033] Confidence = max i (y i ) (19).
[0034] As a further preferred embodiment of the present application: the method of converting one-dimensional power sequence into two-dimensional image data in step S1 using GAF method is as follows:
[0035] (1) Data normalization: normalize the power sequence to the range of [-1, 1], eliminate unit difference and improve calculation stability
[0036] Qualitative:
[0037]
[0038] (2) Angle conversion: convert the normalized data to the corresponding angle value:
[0039]
[0040] (3) GAF image generation: generate a two-dimensional image using the GASF (Gramian Angular Summation Field) method
[0041] Image:
[0042] GASF(i,j) = cos(θ i +θ j ) (3)
[0043] Where GASF(i,j) represents the pixel value of position (i,j) in the generated image.
[0044] As a further preferred embodiment of the present application: in step S2, assuming that the GAF image received by the input layer is X ∈ R (64 ×64) , the forward propagation process of the convolutional neural network is as follows:
[0045] (1) First convolutional layer output:
[0046] C1 = ReLU(W1 * X + b1) (4)
[0047] Where W1 is the first layer convolution kernel weight, b1 is the bias term, and * represents the convolution operation.
[0048] (2) First pooling layer output:
[0049] P1 = MaxPool(C1) (5)
[0050] (3) Second convolutional layer output:
[0051] C2 = ReLU(W2 * P1 + b2) (6)
[0052] (4) Second pooling layer output:
[0053] P2 = MaxPool(C2) (7)
[0054] (5) Full connection layer calculation:
[0055] F1 = ReLU(W3·Flatten(P2) + b3) (8)
[0056] F2 = ReLU(W4·F1 + b4) (9)
[0057] (6) Output layer calculation:
[0058] Y = Softmax(W5·F2 + b5) (10)
[0059] Where Y ∈ R K represents the probability distribution of each activity category.
[0060] As a further preferred scheme of the application: the training process of the convolutional neural network based on LeNet-5 architecture in step S2 is as follows:
[0061] The network is trained using a cross-entropy loss function:
[0062]
[0063] Where N is the batch size, K is the number of categories, y ij is the one-hot encoding of the true label, is the network prediction probability;
[0064] The network parameters are updated using the Adam optimizer:
[0065] m t = β1×m t-1 +(1-β1)×g t (12)
[0066]
[0067] Where g t is the gradient, m t and v t are the first and second moment estimates, respectively;
[0068] Weight decay technique is used to prevent overfitting:
[0069]
[0070] Where in = 5 × 10 (-4) is the weight decay coefficient.
[0071] Compared with the prior art, the application has the following advantages:
[0072] 1. Realize the intelligent recognition of the overall scene
[0073] The present application can identify the complete power consumption activity mode by analyzing the total power curve of the entire power consumption scene, rather than only recognizing the working state of a single device. This overall recognition method can better understand the user's power consumption behavior, provide more comprehensive and accurate decision basis for subsequent intelligent control and energy management, and thus realize the intelligent management of the entire scene power consumption.
[0074] 2. Significantly improve real-time performance
[0075] The present application adopts the lightweight LeNet-5 network architecture, which has a much lower computational complexity than traditional complex machine learning models. The two-dimensional image data after GAF preprocessing can be quickly input into the network for inference, realizing real-time recognition response in seconds or even sub-seconds. The forward propagation process of the network is simple and efficient, which can meet the application requirements of real-time monitoring and rapid response.
[0076] 3. Greatly improve the recognition accuracy
[0077] The present application utilizes the powerful feature extraction capability of CNN to automatically learn the deep feature representation of power consumption activity, which significantly improves the recognition accuracy compared with the traditional manual feature design. Experimental results show that the accuracy of the method on the training set, validation set and test set is more than 91%, and the recognition accuracy in the actual application scene reaches 95.14%, which is much higher than the recognition performance of traditional methods.
[0078] 4. Automatic deep feature extraction
[0079] The present application can automatically extract hierarchical feature representation from power consumption data through the multi-layer convolution and pooling operation of CNN, without the need for manual design of feature extractor. The network can learn from low-level edge features to high-level semantic features, fully excavate the implicit patterns and rules in the data, and improve the modeling ability of complex power consumption activities.
[0080] 5. Effective use of time series characteristics
[0081] The present application innovatively uses the GAF method to convert one-dimensional time series power data into two-dimensional images. This conversion not only maintains the time dependence of the original time series, but also encodes the relationship between time points in the form of image pixels. CNN can capture features in both time and space dimensions when processing two-dimensional images, fully utilizing the time series characteristics and internal relations of power consumption activities. BRIEF DESCRIPTION OF DRAWINGS
[0082] Figure 1 The flowchart of the method of the present application. DETAILED DESCRIPTION
[0083] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0084] The core concept of the present application is defined as follows:
[0085] The power consumption activity described in the present application refers to a power consumption process with a clear start and end time driven by user behavior in a power consumption scenario, such as office work, meeting, rest, and other activity states in a specific time period. Real-time identification refers to the ability to complete the judgment and classification of the current power consumption activity type within seconds or minutes after data collection.
[0086] Please refer to Figure 1 In the embodiments of the present application, a power consumption activity real-time identification method based on a convolutional neural network has the following specific steps:
[0087] Data preprocessing stage
[0088] Data resampling
[0089] In order to eliminate the influence of irregular sampling, the original power value and timestamp pair are resampled first to convert them into a power sequence with equal time intervals. Let the original power sequence be P r aw=(p1,t1),(p2,t2),...,(p n n,t n n), where p i is the power value and t i is the corresponding timestamp. Through a linear interpolation method, a power sequence P=p1,p2…,p T is generated, where T is the sequence length and the time interval is set to 5 minutes.
[0090] Gramian Angular Field (GAF) conversion
[0091] In order to fully utilize the advantages of CNN in image processing, the GAF method is used to convert the one-dimensional power sequence into two-dimensional image data. The specific steps are as follows:
[0092] (1) Data normalization: normalize the power sequence to the range of [-1, 1] to eliminate unit differences and improve calculation stability
[0093] Qualitative:
[0094]
[0095] (2) Angle Conversion: Convert the normalized data to corresponding angle values:
[0096]
[0097] (3) GAF Image Generation: Generate a two-dimensional image using the GASF (Gramian Angular Summation Field) method:
[0098] GASF(i,j) = cos(θ i + θ j ) (3)
[0099] where GASF(i,j) represents the pixel value at position (i,j) in the generated image. This conversion method preserves the time-dependent relationship of the original time series and encodes the mutual relationship between different time points in the form of image pixels.
[0100] CNN Network Architecture Based on LeNet-5
[0101] Network Structure Design
[0102] The CNN network constructed in this application is based on the LeNet-5 architecture and has been optimized and improved for the power consumption activity recognition task. The network structure includes:
[0103] (1) Input Layer: Receives 64x64 GAF image data
[0104] (2) First Convolutional Layer: 32 5x5 convolutional kernels, step size 1, using ReLU activation function
[0105] (3) First Pooling Layer: 2x2 max pooling, step size 2
[0106] (4) Second Convolutional Layer: 64 5x5 convolutional kernels, step size 1, using ReLU activation function
[0107] (5) Second Pooling Layer: 2x2 max pooling, step size 2
[0108] (6) Fully Connected Layer 1: 120 neurons, using ReLU activation function
[0109] (7) Fully Connected Layer 2: 84 neurons, using ReLU activation function
[0110] (8) Output Layer: K neurons (K is the number of activity categories), using Softmax activation function.
[0111] Network Forward Propagation Process
[0112] Let the input GAF image be X ∈ R (64×64) The forward propagation process of the network is as follows:
[0113] (1) The output of the first convolutional layer:
[0114] C1 = ReLU (W1 * X + b1) (4)
[0115] Where W1 is the first layer convolution kernel weight, b1 is the bias term, and * represents the convolution operation.
[0116] (2) The output of the first pooling layer:
[0117] P1 = MaxPool (C1) (5)
[0118] (3) The output of the second convolutional layer:
[0119] C2 = ReLU (W2 * P1 + b2) (6)
[0120] (4) The output of the second pooling layer:
[0121] P2 = MaxPool (C2) (7)
[0122] (5) Full connection layer calculation:
[0123] F1 = ReLU (W3 * Flatten (P2) + b3) (8)
[0124] F2 = ReLU (W4 * F1 + b4) (9)
[0125] (6) Output layer calculation:
[0126] Y = Softmax (W5 * F2 + b5) (10)
[0127] Where Y ∈ R K represents the probability distribution of each activity category.
[0128] Network training process
[0129] Loss function
[0130] The network is trained using the cross-entropy loss function:
[0131]
[0132] Where N is the batch size, K is the number of categories, y ij is the one-hot encoding of the true label, is the network prediction probability.
[0133] Optimization algorithm
[0134] The network parameters are updated using the Adam optimizer:
[0135] m t = β1×m t-1 + (1-β1)×g t (12)
[0136]
[0137] where g t is the gradient, m t and v t are the first and second moment estimates, respectively.
[0138] Regularization techniques
[0139] To prevent overfitting, weight decay techniques are used:
[0140]
[0141] where λ = 5 × 10 (-4) is the weight decay coefficient.
[0142] Real-time identification process
[0143] Sliding window processing
[0144] For real-time data streams, a sliding window method is used: set the window size as w and the step size as s. For the power data at time t, extract the sequence P t = p t-w+1 , p t-w+2 , …, p t , then perform GAF conversion and CNN identification.
[0145] Identification decision
[0146] In the probability vector Y = [y1, y2, …, y K ] output by the network, the class with the maximum probability is selected as the identification result:
[0147] Activity = argmax i (y i ) (18)
[0148] At the same time, the confidence of the identification can be judged by the probability value:
[0149] Confidence = max i (y i ) (19).
[0150] It will be obvious to a person skilled in the art that the application is not limited to the details of the foregoing exemplary embodiments and can be implemented in other concrete forms without departing from the spirit or essential characteristics of the application. The embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. No reference signs in the claims should be considered as limiting the scope of the claims to the identity of the reference signs therein.
[0151] Furthermore, it should be understood that although the description is made on the basis of the embodiments, not every embodiment contains only one independent technical solution, and the description of the specification is only for the sake of clarity, and those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that those skilled in the art can understand.
Claims
1.A method for real-time identification of power consumption activities based on convolutional neural network, characterized in that, Comprising the following steps: S1. Data preprocessing: Collect the original power data of the power consumption scene, resample to generate equal-interval power sequence P = p1, p2,..., p T where T is the sequence length, and the GAF method is used to convert the one-dimensional power sequence into two-dimensional image data; S2. CNN model construction: a convolutional neural network based on LeNet-5 architecture is constructed, and optimized and improved for power consumption activity recognition tasks, including: (1) Input layer: receiving 64x64 GAF image data; (2) First convolutional layer: 32 5x5 convolutional kernels, step size 1, using ReLU activation function; (3) First pooling layer: 2x2 max pooling, step size 2; (4) Second convolutional layer: 64 5x5 convolutional kernels, step size 1, using ReLU activation function; (5) Second pooling layer: 2x2 max pooling, step size 2; (6) Fully connected layer 1: 120 neurons, using ReLU activation function; (7) Fully connected layer 2: 84 neurons, using ReLU activation function; (8) Output layer: K neurons, K is the number of activity categories, using Softmax activation function; S3 Real-time recognition: S3.1 Sliding window processing: for real-time data stream, the sliding window method is adopted: set the window size as w and the step as s, for the power data at time t, extract the sequence P t = p t-w+1 , p t-w+2 , …, p t , and then perform GAF conversion and CNN identification; S3.2 Recognition decision: The network outputs a probability vector Y = [y1, y2, ..., y]. K In the [reference], the category with the highest probability is selected as the recognition result: Activity = argmax i (y i ) (18) At the same time, the confidence of recognition is judged by the probability value: Confidence = max i (y i ) (19). 2.The power consumption activity real-time identification method based on a convolutional neural network according to claim 1, characterized in that, The method for converting one-dimensional power sequence to two-dimensional image data in step S1 is as follows: (1) Data normalization: normalize the power sequence to the range of [-1, 1] to eliminate unit differences and improve calculation stability: (2) Angle conversion: convert the normalized data to corresponding angle values: (3) GAF image generation: generate a two-dimensional image using the GASF (Gramian Angular Summation Field) method: GASF(i,j) = cos(θ i +θ j ) (3) Where GASF(i,j) represents the pixel value of position (i,j) in the generated image. 3.The power consumption activity real-time identification method based on a convolutional neural network according to claim 1, characterized in that, In the step S2, assuming that the GAF image received by the input layer is X ∈ R (64×64) The forward propagation process of the convolutional neural network is as follows: (1) First convolutional layer output: C1 = ReLU(W1 * X + b1) (4) Where W1 is the first layer convolutional kernel weight, b1 is the bias term, and * represents convolution operation; (2) First pooling layer output: P1 = MaxPool(C1) (5) (3) Second convolutional layer output: C2 = ReLU(W2 * P1 + b2) (6) (4) Second pooling layer output: P2 = MaxPool(C2) (7) (5) Fully connected layer calculation: F1 = ReLU(W3 * Flatten(P2) + b3) (8) F2 = ReLU(W4 F1 + b4) (9) (6) Output layer calculation: Y = Softmax(W5 * F2 + b5) (10) where Y ∈ R K represent the probability distribution of each activity category. 4.The power consumption activity real-time identification method based on a convolutional neural network according to claim 1, characterized in that, The training process of the convolutional neural network based on LeNet-5 architecture in step S2 is as follows: Train the network using cross-entropy loss function: where N is batch size, K is the number of classes, y ij is one-hot encoding of the true label, is the network prediction probability; Update network parameters using Adam optimizer: m t = β1 x m t-1 + (1 - β1) x g t (12) where g t is the gradient, m t and v t are the first and second moment estimates, respectively; Prevent overfitting using weight decay technique: where λ = 5 x 10 (-4) is a weight decay coefficient.