Electric energy quality disturbance identification method based on self-supervised contrast learning
Through the self-supervised comparison learning method, strong and weak enhancement of the power quality disturbance signal, a pre-trained model is constructed and fine-tuned, solving the problems of insufficient data labeling and difficulty in selecting features in traditional methods, and achieving efficient, accurate identification and real-time monitoring of power quality disturbances.
Patent Information
- Application Number
- CN202510838362.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-06-23
AI Technical Summary
Traditional power quality disturbance identification methods rely on a large amount of labeling data, which has problems such as insufficient data labeling and difficulty in selecting features, making it difficult to meet the power system's demand for real-time monitoring.
The self-supervised comparison learning method is adopted to build a pre-trained model of power quality perturbation by strongly enhancing and weakly enhancing the label-free sample set, and a pre-trained model of power quality perturbation is used to predict across views, and a small amount of label data is used to fine-tune it to build a power quality perturbation identification model.
It realizes efficient and accurate identification of power quality disturbances under a small amount of labeled data, improves the generalization ability and real-time nature of the model, reduces the cost of data labeling, enhances the disturbance resistance of the power grid, and ensures the stable operation of the power grid.
Smart Images

Figure CN120372254A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power quality disturbance analysis and identification, and particularly to a power quality disturbance identification method based on self-supervised contrast learning. Background Art
[0002] At present, the monitoring and identification of power quality disturbances mainly rely on traditional methods based on feature extraction and machine learning. The working principle of these methods is usually to extract key time-domain or frequency-domain features from a large amount of collected power quality data and identify the disturbance types through a preset classification model. Common techniques include the Fourier transform method, wavelet transform method, machine learning-based classification methods, and deep learning methods. Among them, the Fourier transform method: By performing a fast Fourier transform (FFT) on the power quality signal, the time-domain signal is transformed into a frequency-domain signal to identify the harmonic components therein; this method has good detection effects for harmonic problems but has poor recognition ability for complex non-periodic disturbances. The wavelet transform method: The wavelet transform can provide local information in the time-frequency domain and is more suitable for the analysis of instantaneous disturbances. The wavelet transform can effectively analyze instantaneous disturbances such as voltage sags and flickers in power quality, but its computational complexity is high, and its performance in processing highly non-stationary signals is not ideal. Machine learning-based classification methods: Such as support vector machines (SVMs), decision trees, and K-nearest neighbor algorithms (KNNs), etc. These methods are usually used to process the extracted feature data for disturbance classification. Such methods usually rely on artificially designed features and a large amount of training data, but there are certain limitations in feature selection and the generalization ability of the classification model. Deep learning methods: In recent years, deep learning has been increasingly widely used in the identification of power quality disturbances. Through deep learning models such as convolutional neural networks (CNNs) and recurrent neural networks (RNNs), features can be automatically learned from the original signal, thereby improving the recognition accuracy. However, deep learning models usually require a large amount of labeled data to train the model, and the training process has a large amount of calculation and poor real-time performance, making it difficult to meet the requirements of the power system for real-time monitoring of power quality disturbances.
[0003] Therefore, although certain progress has been made in current power quality disturbance identification technologies, most machine learning and deep learning methods require a large amount of labeled data to train the model. However, in the process of power quality disturbance identification, the acquisition cost of labeled data is high, and many disturbance types are relatively rare, resulting in an unbalanced dataset and making it difficult to guarantee the training effect of the model. In addition, the disturbance signals detected at different positions in the power grid are of great significance for the construction of the power quality disturbance identification model, but this has not been considered in previous technologies.
[0004] Therefore, how to design a power quality disturbance identification method to solve the problems of insufficient data annotation and feature selection existing in traditional power quality disturbance identification methods is a technical problem that urgently needs to be solved at present. Summary of the Invention
[0005] In view of the above analysis, embodiments of the present invention aim to provide a power quality disturbance identification method based on self-supervised contrast learning to solve the problems of insufficient data annotation and feature selection existing in traditional power quality disturbance identification methods.
[0006] The present invention discloses a power quality disturbance identification method based on self-supervised contrast learning, and the method includes: Performing strong augmentation and weak augmentation on each power quality disturbance signal sample in the unlabeled sample set respectively to obtain corresponding strongly augmented views and weakly augmented views; Training a power quality disturbance pre-training model based on self-supervised contrast learning by using the strongly augmented views and weakly augmented views of each power quality disturbance signal sample; the power quality disturbance pre-training model sequentially includes an encoder, a temporal contrast module, and a context contrast module; Extracting the encoder and its parameters from the trained power quality disturbance pre-training model, connecting a fully connected layer at the output end of the extracted encoder to construct a power quality disturbance identification model; performing classification prediction training on the power quality disturbance identification model by using a labeled sample set; Identifying the power quality disturbance of a real-time power quality disturbance signal by using the power quality disturbance identification model after classification prediction training.
[0007] On the basis of the above solution, the present invention also makes the following improvements: Further, when training the power quality disturbance pre-training model based on self-supervised contrast learning, each training execution: The encoder performs feature extraction on the strongly augmented views and weakly augmented views of each power quality disturbance signal sample in the same training batch respectively to obtain corresponding feature vectors; Inputting the feature vectors of the strongly augmented views and weakly augmented views into the temporal contrast module, performing a cross-view prediction task under unsupervised conditions, outputting context vectors and calculating a temporal contrast loss; Inputting the context vectors into the context contrast module, performing self-supervised contrast learning and calculating a context contrast loss; Obtaining an overall loss based on the temporal contrast loss and the context contrast loss, updating the model parameters according to the overall loss, and repeating the training until the end condition is met to obtain a trained pre-training model.
[0008] Further, the performing of the cross-view prediction task under unsupervised conditions includes: In the temporal contrast module, the autoregressive model is used to summarize the parts of the feature vectors of the strongly augmented view and the weakly augmented view that are not greater than the preset time t into the corresponding context vectors respectively; Using the context vectors of the strongly augmented view and the weakly augmented view, perform a cross-view prediction task under unsupervised conditions.
[0009] Furthermore, the cross-view prediction task under unsupervised conditions refers to: using the context vector of the strongly augmented view to predict the latent representation of the weakly augmented view at future time steps and using the context vector of the weakly augmented view to predict the latent representation of the strongly augmented view at future time steps
[0010] .
[0010] Furthermore, the temporal contrast losses corresponding to the strongly augmented view and the weakly augmented view 、 are respectively expressed as: (1) (2) where represents a non-linear layer, log is the logarithmic function, K represents the total number of steps for predicting future time steps, represents the set of negative samples within a training batch, represents the similarity weight of positive and negative sample augmented views; is the latent representation of the weakly augmented view of the signal sample to be learned at future time steps and is used as a positive sample; is the latent representation of the strongly augmented view of the signal sample to be learned at future time steps and is used as a positive sample; represents the latent representation of the strongly augmented views of all other samples except the positive sample in the same batch and is used as a negative sample; represents the latent representation of the weakly augmented views of all other samples except the positive sample in the same batch and is used as a negative sample.
[0011] Furthermore, the similarity weight of positive and negative sample augmented views is expressed as: (3) (4) where represents the bandwidth parameter; represents the strongly augmented view of the signal sample to be learned, Represents the weakly augmented views of other samples in the same batch except for the positive samples.
[0012] Furthermore, the context contrast loss is expressed as: (5) where represents the sample size of the power quality disturbance signal samples in a training batch; represents the th context vector of a view, the context vector of another augmented view from the same input signal sample, is regarded as a positive sample pair; the remaining context vectors from other input signal samples within the same batch are used as negative samples, defined as ; represents calculating the cosine similarity of two elements; represents the indicator function; represents the temperature parameter.
[0013] Furthermore, the overall loss is expressed as: (6) where , respectively represent the weights of the time contrast loss and the context contrast loss.
[0014] Furthermore, using the labeled sample set to perform classification prediction training on the power quality disturbance identification model, execute: Taking each power quality disturbance signal sample in the labeled sample set as the input of the power quality disturbance identification model and the disturbance label of the corresponding power quality disturbance signal sample as the prediction output of the power quality disturbance identification model, perform classification prediction training on the power quality disturbance identification model to obtain the power quality disturbance identification model after classification prediction training.
[0015] Furthermore, using the power quality disturbance identification model after classification prediction training to identify the power quality disturbance of the real-time power quality disturbance signal, execute: Directly inputting the collected real-time power quality disturbance signal into the power quality disturbance identification model after classification prediction training, and the power quality disturbance identification model predicts and outputs the disturbance identification result of the real-time power quality disturbance signal.
[0016] Compared with the prior art, the present invention can at least achieve one of the following beneficial effects: The power quality disturbance identification method based on self-supervised contrast learning proposed by the present invention first constructs a pre-training model based on a self-supervised contrast learning strategy, and then uses a small amount of labeled power quality disturbance data for fine-tuning to achieve the identification of power quality disturbances. Therefore, the contrast learning strategy can, without explicit labels, mine the pattern information of the disturbance signal through the contrast learning strategy, thus effectively solving the problems of insufficient data annotation and feature selection in traditional methods. The power quality disturbance identification model constructed based on the pre-training model can accurately identify power quality disturbances, can give early warnings and take appropriate control measures, enhance the anti-disturbance ability of the power grid, reduce the fault risk of the power system, and ensure the stable operation of the power grid.
[0017] Specifically, the method first generates two different augmented views of a power quality disturbance signal based on strong and weak augmentation methods; then, a temporal contrast module is proposed to explore the temporal domain features of the power quality disturbance signal using an autoregressive model and a cross-view prediction task is constructed; secondly, a context contrast module is constructed to maximize the consistency of the autoregressive model, and through multiple trainings, a power quality disturbance pre-training model is obtained; finally, the pre-training model is fine-tuned using a small amount of labeled power quality disturbance data to obtain a power quality disturbance identification model, thereby realizing the identification of power quality disturbances.
[0018] In summary, the method can overcome the problems existing in the prior art, such as low accuracy, high dependence on labeled data, and poor real-time performance. By proposing a strong augmentation algorithm based on time-frequency domain feature retrieval, the generalization ability and feature discriminability of the self-supervised contrast learning pre-training model are significantly improved. Compared with traditional augmentation strategies such as random noise injection and extreme cropping, this method realizes the directional replacement of data augmentation by finding similar disturbance feature samples, making the generated augmented samples introduce reasonable diversity while retaining the core features of power quality, and avoiding the problem of disturbance feature destruction caused by excessive modification in traditional strong augmentation methods. Through this method, the efficient, accurate, and real-time identification of power quality disturbances can be realized, the data annotation cost can be reduced, the generalization ability and adaptability of the model can be improved, thereby providing strong technical support for the safe and stable operation of the power system, the development of smart grids, and the improvement of power quality.
[0019] In the present invention, the above technical solutions can also be combined with each other to achieve more preferred combination schemes. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can be made obvious from the description, or understood by implementing the present invention. The objectives and other advantages of the present invention can be realized and obtained from the content specifically pointed out in the description and the drawings. Description of the Drawings
[0020] The accompanying drawings are only for the purpose of showing specific embodiments and are not considered to be a limitation of the present invention. Throughout the drawings, the same reference numerals represent the same components; Figure 1 It is a flowchart of a power quality disturbance identification method based on self-supervised contrast learning provided by an embodiment of the present invention; Figure 2 It is a schematic diagram of a power quality disturbance identification method based on self-supervised contrast learning provided by an embodiment of the present invention. Detailed implementation manners
[0021] The preferred embodiments of the present invention will be specifically described below with reference to the accompanying drawings. The accompanying drawings form a part of this application and are used together with the embodiments of the present invention to explain the principles of the present invention, rather than to limit the scope of the present invention.
[0022] A specific embodiment of the present invention discloses a power quality disturbance identification method based on self-supervised contrast learning. The flowchart of this method is as Figure 1 shown, and the schematic diagram is as Figure 2 shown.
[0023] Step S1: Perform strong augmentation and weak augmentation on each power quality disturbance signal sample in the unlabeled sample set to obtain corresponding strongly augmented views and weakly augmented views.
[0024] In this embodiment, both strong augmentation and weak augmentation are relatively broad terms. In actual application processes, various augmentation methods can be used to perform data augmentation on power quality disturbance signal samples. Preferably, in this implementation, weak augmentation adopts strategies of jitter, scale, and adding noise. Strong augmentation considers the characteristics of power quality disturbances and adopts a time-frequency domain feature retrieval strategy to achieve strong augmentation. Exemplarily, for a power quality disturbance signal sample , denotes the length of the power quality disturbance signal sample. The strongly augmented view and weakly augmented view of the power quality disturbance signal sample can be respectively denoted as , .
[0025] Specifically, in this embodiment, strong augmentation considers the characteristics of power quality disturbances and uses time-frequency domain feature retrieval to generate the strongly augmented view , and the specific implementation process is described as follows.
[0026] Calculate the time-frequency domain feature vectors of each power quality disturbance signal sample in the unlabeled sample set respectively. Specifically, for the power quality disturbance signal sample , calculate its time-frequency domain key feature vectors, including: root mean square , range , Total Harmonic Distortion .
[0027] (1) (2) (3) Among them, is the x-th harmonic component.
[0028] Therefore, the time-frequency domain key feature vector of each power quality disturbance signal sample is represented as .
[0029] Calculate the Euclidean distance between the time-frequency domain key feature vectors of each power quality disturbance signal sample in the unlabeled sample set and other power quality disturbance signal samples respectively, and select B power quality disturbance signal samples with Euclidean distance less than the preset value to form a candidate set , from the candidate set Randomly select 1 power quality disturbance signal sample as the strong augmented view, that is .
[0030] Step S2: Use the strong augmented views and weak augmented views of the respective power quality disturbance signal samples to train a power quality disturbance pre-training model based on self-supervised contrast learning (that is Figure 2 the self-supervised contrast learning pre-training model in); the power quality disturbance pre-training model sequentially includes an encoder, a time contrast module, and a context contrast module.
[0031] Specifically, in step S2, the following operations are performed each time training is carried out.
[0032] Step S21: The encoder performs feature extraction on the strong augmented views and weak augmented views of the respective power quality disturbance signal samples in the same training batch to obtain corresponding feature vectors.
[0033] Specifically, during each training process, in this embodiment, an encoder constructed by a convolutional neural network is used to perform feature extraction on the strong augmented view and weak augmented view of each power quality disturbance signal sample respectively, and obtain the corresponding feature vectors of the strong augmented view and weak augmented view as the corresponding potential embedding representations.
[0034] In this embodiment, the strong augmented view , the weak augmented view corresponding feature vectors , are respectively represented as: (4) (5) Among them, , , Q represents the total number of time steps, and Q is less than the length of the power quality disturbance signal sample .
[0035] Step S22: Input the feature vectors of the strongly enhanced view and the weakly enhanced view into the temporal contrast module, perform a cross-view prediction task under unsupervised conditions, output the context vector, and calculate the temporal contrast loss.
[0036] Specifically, in this embodiment, the temporal contrast module uses an autoregressive model contrast loss function to extract temporal features in the latent space, takes part of the feature vectors as the input of the Transformer model, obtains the context vectors of the strongly enhanced view and the weakly enhanced view respectively, and uses the context vectors to predict the feature vectors of future power quality disturbance signals, thereby constructing a cross-view prediction task under unsupervised conditions and constructing a temporal contrast loss based on the cross-view prediction results.
[0037] Step S221: In the temporal contrast module, use the autoregressive model to summarize the parts of the feature vectors of the strongly enhanced view and the weakly enhanced view that are not greater than the preset time t into the corresponding context vectors respectively.
[0038] Preferably, in the cross-view prediction task under unsupervised conditions proposed in this embodiment, the Transformer model is used as the autoregressive model. Specifically, the feature vector of the strongly enhanced view The vector composed of all elements not greater than the preset time t arranged in sequence is used as the input of the autoregressive model, and the context vector of the strongly enhanced view is predicted and output by the autoregressive model ; the feature vector of the weakly enhanced The vector composed of all elements not greater than the preset time t arranged in sequence is used as the input of the autoregressive model, and the context vector of the weakly enhanced view is predicted and output by the autoregressive model .
[0039] Step S222: Use the context vectors of the strongly enhanced view and the weakly enhanced view to perform a cross-view prediction task under unsupervised conditions.
[0040] Since both the strongly enhanced view and the weakly enhanced view are the results of data processing on the original power quality disturbance signal sample, therefore, the two belong to homologous signals and have the feasibility of cross-view prediction. Specifically, use the context vector of the strongly enhanced view to predict the latent representation of the weakly enhanced view at the future time step , use the context vector of the weakly enhanced view to predict the latent representation of the strongly enhanced view at the future time step to predict the potential representation of the strongly augmented view at future time steps .
[0041] In the unsupervised cross-view prediction task proposed in this embodiment, the temporal contrast losses of the strongly augmented view and the weakly augmented view 、 are respectively expressed as: (6) (7) where represents a non-linear layer, log is the logarithmic function, K represents the total number of steps for predicting future time steps, represents the set of negative samples within a training batch, including samples other than the positive samples; represents the similarity weight of the positive and negative sample augmented views; is the potential representation of the weakly augmented view of the signal sample to be learned at the future time step and is used as a positive sample; is the potential representation of the strongly augmented view of the signal sample to be learned at the future time step and is used as a positive sample; represents the potential representation of the strongly augmented view of other samples in the same batch except the positive sample and is used as a negative sample; represents the potential representation of the weakly augmented view of other samples in the same batch except the positive sample and is used as a negative sample.
[0042] It should be noted that since this framework does not require training model parameters using perturbed labels, it is necessary to construct a prediction task to enable the correct update of the model parameters. In this embodiment, a cross-view prediction task is constructed, and the quality of task completion is evaluated through the above loss functions. The lower the calculation results of the two loss functions become during the training process, the better the model parameters are learned. The parameters of the encoder, temporal contrast module, and context contrast module are trained under the guidance of these two loss functions. Preferably, in this embodiment, the calculation of the temporal contrast loss is improved by adding a weight for measuring the similarity of samples after strong and weak augmentation. The larger this weight is, the greater the proportion of this sample in the process of calculating the similarity of negative sample pairs. Thus, through the weight mechanism, the model can pay more attention to negative samples with higher similarity to the current sample.
[0043] The similarity weight of the positive and negative sample augmented views is obtained by calculating the Euclidean similarity between the strongly augmented view of the signal sample to be learned and the weakly augmented views of all other samples in the same batch except the positive sample, and is expressed as: (8) Among them, it can be calculated as follows: (9) Among them, represents the bandwidth parameter, which is used to control the width of the Gaussian function; represents the strongly augmented view of the signal sample to be learned currently, represents the weakly augmented view of other samples except the positive samples in the same batch.
[0044] In this embodiment, by constructing these two loss functions and updating the parameters of the model in the way of gradient descent, self-supervised learning is guided to be realized.
[0045] Step S23: Input the context vector into the context contrast module to perform self-supervised contrast learning and calculate the context contrast loss.
[0046] Specifically, input the context vectors of the strongly augmented view and the weakly augmented view into the context contrast module to perform self-supervised contrast learning and calculate the context contrast loss.
[0047] In the specific implementation process, according to the context vectors of the strongly augmented view and the weakly augmented view, a non-linear mapping layer is used to predict the context vector of another view, so as to construct the context contrast loss. Finally, the context contrast loss and the temporal contrast loss are weighted and summed to obtain the final self-supervised contrast loss. Through the gradient descent process, the encoder parameters are updated, so as to obtain the pre-trained model for power quality disturbance.
[0048] Assume that the sample size of the power quality disturbance signal samples in a training batch is , for the context vector of the th view, the context vector of another augmented view from the same input signal sample is defined as the positive sample. Therefore, is regarded as a positive sample pair. At the same time, the remaining context vectors of other input signal samples within the same batch are used as 's negative samples, which are defined as ; can form negative sample pairs with its negative samples. Therefore, the context contrast loss constructed in this embodiment is used to maximize the similarity between positive sample pairs and at the same time minimize the similarity between negative sample pairs, so that the constructed pre-trained model for power quality disturbance has strong identification ability. For this reason, the context contrast loss is expressed as: (10) Among them, represents calculating the cosine similarity between two elements; represents the indicator function, and when the condition in the square brackets is satisfied, the function value is 1; otherwise, it is 0; represents the temperature parameter, which is used to scale the similarity score.
[0049] Step S24: Obtain the overall loss based on the time contrast loss and the context contrast loss, update the model parameters according to the overall loss, and repeat the training until the end condition is satisfied to obtain the pre-trained model that has completed training.
[0050] Specifically, according to the overall loss of the pre-trained model for power quality disturbances in the current training process, update the model parameters of the pre-trained model for power quality disturbances; and jump to execute the next training, execute multiple trainings until the training end condition is reached, and obtain the pre-trained model for power quality disturbances that has completed training.
[0051] Therefore, the overall loss of the pre-trained model for power quality disturbances constructed in this embodiment is a combination of two time contrast losses and a context contrast loss, as shown below: (11) Among them, , respectively represent the weights of the time contrast loss and the context contrast loss, which are determined by the validation set. Based on the above training losses, continuously iterate and update the parameters until the pre-trained model for power quality disturbances that has completed training is obtained.
[0052] Preferably, the training end condition is that the overall loss drops to the preset loss range, or the preset number of training times is reached.
[0053] Step S3: Extract the encoder and its parameters from the pre-trained model for power quality disturbances that has completed training, connect a fully connected layer to the output end of the extracted encoder to construct a power quality disturbance identification model; use the labeled sample set to perform classification prediction training on the power quality disturbance identification model.
[0054] It should be noted that after the model training in step S2, the encoder already has relatively accurate feature extraction capabilities. Therefore, based on the labeled sample set with a relatively small sample size, perform classification prediction training on the pre-trained model for power quality disturbances to obtain a high-performance power quality disturbance identification model. Preferably, in step S3, each power quality disturbance signal sample in the labeled sample set is used as the input of the power quality disturbance identification model, and the disturbance label of the corresponding power quality disturbance signal sample is used as the prediction output of the power quality disturbance identification model to perform classification prediction training on the power quality disturbance identification model to obtain the power quality disturbance identification model that has completed training.
[0055] According to the pre-trained model of power quality disturbance obtained in step S2, add a fully connected layer (such as a linear layer for classification), and then fine-tune it with a small amount of power quality labeled data (continue to supervise classification learning through labeled data and update the parameters of the model during the learning process), a power quality disturbance identification model with strong identification ability can be obtained. During the fine-tuning process, the multi-class cross-entropy formula is used as the loss function, which is expressed as: (12) where, is the number of batch samples in the labeled sample set, represents the disturbance label of the th power quality disturbance signal sample in the labeled sample set, represents the th power quality disturbance signal sample's predicted probability for the disturbance category .
[0056] Step S4: Use the trained power quality disturbance identification model for classification prediction to identify the power quality disturbance of the real-time power quality disturbance signal.
[0057] Directly input the collected real-time power quality disturbance signal into the trained power quality disturbance identification model for classification prediction, and the disturbance identification result of the real-time power quality disturbance signal is predicted and output by the power quality disturbance identification model.
[0058] In summary, the method provided in this embodiment mainly consists of three processes: the construction process of the pre-trained model of power quality disturbance, the fine-tuning process of the power quality disturbance identification model, and the prediction process based on the power quality disturbance identification model. In the specific implementation process, by introducing the self-supervised contrast learning strategy, making full use of a large amount of unlabeled power quality disturbance data, constructing a pre-trained model of power quality disturbance, and fine-tuning the pre-trained model of power quality disturbance based on a small amount of labeled samples, a power quality disturbance identification model is obtained for subsequent prediction. This solution has the following beneficial effects: (1) The pre-trained model of power quality disturbance constructed by introducing the self-supervised contrast learning method in this embodiment reduces the dependence on a large number of labeled samples, and at the same time learns a discriminative feature representation for the types of power quality disturbances; (2) The multi-view input generated by using the enhancement strategy in this embodiment enables the model to better adapt to the diverse noises and random disturbances that may appear in the actual power quality data. In the case of unseen disturbance types or signal forms, the model still has high accuracy; (3) Through the time comparison module in this embodiment, the model can more effectively capture the temporal features of the disturbance signal, and further enhance the temporal consistency of the representation through context comparison; (4) Based on the fact that the trained encoder has the ability of efficient feature extraction, this embodiment fine-tunes the pre-trained model of power quality disturbance based on a small number of labeled samples, so as to obtain a power quality disturbance identification model, effectively improving the model identification accuracy.
[0059] Those skilled in the art can understand that all or part of the processes for implementing the methods of the above embodiments can be completed by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium is a disk, an optical disk, a read-only memory or a random access memory, etc.
[0060] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention.
Claims
1. A power quality disturbance identification method based on self-supervised contrastive learning, characterized in that, The method includes: Performing strong enhancement and weak enhancement on each power quality disturbance signal sample in the unlabeled sample set respectively to obtain corresponding strongly enhanced views and weakly enhanced views; Training a power quality disturbance pre-training model based on self-supervised contrast learning by using the strongly enhanced views and weakly enhanced views of the power quality disturbance signal samples; the power quality disturbance pre-training model sequentially includes an encoder, a temporal contrast module, and a context contrast module; Extracting the encoder and its parameters from the trained power quality disturbance pre-training model, connecting a fully connected layer at the output end of the extracted encoder, and constructing a power quality disturbance identification model; using the labeled sample set to perform classification prediction training on the power quality disturbance identification model; Performing power quality disturbance identification on the real-time power quality disturbance signal by using the power quality disturbance identification model after classification prediction training.
2. The power quality disturbance identification method based on self-supervised contrastive learning according to claim 1, characterized in that When training the power quality disturbance pre-training model based on self-supervised contrast learning, each training execution: The encoder respectively extracts features from the strongly enhanced views and weakly enhanced views of each power quality disturbance signal sample in the same training batch to obtain corresponding feature vectors; Inputting the feature vectors of the strongly enhanced views and weakly enhanced views into the temporal contrast module, performing a cross-view prediction task under unsupervised conditions, outputting context vectors, and calculating the temporal contrast loss; Inputting the context vectors into the context contrast module, performing self-supervised contrast learning, and calculating the context contrast loss; Obtaining the overall loss based on the temporal contrast loss and the context contrast loss, updating the model parameters according to the overall loss, and repeating the training until the end condition is met to obtain the trained pre-training model.
3. The power quality disturbance identification method based on self-supervised contrastive learning according to claim 2, wherein, The execution of the cross-view prediction task under unsupervised conditions includes: In the temporal contrast module, using an autoregressive model to respectively summarize the parts of the feature vectors of the strongly enhanced views and weakly enhanced views that are not greater than the preset time t into corresponding context vectors; Using the context vectors of the strongly enhanced views and weakly enhanced views to perform a cross-view prediction task under unsupervised conditions.
4. The power quality disturbance identification method based on self-supervised contrastive learning according to claim 3, characterized in that, The cross-view prediction task under unsupervised conditions refers to: using the context vector of the strongly augmented view to predict the latent representation of the weakly augmented view at future time steps , and using the context vector of the weakly augmented view to predict the latent representation of the strongly augmented view at future time steps . . 5. The power quality disturbance identification method based on self-supervised contrastive learning according to claim 4, wherein Temporal contrastive loss corresponding to strong enhancement view and weak enhancement view , which are respectively expressed as: (1) (2) Among them, represents a non-linear layer, log is the logarithmic function, and K represents the total number of steps for predicting future time steps. represents the set of negative samples within a training batch. represents the similarity weight of the enhanced views of positive and negative samples. is the latent representation of the weakly enhanced view of the signal sample to be learned at the future time step and is used as a positive sample. is the latent representation of the strongly enhanced view of the signal sample to be learned at the future time step and is used as a positive sample. represents the latent representation of the strongly enhanced views of all other samples except the positive samples in the same batch and is used as a negative sample. represents the latent representation of the weakly enhanced views of all other samples except the positive samples in the same batch and is used as a negative sample.
6. The power quality disturbance identification method based on self-supervised contrastive learning according to claim 5, wherein Positive and negative sample enhanced view similarity weight Expressed as: (3) (4) Among them, represents the bandwidth parameter; represents the strongly augmented view of the signal sample to be learned currently, represents the weakly augmented view of other samples except the positive samples in the same batch.
7. The power quality disturbance identification method based on self-supervised contrastive learning according to claim 6, characterized in that Context contrast loss Expressed as: (5) Among them, represents the sample size of the power quality disturbance signal samples in a training batch; represents the context vector of the th view, the context vector of another augmented view from the same input signal sample, is regarded as a positive sample pair; the remaining context vectors of other input signal samples within the same batch are used as negative samples, defined as ; represents calculating the cosine similarity between two elements; represents the indicator function; represents the temperature parameter.
8. The method for identifying power quality disturbances based on self-supervised contrastive learning according to claim 7, wherein The overall loss is expressed as: (6) Among them, and represent the weights of the temporal contrast loss and the context contrast loss respectively.
9. The power quality disturbance identification method based on self-supervised contrastive learning according to any one of claims 1-8, characterized in that, When using the labeled sample set to perform classification prediction training on the power quality disturbance identification model, the execution is as follows: Taking each power quality disturbance signal sample in the labeled sample set as the input of the power quality disturbance identification model, and taking the disturbance label of the corresponding power quality disturbance signal sample as the prediction output of the power quality disturbance identification model, performing classification prediction training on the power quality disturbance identification model to obtain the power quality disturbance identification model after classification prediction training.
10. The power quality disturbance identification method based on self-supervised contrast learning according to claim 9, characterized in that, When using the power quality disturbance identification model after classification prediction training to perform power quality disturbance identification on the real-time power quality disturbance signal, the execution is as follows: Directly inputting the collected real-time power quality disturbance signal into the power quality disturbance identification model after classification prediction training, and the power quality disturbance identification model predicts and outputs the disturbance identification result of the real-time power quality disturbance signal.
Citation Information
Patent Citations
Electromagnetic signal open set identification method based on data negative enhancement and pseudo-class prototype points
CN116186618A
Electric power system transient signal identification method
CN117454269A
Rolling bearing fault diagnosis method, device and equipment and storage medium
CN118965080A
Remote sensing image retrieval optimization method based on automatic weight distribution and comparison hash
CN119339114A
Small sample spectrum sensing method based on time prediction and context contrast learning
CN120180241A