Supervised comparative learning method and device based on time-space frequency consistency
By adopting the supervised contrastive learning method of spatio-temporal frequency consistency in the motor imagery brain-computer interface system, the TSF-SCL model was constructed, which solved the problems of small data volume and insufficient feature extraction, and achieved higher classification accuracy and decoding effect.
Patent Information
- Application Number
- CN202410609125.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-05-16
AI Technical Summary
The existing motor imagery brain-computer interface system has a small amount of training data, lacks effective data enhancement technology and a network structure for extracting multi-source features, making it difficult to fully mine the time domain, frequency domain and spatial domain characteristics of EEG signals.
A supervised contrastive learning method based on spatio-temporal frequency consistency is used to construct the TSF-SCL model, including a multi-source data enhancement module, a cross-view contrastive learning module and a cross-model contrastive learning module. Features are extracted through the multi-source data enhancement and contrastive learning modules to improve Feature consistency and classification accuracy of the model.
Through the design of multi-source data enhancement and contrast learning modules, the classification accuracy and decoding accuracy of EEG signals are improved, and the practicality of the motor imagery brain-computer interface system is improved.
Smart Images

Figure CN118626901A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning, and in particular to a supervised contrastive learning method and device based on time-space frequency consistency. Background Art
[0002] Brain-Computer Interface (BCI) technology is a direct communication path between the human brain and external devices. In the medical field, it plays a huge role in enhancing human cognition and sensory motor functions. Non-invasive electroencephalogram (EEG) signals are widely studied and applied due to their convenience and low cost. EEG-based BCI systems can assist, enhance, and even potentially restore human cognitive or sensory motor functions, and are widely used in cognitive behavioral assessment, emotional regulation and other fields. Motor imagery (MI) signals are one of the effective BCI control signals. Users can imagine the movement of specific body parts (such as the left hand, right hand, feet or tongue) to regulate different areas of the brain's motor cortex, thereby generating corresponding types of EEG signals. Some existing challenges of brain-computer interface systems include small amounts of training data, non-stationary EEG signals, and large individual differences among users.
[0003] Collecting labeled calibration data for new users is time-consuming and laborious, so it is very meaningful to make full use of the information of existing training data and design effective EEG data enhancement strategies. At present, EEG data enhancement mainly includes: time domain, frequency domain, spatial domain and model-based data enhancement. Time domain data enhancement includes adding noise, signal flipping, etc.; frequency domain data enhancement generally transforms the signal to the frequency domain first, performs frequency band filtering, phase transformation, etc. in the frequency domain; spatial domain data enhancement generally randomly exchanges the channels of the EEG signal, or exchanges positions according to different brain regions, and combines new samples. Traditional EEG signal processing and classification methods usually rely on preset network architectures, but these architectures are difficult to fully learn the characteristics of EEG signals. For example, the EEGNet architecture is inspired by the co-spatial pattern of the filter bank and focuses on spatial filtering to maximize the variance ratio between classes, but there are shortcomings in feature learning in the time and frequency domains, and the quality of the extracted features will be limited.
[0004] The following three problems exist in existing motor imagery brain-computer interface systems.
[0005] 1. Small amount of training data. The size of existing EEG datasets is usually much smaller than datasets in the field of image or natural language processing, which greatly limits the performance of deep learning models. Some studies have used data enhancement techniques to alleviate the problem of small sample sizes during training, but a single data enhancement technique cannot fully explore the overall characteristics of EEG signals, such as time domain, frequency domain, spatial domain, etc. Existing work pays less attention to multi-source data enhancement and fails to fully utilize multi-source knowledge for optimization.
[0006] Second, there is a lack of effective data enhancement technology. At present, some studies have used data enhancement technology in the classification tasks of brain-computer interface systems, but these methods have limited performance and do not work in multiple paradigms and scenarios. In addition, parameters often need to be adjusted, and the effect is highly uncertain. When only a certain data enhancement technology is used, the overall time domain, frequency domain, spatial domain and other characteristics of the EEG signal cannot be fully explored. Therefore, it is crucial to improve the data enhancement strategy and realize multi-source data enhancement fusion.
[0007] 3. Lack of network structure for extracting multi-source features. Compared with the fields of image and natural language processing, the features of EEG data focus on the time domain, space domain and frequency domain. From the perspective of the time series signal itself, its time series information, channel information, and frequency information are all crucial for decoding EEG signals, but there is currently a lack of research that simultaneously considers the time, space and frequency multi-source features and designs network structures to improve their feature consistency. Summary of the invention
[0008] In view of this, the purpose of the present invention is to provide a supervised contrastive learning method and device based on spatiotemporal frequency consistency to solve the technical problems of the existing motor imagery brain-computer interface system, such as the small amount of training data, the lack of effective data enhancement technology, and the lack of network structure for extracting multi-source features.
[0009] The present invention provides a supervised contrastive learning method based on time-space-frequency consistency, comprising:
[0010] S1: Construct the TSF-SCL model, which includes: multi-source data enhancement module, cross-view contrastive learning module, cross-model contrastive learning module and supervised classification module;
[0011] S2: Obtain an original EEG signal set, and perform multi-source data enhancement on the original EEG signal set through a multi-source data enhancement module to obtain a time domain enhanced data set, a spatial domain enhanced data set, and a frequency domain enhanced data set;
[0012] S3: Synchronously train each module in the TSF-SCL model through the original EEG signal set, the time domain enhanced data set, the spatial domain enhanced data set and the frequency domain enhanced data set to obtain the trained TSF-SCL model;
[0013] S4: Obtain a set of original EEG signals to be tested, classify the set of original EEG signals to be tested using the trained TSF-SCL model, and obtain classification prediction results.
[0014] Preferably, step S2 specifically comprises:
[0015] S21: The multi-source data enhancement module includes: a time domain enhancement module, a spatial domain enhancement module and a frequency domain enhancement module;
[0016] S22: Inputting the original EEG signal set into the time domain enhancement module, the spatial domain enhancement module and the frequency domain enhancement module for data enhancement, respectively, to obtain a time domain enhanced data set T, a spatial domain enhanced data set S and a frequency domain enhanced data set F accordingly.
[0017] Preferably, step S3 specifically comprises:
[0018] S31: The acquired original EEG signal set includes N EEG signals x i , the time domain enhancement data set includes N time domain enhancement data The airspace enhancement data set includes N airspace enhancement data The frequency domain enhancement data set includes N frequency domain enhancement data i is the number of the EEG signal, and N is the total number of EEG signals;
[0019] S32: constructing a first positive sample pair set and a first negative sample pair set through the time domain enhanced data set, the space domain enhanced data set and the frequency domain enhanced data set;
[0020] S33: Obtaining a cross-view contrastive learning loss of a cross-view contrastive learning module by calculating the first positive sample pair set and the first negative sample pair set
[0021] S34: The cross-model contrast learning module includes: an upper branch network and a lower branch network; inputting the time domain enhanced data set, the spatial domain enhanced data set and the frequency domain enhanced data set into the upper branch network to obtain an upper branch enhanced feature set, inputting the original EEG signal set into the lower branch network to obtain an original feature set, and constructing a second positive sample pair set and a second negative sample pair set through the upper branch enhanced feature set and the original feature set;
[0022] S35: Calculate the cross-model contrastive learning loss of the cross-model contrastive learning module through the second positive sample pair set and the second negative sample pair set
[0023] S36: Obtain supervised cross entropy classification loss of the supervised classification module by calculating the original EEG signal set
[0024] S37: Calculate the total loss of the TSF-SCL model for:
[0025]
[0026] Among them, λ and γ are adjustable hyperparameters greater than 0;
[0027] S38: Repeat steps S31 to S37 for a total of P times, and use the TSF-SCL model with the smallest total loss as the trained TSF-SCL model.
[0028] Preferably, step S32 is specifically:
[0029] S321: Get x i Corresponding and and x j Corresponding and Composed of time-frequency domain sample pairs Temporal-spatial sample pairs and spatial-frequency sample pairs
[0030] S322: If i=j, then and are all taken as the first positive sample pair. If i≠j, and Both are used as the first negative sample pair;
[0031] S323: Repeat steps S321 to S322 N times in total to obtain a first positive sample pair set and a first negative sample pair set, where j is the serial number of the EEG signal.
[0032] Preferably, step S33 is specifically:
[0033] S331: Calculate the distances of the first positive and negative sample pairs, and the calculation formula is:
[0034]
[0035] Among them, i and j are the numbers of EEG signals, and N is the total number of EEG signals; is the first positive sample pair, v,k∈{T,S,F} and v≠k; is the first negative sample pair, i≠j, v≠Vneg; d(·) represents the distance; sim() is the cosine similarity function; I [i≠j] is the indicator function, which is 1 if and only if i≠j; τ is an adjustable hyperparameter;
[0036] S332: Obtain cross-view contrastive learning loss by calculating the distance between each first positive and negative sample pair The calculation formula is:
[0037]
[0038] Where V is the total number of views.
[0039] Preferably, step S34 is specifically as follows:
[0040] S341: x i Corresponding and Input the upper branch network and obtain x i The corresponding upper branch enhanced features include: time domain features Airspace characteristics and frequency domain characteristics x j Input the next branch network to obtain the original feature z j ;
[0041] S342: Form an original-time domain sample pair (z j , ), original-spatial sample pair (z j , ) and the original frequency domain sample pair (z j , );
[0042] S343: If i=j, then (z j , )、(z j , ) and (z j , ) are all taken as the second positive sample pair. If i≠j, then (z j , )、(z j , ) and (z j , ) are all used as the second negative sample pair;
[0043] S344: Repeat steps S341 to S343 N times in total to obtain a second positive sample pair set and a second negative sample pair set, where j is the number of the EEG signal.
[0044] Preferably, step S35 is specifically as follows:
[0045] S351: Calculate the distances of each second positive and negative sample pair, and the calculation formula is:
[0046]
[0047] Where i and j are the numbers of EEG signals, and N is the total number of EEG signals; (z i , ) is the second positive sample pair, v∈{T,S,F}; (z i , ) is the second negative sample pair, Mneg∈{T,S,F}, and i≠j; d(·) represents the distance; sim() is the cosine similarity function; I [i≠j] is the indicator function, which is 1 if and only if i≠j; τ is an adjustable hyperparameter;
[0048] S352: Obtain cross-model contrastive learning loss by calculating the distance between each second positive and negative sample pair The calculation formula is:
[0049]
[0050] Where V is the total number of views.
[0051] A storage medium stores instructions and data for implementing a supervised contrastive learning method based on spatiotemporal-frequency consistency.
[0052] A supervised contrastive learning device based on time-space-frequency consistency includes: a processor and a storage medium; the processor loads and executes instructions and data in the storage medium to implement the supervised contrastive learning method based on time-space-frequency consistency.
[0053] The present invention has the following beneficial effects:
[0054] At the data processing level, the positive and negative sample pairs are formed by enhancing the data in the time, space and frequency domains, and the multi-source data is fully utilized for TSF-SCL model training, thereby improving the classification accuracy of the TSF-SCL model. At the model design level, a cross-view contrast learning module and a cross-model contrast learning module are designed; through the cross-view contrast learning module, discriminative features are extracted from the three enhanced views, and the features of different views are respectively formed into positive and negative sample pair training models to enhance feature consistency; the cross-model contrast learning module further improves the consistency of features extracted by different networks (such as feature extractors and encoders). Through the above means, the fusion of multi-source (time, space and frequency domain) knowledge is effectively realized, and the decoding accuracy and practicality of the motor imagery brain-computer interface system are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 This is a flow chart of a method according to an embodiment of the present invention;
[0056] Figure 2 It is a schematic diagram of the workflow of the TSF-SCL model;
[0057] Figure 3Comparison diagram of EEG signals before and after different types of data enhancement;
[0058] Figure 4 To compare the performance of different types of data augmentation combinations on four motor imagery EEG datasets;
[0059] Figure 5 Ablation experiment results on four motor imagery EEG datasets;
[0060] Figure 6 To conduct parameter sensitivity analysis experiments on four motor imagery EEG datasets;
[0061] Figure 7 This is a feature visualization diagram on the MI1 dataset. Each sub-diagram represents the data visualization of a single subject.
[0062] Figure 8 It is a structural diagram of the device of the present invention;
[0063] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0064] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0065] Reference Figure 1 The present invention provides a supervised contrastive learning method based on spatiotemporal frequency consistency, comprising:
[0066] S1: Construct the TSF-SCL model, which includes: multi-source data enhancement module, cross-view contrastive learning module, cross-model contrastive learning module and supervised classification module;
[0067] Specifically, the workflow of the TSF-SCL model is as follows: Figure 2 As shown, the cross-view contrastive learning module, the cross-model contrastive learning module and the supervised classification module are parallel structures.
[0068] S2: Obtain an original EEG signal set, and perform multi-source data enhancement on the original EEG signal set through a multi-source data enhancement module to obtain a time domain enhanced data set, a spatial domain enhanced data set, and a frequency domain enhanced data set;
[0069] Furthermore, step S2 is specifically as follows:
[0070] S21: The multi-source data enhancement module includes: a time domain enhancement module, a spatial domain enhancement module and a frequency domain enhancement module;
[0071] S22: Inputting the original EEG signal set into the time domain enhancement module, the spatial domain enhancement module and the frequency domain enhancement module for data enhancement, respectively, to obtain a time domain enhanced data set T, a spatial domain enhanced data set S and a frequency domain enhanced data set F accordingly.
[0072] Specifically, in the time-space-frequency multi-source data enhancement module, three branches are designed to perform EEG data enhancement in the time domain, frequency domain, and spatial domain on the original signal. The specific strategies are shown in Table 2.
[0073] Table 2 Implementation methods and parameters of different types of data enhancement strategies
[0074]
[0075] The present invention implements the above seven data enhancement techniques, including three time domain enhancements, two frequency domain enhancements, and two spatial domain enhancement methods. The visualization of the signal before and after data enhancement using these seven strategies is as follows: Figure 3 After multi-source data enhancement, the multi-source enhanced signals and original signals are uniformly input into the proposed supervised contrastive learning training framework TSF-SCL model.
[0076] S3: Synchronously train each module in the TSF-SCL model through the original EEG signal set, the time domain enhanced data set, the spatial domain enhanced data set and the frequency domain enhanced data set to obtain the trained TSF-SCL model;
[0077] Furthermore, step S3 is specifically as follows:
[0078] S31: The acquired original EEG signal set includes N EEG signals x i , the time domain enhancement data set includes N time domain enhancement data The airspace enhancement data set includes N airspace enhancement data The frequency domain enhancement data set includes N frequency domain enhancement data i is the number of the EEG signal, and N is the total number of EEG signals;
[0079] S32: constructing a first positive sample pair set and a first negative sample pair set through the time domain enhanced data set, the space domain enhanced data set and the frequency domain enhanced data set;
[0080] Furthermore, these three types of enhanced data are paired in pairs to form time-frequency, time-space, and space-frequency sample pairs respectively. Two enhanced samples from the same original sample are defined as positive sample pairs, and two enhanced samples from different original samples are defined as negative sample pairs. Alignment between different views is achieved based on the NT-Xent (normalized temperature-scaled cross-entropy) loss commonly used in contrastive learning. Assuming that each training batch has N samples, for each sample, 3N enhanced samples can be generated, of which 3(N-1) are cross-view negative samples of the original sample. The rest are positive samples.
[0081] Step S32 is specifically as follows:
[0082] S321: Get x i Corresponding and and x j Corresponding and Composed of time-frequency domain sample pairs Temporal-spatial sample pairs and spatial-frequency sample pairs
[0083] S322: If i=j, then and are all taken as the first positive sample pair. If i≠j, and Both are used as the first negative sample pair;
[0084] S323: Repeat steps S321 to S322 N times in total to obtain a first positive sample pair set and a first negative sample pair set, where j is the serial number of the EEG signal.
[0085] S33: Obtaining a cross-view contrastive learning loss of a cross-view contrastive learning module by calculating the first positive sample pair set and the first negative sample pair set
[0086] Furthermore, the cross-view contrastive learning module is trained in a self-supervised manner, and the alignment of different types of augmented data is achieved by designing a cross-view contrastive learning loss, thereby improving the consistency of the extracted features.
[0087] Step S33 is specifically as follows:
[0088] S331: Calculate the distances of the first positive and negative sample pairs, and the calculation formula is:
[0089]
[0090] Among them, i and j are the numbers of EEG signals, and N is the total number of EEG signals; is the first positive sample pair, v,k∈{T,S,F} and v≠k; is the first negative sample pair, i≠j, v≠Vneg; d(·) represents the distance; sim() is the cosine similarity function; I [i≠j] is the indicator function, which is 1 if and only if i≠j; τ is an adjustable hyperparameter;
[0091] S332: Obtain cross-view contrastive learning loss by calculating the distance between each first positive and negative sample pair The calculation formula is:
[0092]
[0093] Wherein, V is the total number of views, and V is set to 3.
[0094] S34: The cross-model contrast learning module includes: an upper branch network and a lower branch network; inputting the time domain enhanced data set, the spatial domain enhanced data set and the frequency domain enhanced data set into the upper branch network to obtain an upper branch enhanced feature set, inputting the original EEG signal set into the lower branch network to obtain an original feature set, and constructing a second positive sample pair set and a second negative sample pair set through the upper branch enhanced feature set and the original feature set;
[0095] Furthermore, the enhanced features extracted from the three types of enhanced data through the upper branch network and the features extracted from the original data through the lower branch network are combined in pairs to form positive and negative sample pairs respectively. The samples before and after enhancement from the same original sample are defined as positive sample pairs, and the samples before and after enhancement from different original samples are defined as negative sample pairs. Similarly, alignment between output features of different models is achieved based on NT-Xent loss. Assuming that each training batch has N samples, the original samples plus the enhanced samples have a total of 4N training samples, of which there are 4(N-1) cross-model negative samples. The rest are positive samples.
[0096] Step S34 is specifically as follows:
[0097] S341: x i Corresponding and Input the upper branch network and obtain x i The corresponding upper branch enhanced features include: time domain features Airspace characteristics and frequency domain characteristics x j Input the next branch network to obtain the original feature z j ;
[0098] S342: Form an original-time domain sample pair (z j , ), original-spatial sample pair (z j , ) and the original frequency domain sample pair (z j , );
[0099] S343: If i=j, then (z j , )、(z j , ) and (z j , ) are all taken as the second positive sample pair. If i≠j, then (z j , )、(z j , ) and (z j , ) are all used as the second negative sample pair;
[0100] S344: Repeat steps S341 to S343 N times in total to obtain a second positive sample pair set and a second negative sample pair set, where j is the number of the EEG signal.
[0101] S35: Calculate the cross-model contrastive learning loss of the cross-model contrastive learning module through the second positive sample pair set and the second negative sample pair set
[0102] Furthermore, the cross-model contrastive learning module consists of two parts: the encoder and projection head of the upper branch are trained in a self-supervised manner, while the backbone network and classifier of the lower branch are trained in a supervised manner. The cross-model contrastive learning module further improves the consistency of features extracted by different models.
[0103] Step S35 is specifically as follows:
[0104] S351: Calculate the distances of each second positive and negative sample pair, and the calculation formula is:
[0105]
[0106] Where i and j are the numbers of EEG signals, and N is the total number of EEG signals; (z i , ) is the second positive sample pair, v∈{T,S,F}; (z i , ) is the second negative sample pair, Mneg∈{T,S,F}, and i≠j; d(·) represents the distance; sim() is the cosine similarity function; I [i≠j]is the indicator function, which is 1 if and only if i≠j; τ is an adjustable hyperparameter;
[0107] S352: Obtain cross-model contrastive learning loss by calculating the distance between each second positive and negative sample pair The calculation formula is:
[0108]
[0109] Where V is the total number of views.
[0110] S36: Obtain supervised cross entropy classification loss of the supervised classification module by calculating the original EEG signal set
[0111] S37: Calculate the total loss of the TSF-SCL model for:
[0112]
[0113] Among them, λ and γ are adjustable hyperparameters greater than 0; λ and γ are set to 0.1;
[0114] S38: Repeat steps S31 to S37 for a total of P times, and use the TSF-SCL model with the smallest total loss as the trained TSF-SCL model.
[0115] S4: Obtain a set of original EEG signals to be tested, classify the set of original EEG signals to be tested using the trained TSF-SCL model, and obtain classification prediction results.
[0116] Specifically, the specific working steps of the trained TSF-SCL model are as follows:
[0117] Operation S1: Input original training data Test Data Initialize the network E and network P of the upper branch, the backbone network E of the lower branch, and the classifier F;
[0118] Operation S2: Perform different types of data enhancement on the i-th input data in batches, and define A T (·) is time domain enhancement, A s (·) is airspace enhancement, A F (·) is frequency domain enhancement, and the enhanced data can be expressed as:
[0119]
[0120] Furthermore, the enhanced data is input into the upper branch networks E and P to obtain:
[0121]
[0122] Operation S3: Input the original data into the lower branch networks E and F to obtain z i =E(x i ),
[0123] Operation S4: Calculate the cross-view contrastive learning loss, cross-model contrastive learning loss, and supervised cross entropy classification loss respectively;
[0124] Operation S5: Use the trained backbone network E and classifier F to classify the test data and obtain the predicted label
[0125]
[0126] Experimental comparison:
[0127] Table 2 shows the experimental results of this patent solution on four motor imagery EEG datasets, Zhou2016, MI1, BNCI2014002 and BNCI2015001, using three different model architectures: EEGNet, ShallowCNN and DeepCNN. The experimental results show that TSF-SCL is significantly better than all baseline methods, including no enhancement, seven different data enhancements and two self-supervised methods.
[0128] Table 2 Performance comparison between TSF-SCL and baseline methods
[0129]
[0130] Figure 4 The ablation experiment results of combining different types of enhancement methods of this patent solution are demonstrated, and the effect is significant in the proposed TSF-SCL framework.
[0131] Table 3 shows the performance of the spatiotemporal-frequency-space supervised contrastive learning framework of this patent solution. Compared with the baseline method, it is still improved, and compared with TSF-SCL, the effect is not much different.
[0132] Table 3 Performance comparison of three-view enhancement and spatiotemporal-frequency view enhancement on four datasets
[0133]
[0134] Figure 5-6 The results of ablation experiments and parameter sensitivity analysis experiments are presented, indicating that the different modules proposed have brought performance improvements and demonstrated the robustness of the method. Figure 7The feature visualization results are shown: (a) the baseline method, the feature distribution of different views is uneven; (b) the TSF-SCL method, the proposed solution can make all data evenly distributed in the feature space and the classification interface clearly visible. The feature distribution of different views in the baseline method is uneven, while the features extracted by TSF-SCL are evenly distributed in the feature space and the classification interface is clearly visible, which proves that this patented solution greatly improves the consistency of the features extracted by the model and achieves better classification performance.
[0135] See also Figure 8 , Figure 8 4 is a schematic diagram of the working of the hardware device of an embodiment of the present invention, wherein the hardware device specifically comprises: a supervised contrastive learning device 401 based on spatiotemporal-frequency consistency, a processor 402 and a storage medium 403.
[0136] A supervised contrastive learning device 401 based on time-space-frequency consistency: The supervised contrastive learning device 401 based on time-space-frequency consistency implements the supervised contrastive learning method based on time-space-frequency consistency.
[0137] Processor 402: The processor 402 loads and executes the instructions and data in the storage medium 403 to implement the supervised contrastive learning method based on spatiotemporal-frequency consistency.
[0138] Storage medium 403: The storage medium 403 stores instructions and data; the storage medium 403 is used to implement the supervised contrastive learning method based on spatiotemporal-frequency consistency.
[0139] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0140] The serial numbers of the embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In a unit claim that lists several means, several of these means may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order and these words may be interpreted as identifiers.
[0141] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A supervised contrastive learning method based on spatiotemporal frequency consistency, characterized in that: include: S1: Construct the TSF-SCL model, which includes: multi-source data enhancement module, cross-view contrastive learning module, cross-model contrastive learning module and supervised classification module; S2: Obtain an original EEG signal set, and perform multi-source data enhancement on the original EEG signal set through a multi-source data enhancement module to obtain a time domain enhanced data set, a spatial domain enhanced data set, and a frequency domain enhanced data set; S3: Synchronously train each module in the TSF-SCL model through the original EEG signal set, the time domain enhanced data set, the spatial domain enhanced data set and the frequency domain enhanced data set to obtain the trained TSF-SCL model; S4: Obtain a set of original EEG signals to be tested, classify the set of original EEG signals to be tested using the trained TSF-SCL model, and obtain classification prediction results.
2. The supervised contrastive learning method based on spatiotemporal frequency consistency according to claim 1, characterized in that: Step S2 is specifically as follows: S21: The multi-source data enhancement module includes: a time domain enhancement module, a spatial domain enhancement module and a frequency domain enhancement module; S22: Inputting the original EEG signal set into the time domain enhancement module, the spatial domain enhancement module and the frequency domain enhancement module for data enhancement, respectively, to obtain a time domain enhanced data set T, a spatial domain enhanced data set S and a frequency domain enhanced data set F accordingly.
3. The supervised contrastive learning method based on spatiotemporal frequency consistency according to claim 1, characterized in that: Step S3 is specifically as follows: S31: The acquired original EEG signal set includes N EEG signals x i , the time domain enhancement data set includes N time domain enhancement data The airspace enhancement data set includes N airspace enhancement data The frequency domain enhancement data set includes N frequency domain enhancement data i is the number of the EEG signal, and N is the total number of EEG signals; S32: constructing a first positive sample pair set and a first negative sample pair set through the time domain enhanced data set, the space domain enhanced data set and the frequency domain enhanced data set; S33: Obtaining a cross-view contrastive learning loss of a cross-view contrastive learning module by calculating the first positive sample pair set and the first negative sample pair set S34: The cross-model contrast learning module includes: an upper branch network and a lower branch network; inputting the time domain enhanced data set, the spatial domain enhanced data set and the frequency domain enhanced data set into the upper branch network to obtain an upper branch enhanced feature set, inputting the original EEG signal set into the lower branch network to obtain an original feature set, and constructing a second positive sample pair set and a second negative sample pair set through the upper branch enhanced feature set and the original feature set; S35: Calculate the cross-model contrastive learning loss of the cross-model contrastive learning module through the second positive sample pair set and the second negative sample pair set S36: Obtain supervised cross entropy classification loss of the supervised classification module by calculating the original EEG signal set S37: Calculate the total loss of the TSF-SCL model for: Among them, λ and γ are adjustable hyperparameters greater than 0; S38: Repeat steps S31 to S37 for a total of P times, and use the TSF-SCL model with the smallest total loss as the trained TSF-SCL model.
4. The supervised contrastive learning method based on spatiotemporal frequency consistency according to claim 3, characterized in that: Step S32 is specifically as follows: S321: Get x i Corresponding and and x j Corresponding and Composed of time-frequency domain sample pairs Temporal-spatial sample pairs and spatial-frequency sample pairs S322: If i=j, then and are all taken as the first positive sample pair. If i≠j, and Both are used as the first negative sample pair; S323: Repeat steps S321 to S322 N times in total to obtain a first positive sample pair set and a first negative sample pair set, where j is the serial number of the EEG signal.
5. The supervised contrastive learning method based on spatiotemporal frequency consistency according to claim 3, characterized in that: Step S33 is specifically as follows: S331: Calculate the distances of the first positive and negative sample pairs, and the calculation formula is: Among them, i and j are the numbers of EEG signals, and N is the total number of EEG signals; is the first positive sample pair, v,k∈{T,S,F} and v≠k; is the first negative sample pair, i≠j, v≠Vneg; d(·) represents the distance; sim() is the cosine similarity function; I [i≠j] is the indicator function, which is 1 if and only if i≠j; τ is an adjustable hyperparameter; S332: Obtain cross-view contrastive learning loss by calculating the distance between each first positive and negative sample pair The calculation formula is: Where V is the total number of views.
6. The supervised contrastive learning method based on spatiotemporal frequency consistency according to claim 3, characterized in that: Step S34 is specifically as follows: S341: x i Corresponding and Enter the upper branch network and get x i The corresponding upper branch enhanced features include: time domain features Airspace characteristics and frequency domain characteristics x j Input the next branch network to obtain the original feature z j ; S342: Forming original-time domain sample pairs Original-spatial sample pair and the original frequency domain sample pair S343: If i=j, then and are all used as the second positive sample pair. If i≠j, and Both are used as the second negative sample pair; S344: Repeat steps S341 to S343 N times in total to obtain a second positive sample pair set and a second negative sample pair set, where j is the number of the EEG signal.
7. The supervised contrastive learning method based on spatiotemporal frequency consistency according to claim 3, characterized in that: Step S35 is specifically as follows: S351: Calculate the distances of each second positive and negative sample pair, and the calculation formula is: Among them, i and j are the numbers of EEG signals, and N is the total number of EEG signals; is the second positive sample pair, v∈{T,S,F}; is the second negative sample pair, Mneg∈{T,S,F}, and i≠j; d(·) represents the distance; sim() is the cosine similarity function; I [i≠j] is the indicator function, which is 1 if and only if i≠j; τ is an adjustable hyperparameter; S352: Obtain cross-model contrastive learning loss by calculating the distance between each second positive and negative sample pair The calculation formula is: Where V is the total number of views.
8. A storage medium, characterized in that: The storage medium stores instructions and data for implementing a supervised contrastive learning method based on spatiotemporal-frequency consistency as described in any one of claims 1 to 7.
9. A supervised contrastive learning device based on spatiotemporal frequency consistency, characterized in that: include: A processor and a storage medium; the processor loads and executes instructions and data in the storage medium to implement a supervised contrastive learning method based on spatiotemporal-frequency consistency as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Sleep staging system based on self-supervised learning and multi-view learning
CN116439663A
Electroencephalogram emotion recognition method based on mixed enhancement and time sequence comparative learning
CN116746929A
Space-time frequency domain effective channel attention motor imagery electroencephalogram decoding method based on comparative learning
CN117009780A
Multi-lead electrocardiogram classification method based on self-supervised learning
CN117958831A
Cited By
Semi-supervised dermatoscope image segmentation method based on frequency domain disturbance and space-frequency dual-domain consistency
CN119741319A
