Load identification method and device based on LAB color space feature extraction and random forest

By using LAB color space feature extraction and random forest methods in electric load forecasting, the problem of insufficient classification in the existing technology is solved, achieving higher accuracy and interpretability, and meeting the classification needs of actual electric loads. .

CN118691870APending Publication Date: 2024-09-24STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410359824.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Existing power load forecasting methods have problems such as inaccurate classification and ambiguous types, making it difficult to meet the classification needs of actual power loads.

Method used

A load identification method based on LAB color space feature extraction and random forest is used to establish a load identification model through feature extraction and classification learning in the offline stage, and feature extraction and load identification are performed in the online stage. Specific steps include image color space conversion, histogram calculation, normalization processing, and learning load class relationships using a random forest classifier.

Benefits of technology

It improves the accuracy of the model, reduces the risk of over-fitting, enhances the interpretability of the model, and achieves better image classification prediction performance and running speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691870A
    Figure CN118691870A
Patent Text Reader

Abstract

The invention discloses a load identification method based on LAB color space feature extraction and a random forest. The load identification method comprises an offline stage and an online stage. The off-line stage comprises an off-line step 1, a load image feature extraction step; an offline step 2: a classification learning step; the on-line stage comprises an on-line step 1, an on-line feature extraction step; and an online step 2: an online load identification step. According to the method, the LAB color space is used for feature extraction, so that the accuracy of the model can be improved, more information can be provided by using different color spaces, the classification model is helped to better capture the features of data, the accuracy of the model is improved, and the speed and accuracy of image classification and recognition are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image feature recognition, and in particular to a load recognition method based on LAB color space feature extraction and random forest. Background Art

[0002] In recent years, with the increasing popularity of grid demand-side management and the deepening of load regulation, power users are no longer just passive power demanders as in the past. The characteristics of traditional rigid loads have gradually changed, and flexible loads have become the focus of grid load regulation. The reform of the power market has led to the emergence of various role scenarios, and the application scenarios of load forecasting have gradually become diversified and hierarchical. Reasonable analysis of typical characteristics of load scenarios and selection of accurate forecasting models for them have become important issues in the development of the power industry today.

[0003] The deep learning prediction method is a machine learning method that uses a neural network as a parameter structure for optimization. Neural networks, also known as artificial neural networks, are mathematical models that imitate the information transmission and processing of biological neural networks. The model processes input information in parallel or serially through a large number of nodes to obtain one or more output targets. This model has the characteristics of high complexity, strong adaptability, and adaptive learning data, so it is widely used. Currently, the neural networks widely used in power load forecasting include error back propagation neural networks (BP), convolutional neural networks, and recurrent neural networks.

[0004] BP neural network is a multi-layer neural network trained by back propagation algorithm, which is divided into two processes, namely forward propagation of information and back propagation of error. In forward propagation, information starts from the input layer, extracts information and features through the hidden layer, and finally outputs the results by the output layer. The BP neural network is applied to short-term power forecasting and obtains better forecasting results.

[0005] Convolutional neural network (CNN) is a deep neural network with a convolutional structure that can efficiently process image data or image sequence data, and can also process power data. The full convolutional network and causal logic constraints are used to enhance the expression of time series features, and multi-scale convolution kernels are used to extract features of different time lengths, thereby improving the accuracy and stability of the model in predicting power load.

[0006] Recurrent Neural Network (RNN) is a neural network model that uses the output as part of the next input. This model can capture the correlation between the previous and next outputs, and its characteristics can also be used for power load forecasting. Long Short-Term Memory Network (LSTM) effectively solves the problem of long-term dependency in RNN. Although the convolutional neural network reduces the number of parameters by calculating the sliding convolution kernel according to the step size, it makes it impossible to use matrix operations for extracting irrelevant features, which in turn limits the reasoning speed of the model. Recurrent neural networks can adapt well to the temporal characteristics of power data, and LSTM can spontaneously remember long-term dependencies, but the slow training speed, high training difficulty and poor interpretability of the model make the LSTM-based power forecasting model need further research.

[0007] The existing load identification methods have the problems of broad and inaccurate classification, and the types are relatively vague, making it difficult to distinguish load types and make corresponding adjustments, which makes it difficult to meet the classification needs of actual power loads. Summary of the invention

[0008] The purpose of the present invention is to overcome the deficiencies of the prior art and to provide a load identification method and device based on LAB color space feature extraction and random forest.

[0009] A technical solution to achieve the above purpose is: a load identification method based on LAB color space feature extraction and random forest, including an offline stage and an online stage;

[0010] The offline phase includes:

[0011] Offline step 1: feature extraction step of load image;

[0012] Offline step 2: classification learning step;

[0013] The online phase includes:

[0014] Online step 1: online feature extraction step;

[0015] Online step 2: Online load identification step.

[0016] Furthermore, the offline step 1 is specifically to extract the features of the signal under different load images as the feature fingerprint information of the training data.

[0017] Furthermore, the offline step 1 includes the following steps:

[0018] Offline step 1-1: Image color space feature conversion, using color space conversion to convert RGB images into LAB color space images respectively;

[0019] Offline step 1-2: Extraction of image features in the image color space, using the color space histogram to calculate the values ​​of the three channels;

[0020] Offline steps 1-3: Channel value normalization, normalize the obtained histogram values.

[0021] Furthermore, the offline step 2 is specifically as follows: using a random forest classifier to learn the relationship between image features and corresponding load categories to obtain a load recognition model.

[0022] Furthermore, the model training of offline step 2 includes the following steps:

[0023] Offline step 2-1: Divide the dataset into training set and test set;

[0024] Offline step 2-2: Create a random forest classifier and train it using the training set.

[0025] Furthermore, online step 1: the online feature extraction step is to extract the current signal features using the method of offline step 1.

[0026] Furthermore, in the online step 2, the online load identification step is to use the load identification model obtained in the offline step 2, and send the signal features extracted in the online step 1 into the model to obtain the current load category.

[0027] Furthermore, the modules include: a feature extraction module and a classification learning module.

[0028] Furthermore, the feature extraction module extracts the load image features by utilizing numerical calculation processing and data type conversion.

[0029] Furthermore, the classification learning module uses a random forest classifier to obtain a load identification model.

[0030] The beneficial effects of the load identification method and device based on LAB color space feature extraction and random forest of the present invention are as follows:

[0031] 1. Using LAB color space for feature extraction can improve the accuracy of the model: Using different color spaces can provide more information and help the classification model better capture the characteristics of the data, thereby improving the accuracy of the model.

[0032] 2. Reduce overfitting: Using different color spaces can reduce the risk of overfitting of the model. Overfitting refers to the phenomenon that the model performs very well on the training data but performs poorly on the test data. Using different color spaces can make the model more stable and reduce the risk of overfitting.

[0033] 3. Enhance the interpretability of the model: Different color space extractions can make the model easier to interpret and help us understand how the model makes predictions. For example, we can see which features contribute more to a certain prediction result, so as to better understand the rules behind the data.

[0034] 4. The present invention has good performance in realizing image classification prediction, has strong optimization ability, and has a short running time, which helps to improve the speed and accuracy of image classification and recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of LAB color space histogram feature extraction of a load identification method based on LAB color space feature extraction and random forest of the present invention;

[0036] Figure 2 A schematic diagram of random forest classification of a load identification method based on GRAY color space feature extraction and SVM of the present invention;

[0037] Figure 3 This is the confusion matrix of the test set classification samples of the embodiment. DETAILED DESCRIPTION

[0038] In order to better understand the technical solution of the present invention, the following is a detailed description through specific embodiments:

[0039] Embodiment 1:

[0040] This embodiment provides a load identification method based on LAB color space feature extraction and random forest. First, images of load signals corresponding to different electrical appliances are constructed, and the corresponding image features are extracted for preprocessing, and a load feature database of electrical appliances is established. The image features include extracting the LAB color space histogram features of the image, normalizing the histogram features, and finally synthesizing all load image features into a two-dimensional feature matrix, which is sent to the random forest together with the label for classification model learning to obtain a random forest model.

[0041] The establishment of the load characteristic data set in the present invention is based on WHITED - a global household and industrial transient energy data set. Since it is composed of time series of different electrical appliances, and in order to further extract the characteristics of the load, a recursive graph is used to convert the load signal into an image processing form.

[0042] Offline step 1: Extract the features of different load signals in the offline stage:

[0043] 1) LAB color space features

[0044] The LAB color space is a color model used to represent color information, also known as the CIELAB color space. It is a device-independent color space designed to simulate the way the human visual system perceives color. The LAB color space is different from device-dependent color spaces such as RGB and CMYK, so it has a wide range of applications in color management and image processing.

[0045] The LAB color space contains three components. The L component is in the vertical direction of the ball, indicating the brightness or brightness of the image. Its value is usually between 0 and 100, with 0 representing black and 100 representing white, similar to the brightness information of a grayscale image. The A component is in the horizontal direction of the ball, indicating the chromaticity information from green (negative value) to red (positive value). Positive values ​​indicate a bias towards red, and negative values ​​indicate a bias towards green. The value of A is usually between -128 and +127. The B component is in the forward and backward directions of the ball, indicating the chromaticity information from blue (negative value) to yellow (positive value). Positive values ​​indicate a bias towards yellow, and negative values ​​indicate a bias towards blue. The value of B is usually between -128 and +127.

[0046] Compared with the RGB color space, the chromaticity information in the LAB color space is more accurate and stable. This is because the LAB color space uses the chromaticity space of human perception, which can better reflect the differences between colors. In the RGB color space, the same color may present different values ​​under different lighting conditions. In the LAB color space, the representation of color is independent of the lighting conditions. Therefore, for tasks that are sensitive to lighting changes, using the LAB color space can improve the robustness of the classifier.

[0047] In the LAB color space, brightness information and chromaticity information are represented in the L and AB channels respectively. The features of the image can be extracted by separating the two channels. This can effectively reduce the feature dimension and avoid overfitting. In some scenarios, such as uneven color or uneven lighting, using the LAB color space for feature extraction and classification prediction can improve the accuracy of the model. At the same time, when performing image classification tasks, using the LAB color space can better reflect the perception of the human eye and improve the performance of the classifier.

[0048] Convert the RGB image to a LAB image, and the conversion formula for its pixel value is:

[0049] L=116*f(Y / Yn)-16

[0050] Among them, Y represents the brightness component in the RGB color space (usually between 0 and 1), and Yn is the brightness component of the reference white point (usually the Y value of the D65 standard, about 0.9505). Function f(x) is a nonlinear function used to process the brightness value to ensure that the L value is between 0 and 100.

[0051] A=500*(f(X / Xn)-f(Y / Yn))

[0052] Where X and Y represent the color components in the RGB color space, respectively, Xn and Yn are the X and Y components of the reference white point, and the function f(x) is also used for nonlinear processing.

[0053] B=200*(f(Y / Yn)-f(Z / Zn))

[0054] Among them, Z represents the color component in the RGB color space, Zn is the Z component of the reference white point, and the function f(x) is also used for nonlinear processing.

[0055] 2) Color space histogram feature extraction

[0056] Color space histogram is a commonly used image feature descriptor, which is widely used in image recognition, image retrieval, image classification and other fields. Color space histogram describes the color information of an image by counting the frequency of occurrence of various colors in the image. It records the number of pixels or percentage of pixels of different colors or color channels in the image. As a simple and effective feature descriptor based on statistical characteristics, histogram is widely used in the field of computer vision. Its advantages are mainly reflected in two aspects. First, for any image area, the extraction of histogram features is simple and convenient. Second, the histogram represents the statistical characteristics of the image area, can effectively represent the multi-modal feature distribution, and has a certain degree of rotation invariance.

[0057] The x-axis of a color space histogram usually represents the color or brightness level, and the y-axis represents the number of pixels or percentage of pixels at that level. By analyzing the shape of the histogram, you can get important information about the image.

[0058] The key parameters of the color space histogram include the following: the choice of color space, the number of channels (if the selected color space is multi-channel, you need to specify the number of channels for which to calculate the histogram), the number of histogram bins or gray levels (used to discretize the color or brightness range, pixel sampling specifies which pixels in the image are sampled when calculating the histogram), pixel weights (if some pixels have different importance in the image, they can be assigned different weights), and normalization (after normalization, the sum of the histogram will be equal to 1 or the total number of pixels).

[0059] The calculation method of the histogram first needs to determine the color space and the way to divide the colors. For example, in the RGB color space, each color channel is usually divided into several intervals, and then the number of times the color appears in each interval is counted; in the LAB color space, you may only care about the hue channel, and then divide the hue channel into several intervals, and count the number of times the color appears in each interval. Then traverse each pixel in the image, determine which bin it belongs to based on its color value, and then increase the count of the corresponding bin. Finally, the obtained histogram can be normalized so that the sum of the counts of all bins is 1, so that the obtained histogram can represent the distribution ratio of the color.

[0060] like Figure 1 As shown, first read the original RGB image, then call the color space conversion function of opencv and the histogram calculation function in numpy to get the histogram features of the three color channels respectively, and then concatenate the features of the three channels to get the LAB histogram features of the image.

[0061] As the color feature of an image, the color space histogram can be used for tasks such as image recognition, image retrieval, and image classification. For example, in image retrieval, the color histogram of the image to be retrieved can be compared with the color histograms of all images in the database to find the image with the most similar color distribution to the image to be retrieved; in image classification, the color histogram can be used as a feature input to the classifier for training and prediction.

[0062] The main advantages of the color space histogram are that it is easy to calculate, is not affected by image size and rotation, and can effectively describe the color distribution of the image. However, it also has some limitations. For example, it cannot describe the spatial relationship between colors. For images with the same color distribution but different color layouts, their color histograms may be the same. In addition, the color histogram is also sensitive to changes in lighting. The same image under different lighting may have different color histograms.

[0063] Offline step 2: In the offline stage, a random forest classifier is created to learn the relationship between data features and corresponding load categories to obtain a load identification model.

[0064] Random Forest is an ensemble learning method that can perform prediction and classification tasks by building multiple decision trees and combining them. The working principle of the random forest classifier can be divided into the following two steps: building a random forest and predicting samples.

[0065] First, for a given training data set, samples are randomly drawn with replacement (bootstrap sampling) to form a new training set. This means that each new training set is composed of randomly selected samples from the original training set and may contain duplicate samples. For each new training set, a decision tree is built. A decision tree is a tree-like model for classification and regression that divides the feature space into multiple regions and gives corresponding prediction results in each region. In the process of building a decision tree, for the feature selection of each node, the random forest will randomly select a subset of features and select the best features for division. The purpose of this is to increase the differences between decision trees so that each decision tree in the random forest has a certain degree of independence. Finally, repeat the above process of building decision trees and selecting features for nodes until the specified number of decision trees are built.

[0066] Figure 2 The general flow chart of random forest prediction is shown. During the prediction process, for a new input sample, it is input into each decision tree in the random forest for prediction, and each decision tree will give its own prediction result. For classification tasks, voting is used to determine the final prediction category, that is, the prediction results of each decision tree are counted, and the category with the most votes is selected as the final prediction result. For regression tasks, the average or median method is used to determine the final prediction result, that is, the prediction results of each decision tree are averaged or the median is calculated.

[0067] The specific process of using random forest for image classification is as follows:

[0068] Image preprocessing: This is the first step in all image classification tasks. Preprocessing may include scaling the image to a uniform size, color space conversion (such as RGB to grayscale or LAB), image enhancement (such as rotation, flipping, cropping, etc.), etc.

[0069] Feature extraction: Extract useful information from the preprocessed image, which is called features. Common image features include color histogram, texture features, shape features, SIFT features, HOG features, etc. The choice of features depends on the specific task and data.

[0070] Data partitioning: Divide the dataset into training and test sets. Usually, most of the dataset can be used for training, and the remaining part can be used to evaluate the performance of the model.

[0071] Random forest classifier parameter settings, the following are some important parameters and their meanings:

[0072] n_estimators: The number of decision trees. Increasing the number of decision trees can improve the accuracy of the model, but it will also increase the computational overhead. Usually, you can choose the optimal number through cross-validation.

[0073] max_depth: The maximum depth of the decision tree. Limiting the maximum depth of the decision tree can prevent overfitting. This is a key parameter, and you can select the optimal depth through grid search or cross validation.

[0074] min_samples_split: The minimum number of samples required for a decision tree node to split. By increasing the value of this parameter, you can prevent the decision tree from overfitting on a small number of samples, thereby improving the generalization ability of the model.

[0075] min_samples_leaf: The minimum number of samples required for a leaf node. Similar to the above parameters, increasing the value of this parameter can prevent overfitting and improve the generalization ability of the model.

[0076] max_features: The number of features considered by each decision tree node. Usually, we can use the default value "auto" (i.e. sqrt(n_features)) to get better results. If the feature dimension is high, you can reduce this value appropriately to reduce the computational overhead.

[0077] Training model: Use the training set data and corresponding labels to train the random forest classifier. Provide the feature vectors and corresponding labels to the random forest classifier, which will build multiple decision trees based on this data.

[0078] Model evaluation and parameter tuning: Use the test set data to evaluate the trained random forest model. Usually, you can use indicators such as accuracy, precision, recall, and F1 value to evaluate the classification performance. If the performance of the model is not satisfactory, you can use techniques such as grid search or cross-validation to find the best parameter combination.

[0079] Prediction: Once the model is trained and tuned, it can be used to predict new unknown images, extract the features of the test image, and input it into the trained random forest model to get the prediction results.

[0080] The advantage of random forest is that it can overcome the problem of decision trees being prone to overfitting, reduce prediction errors by combining multiple decision trees, and can handle a large number of features and samples. In addition, random forest can also evaluate the importance of each feature and can be used for feature selection.

[0081] Embodiment 2:

[0082] This embodiment provides a load identification method based on LAB color space feature extraction and random forest, and the module includes:

[0083] Offline learning module: used to extract household power load data features, build a power load data feature library, learn the relationship between features and corresponding labels, and train the load recognition model;

[0084] Online identification module: used to send the extracted power load characteristics to the power load identification model to obtain the power load type;

[0085] The offline learning module includes two modules, namely a feature extraction module and a classification learning module.

[0086] Feature extraction module: Use the opencv function library and the numpy numerical calculation library to extract the color space histogram features of the load image.

[0087] Classification learning module: Divide the training set and test set. Create a random forest classifier and train it using the training set. Make predictions on the test set. Figure 3 The visual test results of the test set are shown, where the left vertical axis column represents the actual load label, the horizontal axis represents the predicted output load label, and the value in the grid represents the normalized prediction ratio.

[0088] Embodiment three:

[0089] The present invention also provides a load identification device based on LAB color space feature extraction and random forest. The load image classification and identification device based on multivariate color space feature extraction and using random forest in this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above method embodiment are implemented. Alternatively, when the processor executes the computer program, the functions of each module / unit in the above embodiments are implemented.

[0090] The load identification device based on LAB color space feature extraction and random forest can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The load identification method and device based on LAB color space feature extraction and random forest may include, but are not limited to, a processor and a memory. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The memory can be used to store the computer program and / or module, and the processor implements various functions of the load identification device based on LAB color space feature extraction and random forest by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. If the module / unit integrated in the load identification device based on LAB color space feature extraction and random forest is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, ReadOnlyMemory), random access memory (RAM, RandomAccessMemory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0091] Calculation example:

[0092] The present invention designs a load identification method based on LAB color space feature extraction and random forest using the public data set WHITED. The data set contains current and voltage measurement values ​​of 54 different types of electrical equipment sampled at 44kHz, totaling 1339 sets of data.

[0093] First, the characteristics of signals under different electrical loads are extracted to establish a load data feature library. The features of different color spaces are extracted using the opencv and numpy libraries. Then, a suitable random forest classifier is selected to learn the relationship between data features and corresponding load categories. Finally, the final load identification model is obtained by comparing the accuracy of different classifiers.

[0094] Those skilled in the art should recognize that the above embodiments are only used to illustrate the present invention, and are not intended to limit the present invention. As long as they are within the spirit of the present invention, any changes or modifications to the above embodiments will fall within the scope of the claims of the present invention.

Claims

1. A load identification method based on LAB color space feature extraction and random forest, Features :The load identification method includes an offline phase and an online phase; The offline phase includes: Offline step 1: feature extraction step of load image; Offline step 2: classification learning step; The online phase includes: Online step 1: online feature extraction step; Online step 2: Online load identification step.

2. According to the load identification method based on LAB color space feature extraction and random forest as described in claim 1, Features ,The ,offline step 1 specifically is to extract the features of the ,signals under different load images as the feature fingerprint ,information of the training data.

3. According to claim 2, a load identification method based on LAB color space feature extraction and random forest, It is characterized in that Offline step 1 includes the following steps: Offline step 1-1: Image color space feature conversion, using color space conversion to convert RGB images into LAB color space images respectively; Offline step 1-2: Extraction of image features in the image color space, using the color space histogram to calculate the values ​​of the three channels; Offline steps 1-3: Channel value normalization, normalize the obtained histogram values.

4. According to claim 1, a load identification method based on LAB color space feature extraction and random forest, It is characterized in that The offline step 2 is specifically as follows: using a random forest classifier to learn the relationship between image features and corresponding load categories to obtain a load recognition model.

5. According to claim 4, a load identification method based on LAB color space feature extraction and random forest, It is characterized in that The model training of offline step 2 includes the following steps: Offline step 2-1: Divide the dataset into training set and test set; Offline step 2-2: Create a random forest classifier and train it using the training set.

6. According to the load identification method based on LAB color space feature extraction and random forest as described in claim 1, Features ,Online step 1: The online feature extraction step is to extract the current signal features using the ,method of offline step 1.

7. According to claim 1, a load identification method based on LAB color space feature extraction and random forest, Features ,Online step 2: The online load identification step is to use the load identification model obtained in the offline step 2, ,and send the signal features extracted in the online step 1 into the model to obtain the ,current load category.

8. A load identification device based on LAB color space feature extraction and random forest, It is characterized in that The modules include: a feature extraction module and a classification learning module.

9. A load identification device based on LAB color space feature extraction and random forest according to claim 8, It is characterized in that The feature extraction module uses numerical calculation processing and data type conversion to extract load image features.

10. A load identification device based on LAB color space feature extraction and random forest according to claim 8, It is characterized in that The classification learning module uses a random forest classifier to obtain a load identification model.

Citation Information

Patent Citations

  • Power user feature recognition and classification method based on random forest

    CN108062560A

  • VMD-GRU short-term load prediction method based on whale optimization algorithm and type identification

    CN117195947A

  • Load classification method and device for virtual power plant regulation and control, and storage medium

    CN117689945A

  • Multi-layer random forest-based part recognition method and system

    WO2021022970A1