Electromagnetic signal self-supervised learning method for preferentially selecting similar positive samples
By using a similar positive sample selection method and a twin contrastive learning network with a memory storage module, the problems of positive sample misjudgment and high resource consumption in self-supervised learning are solved, and efficient clustering and classification of electromagnetic signals are achieved.
Patent Information
- Application Number
- CN202510815028.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-10-28
AI Technical Summary
Existing self-supervised learning methods suffer from the problem of mistaking positive samples for negative samples in electromagnetic signal processing, and they also rely on large memory libraries to process negative samples, which increases computational resources and leads to unstable training results.
A similar positive sample selection method is adopted. Similar positive samples are generated through conditional clustering and spectral clustering. A twin contrastive learning network with a memory storage module is constructed and self-supervised contrastive learning training is performed to reduce the use of negative samples and optimize the network structure.
It effectively avoids the problem of positive samples being mistaken for negative samples, reduces the requirements for hardware storage resources, improves computing speed and recognition accuracy, and can perform clustering and classification of electromagnetic signals under unlabeled or weakly labeled conditions.
Smart Images

Figure CN120851113A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent electromagnetic signal processing technology, and in particular to a self-supervised learning method for electromagnetic signals that selects the best of similar positive samples. Background Technology
[0002] To address the dependence of deep learning models on massive amounts of labeled signal data, self-supervised pre-training techniques have been extensively studied. Pre-training techniques can overcome label dependency and improve model generalization ability, achieving remarkable results in natural language processing (NLP) and computer vision (CV). Currently, extensive research is also being conducted on time series data (TS) and spatiotemporal data (STD) analysis.
[0003] To alleviate the reliance on large datasets, methods based on data augmentation and self-supervised learning are commonly used. These methods utilize unlabeled data for pre-training, further addressing the limitation of insufficient labeled data. Self-supervised contrastive learning has shown its advantages in representation learning in time series data because it can learn invariant representations of features. A significant advantage of self-supervised learning is its ability to learn from large amounts of unlabeled data, which is often more readily available than labeled data. Self-supervised learning (SSL) methods can generally be categorized into generative learning-based methods and contrastive learning-based methods, depending on the model task.
[0004] However, generative learning methods are prone to pattern collapse during training, resulting in unstable training performance. Furthermore, they struggle to generate signals with complex and varied forms. Contrastive learning methods require negative sample input and learning. On one hand, they necessitate designing negative sample input patterns, which can lead to positive samples being mistakenly identified as negative. Different instances within the same cluster may be treated as negative pairs and incorrectly pushed apart, inevitably causing cluster collisions. On the other hand, they rely on large batches or in-memory libraries to process negative sample pairs, significantly increasing the computational resources required for the network model. Summary of the Invention
[0005] In view of this, this application provides a self-supervised learning method for electromagnetic signals based on similar positive samples.
[0006] This application discloses a self-supervised learning method for electromagnetic signals that selects the best from similar positive samples, which includes:
[0007] Step 1: Perform conditional clustering on the electromagnetic signal basic dataset, calculate the relevant features of each electromagnetic signal in the basic dataset and use them as the feature matrix of the signal, preprocess each feature in the feature matrix of the signal, and perform spectral clustering on the electromagnetic signals based on the preprocessed feature values to obtain candidate similar positive samples; wherein, the electromagnetic signal basic dataset is composed of electromagnetic signals;
[0008] Step 2: Calculate the distance between every two samples in the candidate similar positive samples, and obtain the distinguishing label between the samples based on the distance. By comparing the assigned distinguishing label value with the preset label value, the similar positive samples are obtained.
[0009] Step 3: Construct a Siamese contrastive learning network model with a memory storage module;
[0010] Step 4: Input the similar positive samples obtained in Step 2 into the Siamese contrastive learning network model with memory storage module constructed in Step 3 for self-supervised contrastive learning training.
[0011] Further, step 1 includes:
[0012] Given a basic dataset of electromagnetic signals, consisting of n electromagnetic signals, denoted as S n =[x1,x2,...,x i ,...,x n Conditional clustering is performed on the i-th electromagnetic signal x, and the i-th signal x is calculated sequentially. i The relevant features constitute the feature matrix of the signal. The relevant features include amplitude, center frequency, frequency offset, phase, and the second moment of the signal spectrum.
[0013] The second moment of the signal spectrum is calculated as follows:
[0014]
[0015] Wherein, P(f k () represents the frequency f k The power, the second moment reflects the degree to which the signal amplitude deviates from the mean, and N is the length of the signal;
[0016] For the i-th electromagnetic signal x i The relevant features are normalized, and the electromagnetic signal samples are then subjected to spectral clustering based on the relevant features of the normalized electromagnetic signals.
[0017] Furthermore, the specific steps of the spectral clustering are as follows:
[0018] Step 11: Calculate the similarity between electromagnetic signal samples using a Gaussian kernel function, and construct a similarity matrix based on the similarity.
[0019] Step 12: Normalize the Laplacian matrix and perform eigenvalue decomposition on the normalized Laplacian matrix, and determine the number of clusters based on all the eigenvalues obtained from the eigenvalue decomposition.
[0020] Step 13: Based on all the eigenvalues obtained from the eigenvalue decomposition, determine the eigenvector matrix and combine it with the K-means algorithm to obtain candidate similar positive samples.
[0021] Further, step 11 includes:
[0022] The similarity between different electromagnetic signal samples can be obtained using the following formula:
[0023]
[0024] Among them, W ij Let be the similarity between the i-th electromagnetic signal sample and the j-th electromagnetic signal sample. Let be the eigenvector of the i-th electromagnetic signal, and σ be the bandwidth parameter, where Let x represent the amplitude, center frequency, frequency offset, phase, and second moment of the signal spectrum of the i-th electromagnetic signal, respectively.
[0025] The similarity W among all the calculated electromagnetic signals ij This forms the similarity matrix W.
[0026] Further, step 12 includes:
[0027] Choose a normalized symmetric Laplace matrix:
[0028] L = ID -1 / 2 WD -1 / 2
[0029] Where D is a degree matrix, and the diagonal elements of D are D0. ii =Σ j W ij I is the identity matrix, and W is the similarity matrix;
[0030] Perform eigenvalue decomposition on the normalized symmetric Laplacian matrix and arrange the eigenvalues in ascending order: λ1≤λ2≤…λ i …≤λ n ;
[0031] Statistically, λ is satisfied i The number of eigenvalues less than ε is used as the number of clusters k, where ε is a positive number.
[0032] Further, step 13 includes:
[0033] Select the eigenvectors corresponding to the k smallest eigenvalues from all eigenvalues obtained by eigenvalue decomposition and form them into an eigenvector matrix U∈R. n×k Perform L2 normalization on the rows of the eigenvector matrix U:
[0034]
[0035] For the normalized eigenvector U ijThe K-means algorithm is executed to divide the electromagnetic signals into k classes. Electromagnetic signals that are clustered into the same cluster are candidate similar positive samples.
[0036] Further, step 2 includes:
[0037] Based on the spectral clustering results from step 1, the labels for samples within the same cluster are set to 1, and the labels for samples between different clusters are set to 0. The distance between each pair of electromagnetic signal samples is calculated using the following formula:
[0038]
[0039] Where dis is the distance between each pair of electromagnetic signal samples, Y is 0 or 1, Y = 1 when the samples are within the same cluster, and Y = 0 when the samples are between different clusters; sim is the similarity distance between each pair of electromagnetic signal samples.
[0040] The formula for calculating sim(·,·) is:
[0041]
[0042] Among them, x i Let x be the i-th electromagnetic signal sample. j This is the j-th electromagnetic signal sample;
[0043] The formula for assigning distinguishing labels between electromagnetic signal samples is:
[0044] L(dis) = A·e -ω·dis
[0045] Where ω is the attenuation coefficient, set to ω = 2, A = 1; when the distance between samples dis = 0, the label L = 1, that is, samples that are completely identical are 1, and samples that are less similar tend to be 0; sample pairs whose label values exceed the preset label values are considered similar positive samples.
[0046] Further, step 3 includes:
[0047] The Siamese contrastive learning network model with a memory storage module consists of a Siamese input module, an encoding layer, a projection head, a memory storage module, and an objective function calculation module;
[0048] The twin input module has two branches, which are used to input similar positive sample pairs. The length of the input signal of each branch is fixed as Lsig, and the batch size is B. Then the input dimension is [B,1,Lsig].
[0049] The coding layer consists of a convolutional layer and three consecutively stacked residual units; the output of the coding layer is a feature vector fn of [B, 2048].
[0050] The convolutional layer consists of a single 1D convolutional layer, a single Batch Normalization (BN) layer, and a single ReLU layer. The number of input channels in the convolutional layer is the same as the number of channels in the input data. The kernel size is 40, and the stride is 1. The residual unit consists of four layers: the first layer is a global average pooling layer; the second layer is a fully connected layer with the same number of neurons as the global average pooling layer; the third layer consists of one BN layer, one ReLU layer, and one fully connected layer, with the same number of neurons as the global average pooling layer; the fourth layer is a sigmoid layer, whose output is element-wise multiplied with the features of the input residual unit, and then element-wise added to the features of the first layer to form a residual unit.
[0051] The projection head consists of two substructures. The first substructure is a single-layer BN layer and a single-layer ReLU activation function layer. The ReLU activation function layer outputs a linear layer of size 1024, which outputs a feature vector of [B, 1024]. The second substructure is a single-layer BN layer and a single-layer ReLU activation function layer. The ReLU activation function layer outputs a linear layer of size 128, which outputs a feature vector pn of [B, 128].
[0052] The memory storage modules store the feature vectors output by the encoding layer and the feature vectors output by the projection head, respectively. <f1,...,f n ,p1,...,p n When the number of feature vectors in the memory storage module reaches the preset value, it is considered to meet the standard. The feature vector that first entered the memory storage module is removed, and the newly entered feature vector is sent into the memory storage module. The number of feature vectors removed and entered each time is 1.
[0053] Similar positive sample pairs <x1,x 1' In a Siamese contrastive learning network with a memory storage module, the weight-sharing encoding layer obtains the encoded feature vector. <f1,f 1' >= <e(x1),e(x 1' )>,x1,x 1' Given two similar electromagnetic signal samples simultaneously input to the twin input module, the projection head maps the encoded feature vector to 128-dimensional feature values, i.e. <p1,p 1' >= <pj(f1),pj(f 1' )>
[0054] The memory storage module combines the encoded feature vector with the 128-dimensional feature values and saves them as... <f1,...f n ,p1,...,p n >;
[0055] The objective function calculation module consists of the coding layer objective function, the projection head objective function, the similarity comparison objective function, and the clustering objective function.
[0056] Furthermore, the objective function of the coding layer is the basic contrastive objective function of the coding layer, specifically:
[0057]
[0058] τ is the weight that controls the magnitude of label differences;
[0059]
[0060] The objective function for the projection head is the same as the basic comparison objective function for the projection head, specifically:
[0061]
[0062] τ is the weight that controls the magnitude of label differences:
[0063]
[0064] The objective function for similarity comparison is:
[0065]
[0066] The clustering objective function is:
[0067]
[0068] All sim(·,·) represent the similarity distance between two feature vectors;
[0069] The objective function of the twin contrastive learning network with a memory storage module is:
[0070]
[0071] The samples required for calculation in the objective function calculation module are generated from this memory storage module.
[0072] Further, step 4 includes:
[0073] The features of samples used in previous batches are stored in a memory storage module. When the memory storage module reaches its capacity, the features of the first sample to enter are removed from the memory storage module, and the features of the latest sample to enter are entered. The number of feature vectors removed and entered each time is 1. The Adam method is used to optimize and train the Siamese contrastive learning network model with the memory storage module. The network updates its parameters based on the momentum update algorithm. The learning rate strategy is cosine annealing, and the model is warmed up in the initial stage of training. The parameters are initialized using the Kaiming He initialization method.
[0074] After training, the twin contrastive learning network model with memory storage module has the ability to cluster electromagnetic signals by distinguishing intra-class and inter-class representations. It can cluster electromagnetic signals in the case of no labels, and classify electromagnetic signals through secondary training with labels when there are a few labels.
[0075] Furthermore, in step 4:
[0076] During training, the similarity between the encoded feature vector and the projected head feature vector in the Siamese contrastive learning network model with the memory storage module is calculated separately to obtain the comprehensive similarity:
[0077]
[0078] Where, sim enc sim represents the similarity distance between feature vectors of the encoding layer. prj The similarity distance between the feature vectors of the projection heads;
[0079] Arrange the samples in descending order of comprehensive similarity. Set the comprehensive similarity threshold to ε = 1e-3. If the comprehensive similarity is less than ε, the corresponding encoded feature vector and projection head feature vector will continue to be stored in the memory storage module for training and continuous online learning. Otherwise, the current sample is considered to have completed training, and the encoded feature vector and projection head feature vector of this sample will be removed from the memory storage module, and the process will jump to step 1.
[0080] By adopting the above technical solution, this application has the following advantages: It effectively describes the feature measurement of similar positive samples through different similarity distance labels, making similar samples closer in the feature space and dissimilar samples farther apart, effectively avoiding the problem of positive samples being mistaken for negative samples. Simultaneously, by introducing a method of preferential clustering of similar positive samples, the use of negative samples is eliminated, thereby improving the efficiency and effectiveness of similar samples in self-supervised learning. Effective recognition accuracy can be achieved with minimal resources, enhancing the practicality of the algorithm in this application. Based on the Siamese contrastive learning network structure with a memory storage module, it can store a certain number of sample features extracted from previous batches, enabling large-scale training and processing of feature vectors. This memory storage module reduces the requirements for hardware storage resources and eliminates the constraint that training must use large batches of data, improving the computational speed of contrastive learning. Based on the technical solution of this application, it can effectively meet the needs of self-supervised learning of electromagnetic signals, thereby clustering or even classifying electromagnetic signals without labels or with weak labels.
[0081] The network structure of the method in this application is a general network structure trained under self-supervised conditions. The encoding layer can be replaced with other feature extraction network structures. In addition, other effective traditional features can be added during the clustering process, which has strong robustness and scene adaptability. Attached Figure Description
[0082] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0083] Figure 1 This is a schematic flowchart of a self-supervised learning method for electromagnetic signals to select similar positive samples according to an embodiment of this application.
[0084] Figure 2 This is a schematic diagram of a twin contrastive learning network structure with a memory storage module according to an embodiment of this application;
[0085] Figure 3 This is a t-SNE representation of features learned by the Siamese contrastive learning network in this embodiment of the application. Detailed Implementation
[0086] The present application will be further described in conjunction with the accompanying drawings and embodiments. The described embodiments are only some, not all, of the embodiments of the present application. All other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of the present application.
[0087] See Figures 1 to 3 This application provides an embodiment of a self-supervised learning method for electromagnetic signals based on similar positive samples, which includes:
[0088] Step 1: Perform conditional clustering on the electromagnetic signal basic dataset, calculate the relevant features of each electromagnetic signal in the basic dataset and use them as the feature matrix of the signal, preprocess each feature in the feature matrix of the signal, and perform spectral clustering on the electromagnetic signals based on the preprocessed feature values to obtain candidate similar positive samples; wherein, the electromagnetic signal basic dataset is composed of electromagnetic signals;
[0089] Step 2: Calculate the distance between every two samples in the candidate similar positive samples, and obtain the distinguishing label between the samples based on the distance. By comparing the assigned distinguishing label value with the preset label value, the similar positive samples are obtained.
[0090] Step 3: Construct a Siamese contrastive learning network model with a memory storage module;
[0091] Step 4: Input the similar positive samples obtained in Step 2 into the Siamese contrastive learning network model with memory storage module constructed in Step 3 for self-supervised contrastive learning training.
[0092] This application can effectively solve the problems of positive samples being mistaken for negative samples in self-supervised contrastive learning and the need to rely on large-scale memory libraries to process negative sample pairs.
[0093] Optionally, step 1 includes:
[0094] Given a basic dataset of electromagnetic signals, consisting of n electromagnetic signals, denoted as S n =[x1,x2,...,x i ,...,x n Conditional clustering is performed on the i-th electromagnetic signal x, and the i-th signal x is calculated sequentially. i The relevant features constitute the feature matrix of the signal. The relevant features include amplitude, center frequency, frequency offset, phase, and the second moment of the signal spectrum.
[0095] The second moment of the signal spectrum is calculated as follows:
[0096]
[0097] Wherein, P(f k () represents the frequency f k The power, the second moment reflects the degree to which the signal amplitude deviates from the mean, and N is the length of the signal;
[0098] For the i-th electromagnetic signal x i The relevant features are normalized, and the electromagnetic signal samples are then subjected to spectral clustering based on the relevant features of the normalized electromagnetic signals.
[0099] Optionally, the specific steps of the spectral clustering are as follows:
[0100] Step 11: Calculate the similarity between electromagnetic signal samples using a Gaussian kernel function, and construct a similarity matrix based on the similarity.
[0101] Step 12: Normalize the Laplacian matrix and perform eigenvalue decomposition on the normalized Laplacian matrix, and determine the number of clusters based on all the eigenvalues obtained from the eigenvalue decomposition.
[0102] Step 13: Based on all the eigenvalues obtained from the eigenvalue decomposition, determine the eigenvector matrix and combine it with the K-means algorithm to obtain candidate similar positive samples.
[0103] Optionally, step 11 includes:
[0104] The similarity between different electromagnetic signal samples can be obtained using the following formula:
[0105]
[0106] Among them, W ij Let be the similarity between the i-th electromagnetic signal sample and the j-th electromagnetic signal sample. Let be the eigenvector of the i-th electromagnetic signal, and σ be the bandwidth parameter, where Let x represent the amplitude, center frequency, frequency offset, phase, and second moment of the signal spectrum of the i-th electromagnetic signal, respectively.
[0107] The similarity W among all the calculated electromagnetic signals ij This forms the similarity matrix W.
[0108] Optionally, step 12 includes:
[0109] Choose a normalized symmetric Laplace matrix:
[0110] L = ID -1 / 2 WD -1 / 2
[0111] Where D is a degree matrix, and the diagonal elements of D are... I is the identity matrix, and W is the similarity matrix;
[0112] Perform eigenvalue decomposition on the normalized symmetric Laplacian matrix, and arrange the eigenvalues λ1≤λ2≤...λ in ascending order. i ...≤λ n ;
[0113] Statistically, λ is satisfied i The number of eigenvalues less than ε is used as the number of clusters k, where ε is a positive number.
[0114] Optionally, step 13 includes:
[0115] Select the eigenvectors corresponding to the k smallest eigenvalues from all eigenvalues obtained by eigenvalue decomposition and form them into an eigenvector matrix U∈R. n×k Perform L2 normalization on the rows of the eigenvector matrix U:
[0116]
[0117] For the normalized eigenvector U ij The K-means algorithm is executed to divide the electromagnetic signals into k classes. Electromagnetic signals that are clustered into the same cluster are candidate similar positive samples.
[0118] Optionally, step 2 includes:
[0119] Based on the spectral clustering results from step 1, the labels for samples within the same cluster are set to 1, and the labels for samples between different clusters are set to 0. The distance between each pair of electromagnetic signal samples is calculated using the following formula:
[0120]
[0121] Where dis is the distance between each pair of electromagnetic signal samples, Y is 0 or 1, Y = 1 when the samples are within the same cluster, and Y = 0 when the samples are between different clusters; sim is the similarity distance between each pair of electromagnetic signal samples.
[0122] The formula for calculating sim(·,·) is:
[0123]
[0124] Among them, x i Let x be the i-th electromagnetic signal sample. j This is the j-th electromagnetic signal sample;
[0125] The formula for assigning distinguishing labels between electromagnetic signal samples is:
[0126] L(dis) = A·e -ω·dis
[0127] Where ω is the attenuation coefficient, set to ω = 2, A = 1; when the distance between samples dis = 0, the label L = 1, that is, samples that are completely identical are 1, and samples that are less similar tend to be 0; sample pairs whose label values exceed the preset label values are considered similar positive samples.
[0128] Optionally, step 3 includes:
[0129] The Siamese contrastive learning network model with a memory storage module consists of a Siamese input module, an encoding layer, a projection head, a memory storage module, and an objective function calculation module;
[0130] The twin input module has two branches, which are used to input similar positive sample pairs. The length of the input signal of each branch is fixed as Lsig, and the batch size is B. Then the input dimension is [B,1,Lsig].
[0131] The coding layer consists of a convolutional layer and three consecutively stacked residual units; the output of the coding layer is a feature vector fn of [B, 2048].
[0132] The convolutional layer consists of a single 1D convolutional layer, a single Batch Normalization (BN) layer, and a single ReLU layer. The number of input channels in the convolutional layer is the same as the number of channels in the input data. The kernel size is 40, and the stride is 1. The residual unit consists of four layers: the first layer is a global average pooling layer; the second layer is a fully connected layer with the same number of neurons as the global average pooling layer; the third layer consists of one BN layer, one ReLU layer, and one fully connected layer, with the same number of neurons as the global average pooling layer; the fourth layer is a sigmoid layer, whose output is element-wise multiplied with the features of the input residual unit, and then element-wise added to the features of the first layer to form a residual unit.
[0133] The projection head consists of two substructures. The first substructure is a single-layer BN layer and a single-layer ReLU activation function layer. The ReLU activation function layer outputs a linear layer of size 1024, which outputs a feature vector of [B, 1024]. The second substructure is a single-layer BN layer and a single-layer ReLU activation function layer. The ReLU activation function layer outputs a linear layer of size 128, which outputs a feature vector pn of [B, 128].
[0134] The memory storage modules store the feature vectors output by the encoding layer and the feature vectors output by the projection head, respectively. <f1,...,f n ,p1,...,p n When the number of feature vectors in the memory storage module reaches the preset value, it is considered to meet the standard. The feature vector that first entered the memory storage module is removed, and the newly entered feature vector is sent into the memory storage module. The number of feature vectors removed and entered each time is 1.
[0135] Similar positive sample pairs <x1,x 1' In a Siamese contrastive learning network with a memory storage module, the weight-sharing encoding layer obtains the encoded feature vector. <f1,f 1' >= <e(x1),e(x 1' )>,x1,x 1' Given two similar electromagnetic signal samples simultaneously input to the twin input module, the projection head maps the encoded feature vector to 128-dimensional feature values, i.e. <p1,p 1' >= <pj(f1),pj(f 1' )>
[0136] The memory storage module combines the encoded feature vector with the 128-dimensional feature values and saves them as... <f1,...f n ,p1,...,p n >;
[0137] The objective function calculation module consists of the coding layer objective function, the projection head objective function, the similarity comparison objective function, and the clustering objective function.
[0138] Optionally, the objective function of the coding layer is the basic contrastive objective function of the coding layer, specifically:
[0139]
[0140] τ is the weight that controls the magnitude of label differences;
[0141]
[0142] The objective function for the projection head is the same as the basic comparison objective function for the projection head, specifically:
[0143]
[0144] τ is the weight that controls the magnitude of label differences:
[0145]
[0146] The objective function for similarity comparison is:
[0147]
[0148] The clustering objective function is:
[0149]
[0150] All sim(·,·) represent the similarity distance between two feature vectors;
[0151] The objective function of the twin contrastive learning network with a memory storage module is:
[0152]
[0153] The samples required for calculation in the objective function calculation module are generated from this memory storage module.
[0154] Optionally, step 4 includes:
[0155] The features of samples used in previous batches are stored in a memory storage module. When the memory storage module reaches its capacity, the features of the first sample to enter are removed from the memory storage module, and the features of the latest sample to enter are entered. The number of feature vectors removed and entered each time is 1. The Adam method is used to optimize and train the Siamese contrastive learning network model with the memory storage module. The network updates its parameters based on the momentum update algorithm. The learning rate strategy is cosine annealing, and the model is warmed up in the initial stage of training. The parameters are initialized using the Kaiming He initialization method.
[0156] After training, the twin contrastive learning network model with memory storage module has the ability to cluster electromagnetic signals by distinguishing intra-class and inter-class representations. It can cluster electromagnetic signals in the case of no labels, and classify electromagnetic signals through secondary training with labels when there are a few labels.
[0157] Optionally, in step 4:
[0158] During training, the similarity between the encoded feature vector and the projected head feature vector in the Siamese contrastive learning network model with the memory storage module is calculated separately to obtain the comprehensive similarity:
[0159]
[0160] Where, sim enc sim represents the similarity distance between feature vectors of the encoding layer. prj The similarity distance between the feature vectors of the projection heads;
[0161] Arrange the samples in descending order of comprehensive similarity. Set the comprehensive similarity threshold to ε = 1e-3. If the comprehensive similarity is less than ε, the corresponding encoded feature vector and projection head feature vector will continue to be stored in the memory storage module for training and continuous online learning. Otherwise, the current sample is considered to have completed training, and the encoded feature vector and projection head feature vector of this sample will be removed from the memory storage module, and the process will jump to step 1.
[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and not to limit them. Although this application has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of this application. Any modifications or equivalent substitutions that do not depart from the spirit and scope of this application should be covered within the protection scope of the claims of this application.
Claims
1. A self-supervised learning method for electromagnetic signals based on similar positive samples, characterized in that, include: Step 1: Perform conditional clustering on the electromagnetic signal basic dataset, calculate the relevant features of each electromagnetic signal in the basic dataset and use them as the feature matrix of the signal, preprocess each feature in the feature matrix of the signal, and perform spectral clustering on the electromagnetic signals based on the preprocessed feature values to obtain candidate similar positive samples; wherein, the electromagnetic signal basic dataset is composed of electromagnetic signals; Step 2: Calculate the distance between every two samples in the candidate similar positive samples, and obtain the distinguishing label between the samples based on the distance. By comparing the assigned distinguishing label value with the preset label value, the similar positive samples are obtained. Step 3: Construct a Siamese contrastive learning network model with a memory storage module; Step 4: Input the similar positive samples obtained in Step 2 into the Siamese contrastive learning network model with memory storage module constructed in Step 3 for self-supervised contrastive learning training.
2. The method according to claim 1, characterized in that, Step 1 includes: Given a basic dataset of electromagnetic signals, consisting of n electromagnetic signals, denoted as S n =[x1,x2,...,x i ,...,x n Conditional clustering is performed on the i-th electromagnetic signal x, and the i-th signal x is calculated sequentially. i The relevant features constitute the feature matrix of the signal. The relevant features include amplitude, center frequency, frequency offset, phase, and the second moment of the signal spectrum. The second moment of the signal spectrum is calculated as follows: Wherein, P(f k () represents the frequency f k The power, the second moment reflects the degree to which the signal amplitude deviates from the mean, and N is the length of the signal; For the i-th electromagnetic signal x i The relevant features are normalized, and the electromagnetic signal samples are then subjected to spectral clustering based on the relevant features of the normalized electromagnetic signals.
3. The method according to claim 1, characterized in that, The specific steps of the spectral clustering are as follows: Step 11: Calculate the similarity between electromagnetic signal samples using a Gaussian kernel function, and construct a similarity matrix based on the similarity. Step 12: Normalize the Laplacian matrix and perform eigenvalue decomposition on the normalized Laplacian matrix, and determine the number of clusters based on all the eigenvalues obtained from the eigenvalue decomposition. Step 13: Based on all the eigenvalues obtained from the eigenvalue decomposition, determine the eigenvector matrix and combine it with the K-means algorithm to obtain candidate similar positive samples.
4. The method according to claim 3, characterized in that, Step 11 includes: The similarity between different electromagnetic signal samples can be obtained using the following formula: Among them, W ij Let be the similarity between the i-th electromagnetic signal sample and the j-th electromagnetic signal sample. Let A be the eigenvector of the i-th electromagnetic signal, and σ be the bandwidth parameter, where A i ,f c,i ,Δφ i , M 2,i Let x represent the amplitude, center frequency, frequency offset, phase, and second moment of the signal spectrum of the i-th electromagnetic signal, respectively. The similarity W among all the calculated electromagnetic signals ij This forms the similarity matrix W.
5. The method according to claim 3, characterized in that, Step 12 includes: Choose a normalized symmetric Laplace matrix: L=I-D -1 / 2 WD -1 / 2 Where D is a degree matrix, and the diagonal elements of D are D0. ii =∑ j W ij I is the identity matrix, and W is the similarity matrix; Perform eigenvalue decomposition on the normalized symmetric Laplacian matrix and arrange the eigenvalues in ascending order: λ1≤λ2≤…λ i …≤λ n ; Statistically, λ is satisfied i The number of eigenvalues less than ε is used as the number of clusters k, where ε is a positive number.
6. The method according to claim 3, characterized in that, Step 13 includes: Select the eigenvectors corresponding to the k smallest eigenvalues from all eigenvalues obtained by eigenvalue decomposition and form them into an eigenvector matrix U∈R. n×k Perform L2 normalization on the rows of the eigenvector matrix U: For the normalized eigenvector U ij The K-means algorithm is executed to divide the electromagnetic signals into k classes. Electromagnetic signals that are clustered into the same cluster are candidate similar positive samples.
7. The method according to claim 1, characterized in that, Step 2 includes: Based on the spectral clustering results from step 1, the labels for samples within the same cluster are set to 1, and the labels for samples between different clusters are set to 0. The distance between each pair of electromagnetic signal samples is calculated using the following formula: Where dis is the distance between each pair of electromagnetic signal samples, Y is 0 or 1, Y = 1 when the samples are within the same cluster, and Y = 0 when the samples are between different clusters; sim is the similarity distance between each pair of electromagnetic signal samples. The formula for calculating sim(·,·) is: Among them, x i Let x be the i-th electromagnetic signal sample. j This is the j-th electromagnetic signal sample; The formula for assigning distinguishing labels between electromagnetic signal samples is: L(dis)=A·e -ω·dis Where ω is the attenuation coefficient, set to ω = 2, A = 1; when the distance between samples dis = 0, the label L = 1, that is, samples that are completely identical are 1, and samples that are less similar tend to be 0; sample pairs whose label values exceed the preset label values are considered similar positive samples.
8. The method according to claim 1, characterized in that, Step 3 includes: The Siamese contrastive learning network model with a memory storage module consists of a Siamese input module, an encoding layer, a projection head, a memory storage module, and an objective function calculation module; The twin input module has two branches, which are used to input similar positive sample pairs. The length of the input signal of each branch is fixed as Lsig, and the batch size is B. Then the input dimension is [B,1,Lsig]. The coding layer consists of a convolutional layer and three consecutively stacked residual units; the output of the coding layer is a feature vector fn of [B, 2048]. The convolutional layer consists of a single 1D convolutional layer, a single Batch Normalization (BN) layer, and a single ReLU layer. The number of input channels in the convolutional layer is the same as the number of channels in the input data. The kernel size is 40, and the stride is 1. The residual unit consists of four layers: the first layer is a global average pooling layer; the second layer is a fully connected layer with the same number of neurons as the global average pooling layer; the third layer consists of one BN layer, one ReLU layer, and one fully connected layer, with the same number of neurons as the global average pooling layer; the fourth layer is a sigmoid layer, whose output is element-wise multiplied with the features of the input residual unit, and then element-wise added to the features of the first layer to form a residual unit. The projection head consists of two substructures. The first substructure is a single-layer BN layer and a single-layer ReLU activation function layer. The ReLU activation function layer outputs a linear layer of size 1024, which outputs a feature vector of [B, 1024]. The second substructure is a single-layer BN layer and a single-layer ReLU activation function layer. The ReLU activation function layer outputs a linear layer of size 128, which outputs a feature vector pn of [B, 128]. The memory storage modules store the feature vectors output by the encoding layer and the feature vectors output by the projection head, respectively. <f1,...,f n ,p1,...,p n When the number of feature vectors in the memory storage module reaches the preset value, it is considered to meet the standard. The feature vector that first entered the memory storage module is removed, and the newly entered feature vector is sent into the memory storage module. The number of feature vectors removed and entered each time is 1. Similar positive sample pairs <x1,x 1' In a Siamese contrastive learning network with a memory storage module, the weight-sharing encoding layer obtains the encoded feature vector. <f1,f 1' >= <e(x1),e(x 1' )>,x1,x 1' Given two similar electromagnetic signal samples simultaneously input to the twin input module, the projection head maps the encoded feature vector to 128-dimensional feature values, i.e. <p1,p 1' >= <pj(f1),pj(f 1' )> The memory storage module combines the encoded feature vector with the 128-dimensional feature values and saves them as... <f1,...f n ,p1,...,p n >; The objective function calculation module consists of the coding layer objective function, the projection head objective function, the similarity comparison objective function, and the clustering objective function.
9. The method according to claim 8, characterized in that, The objective function of the coding layer is the basic contrastive objective function of the coding layer, specifically: τ is the weight that controls the magnitude of label differences; The objective function for the projection head is the same as the basic comparison objective function for the projection head, specifically: τ is the weight that controls the magnitude of label differences: The objective function for similarity comparison is: The clustering objective function is: All sim(·,·) represent the similarity distance between two feature vectors; The objective function of the twin contrastive learning network with a memory storage module is: The samples required for calculation in the objective function calculation module are generated from this memory storage module.
10. The method according to claim 1, characterized in that, Step 4 includes: The features of samples used in previous batches are stored in a memory storage module. When the memory storage module reaches its capacity, the features of the first sample to enter are removed from the memory storage module, and the features of the latest sample to enter are entered. The number of feature vectors removed and entered each time is 1. The Adam method is used to optimize and train the Siamese contrastive learning network model with the memory storage module. The network updates its parameters based on the momentum update algorithm. The learning rate strategy is cosine annealing, and the model is warmed up in the initial stage of training. The parameters are initialized using the Kaiming He initialization method. After training, the twin contrastive learning network model with memory storage module has the ability to cluster electromagnetic signals by distinguishing intra-class and inter-class representations. It can cluster electromagnetic signals in the case of no labels, and classify electromagnetic signals through secondary training with labels when there are a few labels.
11. The method according to claim 1, characterized in that, In step 4: During training, the similarity between the encoded feature vector and the projected head feature vector in the Siamese contrastive learning network model with the memory storage module is calculated separately to obtain the comprehensive similarity: Where, sim enc sim represents the similarity distance between feature vectors of the encoding layer. prj The similarity distance between the feature vectors of the projection heads; Arrange the samples in descending order of comprehensive similarity. Set the comprehensive similarity threshold to ε = 1e-3. If the comprehensive similarity is less than ε, the corresponding encoded feature vector and projection head feature vector will continue to be stored in the memory storage module for training and continuous online learning. Otherwise, the current sample is considered to have completed training, and the encoded feature vector and projection head feature vector of this sample will be removed from the memory storage module, and the process will jump to step 1.