Efficient fine tuning method, device and equipment for electroencephalogram basic model
By combining active learning in feature space and pseudo-label annotation, the problem of high-cost annotation in fine-tuning of EEG basic models is solved, achieving efficient model fine-tuning and improved classification accuracy with a small number of annotations, which is applicable to the field of brain-computer interface technology.
Patent Information
- Application Number
- CN202511634046.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-10
- Publication Date
- 2026-02-10
AI Technical Summary
The fine-tuning of existing EEG basic models relies on extensive expert annotation, which is costly and lacks intelligent selection of sample value under limited annotation budgets. This fails to fully tap the information potential of unlabeled data, resulting in limited classification accuracy.
We employ an active learning method based on feature space to select candidate samples for expert annotation. We then construct augmented annotation datasets and pseudo-label datasets through smoothed random mask data augmentation and pseudo-label annotation, and perform joint fine-tuning training using semi-supervised learning.
With a limited annotation budget, it significantly reduces the reliance on expert annotation for model fine-tuning, improves classification accuracy and training efficiency, and shortens the deployment cycle of brain-computer interface systems.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of brain-computer interface, and in particular to a brain electrical foundation model fine-tuning method, a decoding device and equipment. BACKGROUND
[0002] Electroencephalography (EEG) as a non-invasive brain activity acquisition technology is the core foundation in the field of brain-computer interface (BCI). With its millisecond-level time resolution and good safety, EEG technology has been widely used in sleep staging, seizure detection, motor intention recognition and emotion state analysis and other task scenarios.
[0003] At present, the EEG signal processing method based on deep learning mostly adopts a special model designed for a single task. However, due to the significant differences in mode (such as the number of channels and signal length) and features between different tasks, such a model is difficult to generalize to multi-task scenarios. In addition, due to the lack of large-scale high-quality labeled data, the performance improvement of these models is bottlenecked.
[0004] To overcome the above limitations, the existing technology proposes an EEG foundation model. This kind of model is pre-trained on a large amount of unlabeled EEG data through self-supervised learning, thereby obtaining a feature representation with strong generalization ability, and can be adapted to various downstream tasks through fine-tuning. Although this method shows potential, there are still two key defects in its fine-tuning process: first, it relies heavily on a large number of experts for data labeling, and EEG data labeling requires neurophysiological knowledge, resulting in high cost and long cycle; second, the existing method lacks an intelligent selection mechanism for prioritizing sample values under limited labeling budget, resulting in low utilization efficiency of labeling resources and inability to fully tap the information potential contained in unlabeled data. The above problems seriously restrict the deployment and promotion of EEG foundation models in various BCI applications. SUMMARY
[0005] Therefore, the embodiments of the present application provide an EEG foundation model efficient fine-tuning method, device and equipment, which are used to solve the technical problems of high labeling cost in the fine-tuning process of the EEG foundation model and limited classification accuracy under the condition of a small number of labeled samples in the prior art.
[0006] The first aspect of the embodiments of the present application provides an EEG foundation model fine-tuning method, comprising:
[0007] S1) obtaining a set of unlabeled EEG signals of a downstream task;
[0008] S2) Under the preset annotation budget, candidate sample sets are selected from the unlabeled dataset based on active learning and expert annotation is performed to obtain an annotated dataset;
[0009] S3) Perform smooth random mask data augmentation on the labeled dataset, and assign the original true labels corresponding to the labeled dataset to the augmented samples to generate an augmented labeled dataset;
[0010] S4) Fine-tuning the basic EEG model based on augmented labeled datasets;
[0011] S5) Perform pseudo-label annotation on the remaining samples in the unlabeled dataset to generate a pseudo-labeled dataset;
[0012] S6) Joint fine-tuning training of the basic EEG model based on augmented labeled dataset and pseudo-labeled dataset.
[0013] In a first possible implementation of the first aspect, S2) selects a candidate sample set from the unlabeled dataset, including:
[0014] A portion of the initial samples were randomly selected from the unlabeled dataset and annotated by experts to form the initial labeled dataset;
[0015] The basic EEG model was initially trained based on this initial labeled dataset;
[0016] Based on the initially trained model, samples from the labeled dataset will be... Encoding as features Then, the features of the labeled samples in each category are averaged to construct prototype feature templates for each category. ,in, This represents a pre-trained encoder representing the basic EEG model; the model and labeled dataset are updated through an iterative process, which includes:
[0017] Using the currently trained model, for samples in the unlabeled dataset to its characteristics With prototype feature template Perform feature interpolation to generate interpolated features. ,in It is the interpolation rate;
[0018] Based on the model, the original features Interpolation features The difference in prediction results is used to identify candidate samples from the unlabeled dataset;
[0019] Cluster analysis was performed on the candidate samples, and representative samples from each category were selected for expert annotation in order to update the annotation dataset;
[0020] The model was then retrained based on the updated labeled dataset;
[0021] Repeat this iterative process until the amount of labeled data reaches the labeling budget.
[0022] In the second possible implementation of the first aspect, the step of S3) performing smooth random mask data augmentation on the labeled dataset includes:
[0023] For samples of the labeled dataset Random sampling time points ,in, To ensure uniform distribution, Indicates sample The start time point, Indicates sample The end time point, Indicates the length of the time window to be masked;
[0024] Sample With mask Multiply to obtain the enhanced sample. Its time window The value is replaced with zero, where the mask By two time It is composed of the superposition of sigmoid functions of variables, specifically defined as In this definition, Indicates the temperature parameter as The sigmoid function, its independent variable Substitute the values into the mask function respectively. and .
[0025] In the third possible implementation of the first aspect, S5) performs the pseudo-label annotation step, including:
[0026] The remaining samples of the unlabeled dataset Perform smooth, random masked data augmentation to obtain augmented samples. ;
[0027] The same original sample and its corresponding augmented samples The first prediction result was obtained by inputting the basic EEG model into the input. Compared with the second prediction result ,in, , softmax For activation function, Represents the basic model of electroencephalography (EEG);
[0028] If the first prediction result Compared with the second prediction result Consistent predictions will result in consistent predictions. The original sample is assigned a pseudo-label; otherwise, no pseudo-label is assigned and it is returned to the unlabeled dataset.
[0029] In the fourth possible implementation of the first aspect, the steps of joint fine-tuning training (S6) include:
[0030] In each training batch, samples are drawn from the augmented labeled dataset and the pseudo-labeled dataset according to a preset ratio;
[0031] Calculate the first loss value of the model on labeled samples. and the second loss value on pseudo-labeled samples. ,in, The number of labeled samples for each training batch. It is the ratio of pseudo-labeled samples to labeled samples. Represents the cross-entropy function;
[0032] For the first loss value With the second loss value We perform a weighted summation to obtain the joint loss value. ,in The model parameters are then updated based on this joint loss value.
[0033] A second aspect of this application provides a device for fine-tuning a basic EEG model, comprising:
[0034] The acquisition module is used to acquire unlabeled EEG signal sets for downstream tasks;
[0035] The annotation module is used to select the most informative samples in the unlabeled dataset for annotation, and to perform smooth random masking data augmentation on the labeled samples to build an augmented labeled dataset. The EEG basic model is then fine-tuned and trained based on the augmented labeled dataset.
[0036] The pseudo-labeling module is used to perform smooth random masking data augmentation on the remaining samples of the unlabeled dataset. The original sample and its augmented sample are input into the model respectively. When the predicted values of the two are consistent, the predicted value is assigned as a pseudo label to the original sample to construct a pseudo-label dataset.
[0037] The training module is used for joint fine-tuning of the EEG baseline model on augmented labeled datasets and pseudo-labeled datasets.
[0038] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the efficient fine-tuning method for the basic EEG model provided in the first aspect of this application.
[0039] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the efficient fine-tuning method for the basic EEG model provided in the first aspect of this application.
[0040] It is understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.
[0041] The beneficial effects of the embodiments in this application compared with the prior art are:
[0042] By interpolating labeled prototype features and unlabeled sample features, and selecting information-rich candidate samples based on predicted differences, combined with cluster analysis to ensure sample diversity, this approach effectively improves the sample selection quality during active learning within a limited labeling budget. Furthermore, a consistency verification mechanism assigns qualified pseudo-labels to unlabeled samples, fully exploring the potential value of unlabeled data. This scheme organically combines active learning and semi-supervised learning, significantly reducing the reliance on expert annotations for model fine-tuning. It maintains classification accuracy even with a small number of labeled samples, while simultaneously improving model training efficiency and shortening the deployment preparation cycle of the brain-computer interface system. Attached Figure Description
[0043] Figure 1 This is a flowchart of an efficient fine-tuning method for a basic EEG model provided in an embodiment of this application;
[0044] Figure 2 This is a schematic diagram of a technical framework used in the efficient fine-tuning method for the basic EEG model provided in the embodiments of this application;
[0045] Figure 3 This is a schematic diagram of the structure of a fine-tuning device for a basic EEG model provided in an embodiment of this application;
[0046] Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0047] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application can also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail. Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0048] In the field of brain-computer interface technology, basic EEG models are pre-trained on massive amounts of unlabeled EEG data through self-supervised learning, thereby obtaining feature representations with strong generalization capabilities and adapting them to various downstream tasks with fine-tuning. These models address the inherent limitations of traditional deep learning methods designed for single tasks: due to significant differences in EEG signals patterns and features across different tasks, these models struggle to handle multi-task scenarios; and the performance improvement of these methods faces bottlenecks due to the scarcity of large-scale, high-quality labeled data.
[0049] While basic EEG models have shown potential in multi-task scenarios, their fine-tuning process suffers from two key drawbacks: heavy reliance on extensive expert data annotation and a lack of intelligent selection of sample value within limited annotation budgets, as well as an inability to uncover the information potential in unlabeled data. These issues severely restrict the application of basic EEG models in multi-task scenarios.
[0050] To address the aforementioned issues, this application proposes an efficient fine-tuning method, apparatus, and device for EEG baseline models. Through an active learning method based on feature space, a small number of samples with diversity and information content are selected for expert annotation. Furthermore, unlabeled samples are assigned pseudo-labels using a consistency-based semi-supervised learning method, constructing a pseudo-label dataset. The EEG baseline model is trained on both the augmented and annotated datasets, improving the downstream task classification accuracy of the EEG baseline model and reducing the annotation cost of downstream datasets. For more specific technical implementation details of this application's embodiments, please refer to the various method embodiments described below.
[0051] Please see Figure 1 This application illustrates an efficient fine-tuning method for a basic EEG model, comprising:
[0052] 101. Obtain unlabeled EEG signals for downstream tasks;
[0053] Downstream tasks of the brain-computer interface in this application include, but are not limited to, emotion recognition, sleep state classification, epilepsy monitoring, and motor imagery. During signal acquisition, the subject's EEG signals are recorded according to the experimental settings of the corresponding task. For example, in the emotion recognition task, the subject views emotion-evoking images or videos; in the sleep staging task, the subject's EEG signals are systematically recorded throughout the night; in the epilepsy monitoring task, the subject's EEG signals are continuously collected in clinical monitoring or daily environments; and in the motor imagery task, the subject's EEG signals are collected as they imagine actions in their mind based on prompts. Since the annotation of EEG signals requires specialized expertise and is a costly task, the technical solution of this application selects the most valuable samples for annotation with a limited annotation budget and utilizes a large number of unlabeled samples for training, achieving low-cost and high-precision fine-tuning of the basic EEG model.
[0054] 102. Under the preset annotation budget, select a candidate sample set from the unlabeled dataset for expert annotation to obtain an annotated dataset;
[0055] The efficient fine-tuning method for EEG baseline models provided in this application uses an active learning approach to select the most informative samples for expert annotation, thereby improving the model's fine-tuning performance within a limited annotation budget. Traditional active learning methods select samples based on the uncertainty of the model's output space, neglecting the rich representations learned by the EEG baseline model during pre-training and the distributional differences between the model's decision boundary and the target data manifold. This application addresses these issues by employing a feature space-based active learning method. The active learning method provided in this application uses downstream datasets... Select The most informative EEG signal samples were used for expert annotation; in each sample selection, [the following samples were chosen]. Each sample was annotated and added to the labeled dataset. Then, fine-tune the basic EEG model on the updated labeled dataset. This step is repeated until the label budget is reached. Used up.
[0056] The process of screening samples using the active learning method provided in this application includes: defining the pre-trained encoder of the EEG basic model as... unlabeled dataset samples and labeled datasets samples Encoding as features and By averaging the features of labeled samples in each category, prototype features for a specific category are constructed. For each unlabeled feature Using prototype features Perform interpolation to generate features ,in It is the interpolation rate, achieved by maximizing the interpolation features. and original features The model prediction loss is used for optimization; EEG basic model prediction interpolation features tags ,if With original features Predicted labels If they are different, then the corresponding samples will be... Add to candidate set Finally, for the candidate set conduct Mean clustering, and The sample closest to the cluster center is added to the labeled sample set. Expert annotation is performed during this process. The above sample selection process is carried out in the encoder. It operates within the learned feature space, leveraging its ability to capture neurophysiological patterns in the original signal. This sample selection strategy can learn features from downstream tasks that the base model has not yet captured, thus providing more accurate boundary representations.
[0057] 103. Perform smooth random mask data augmentation on the labeled dataset, and assign the original true labels corresponding to the labeled dataset to the augmented samples to generate an augmented labeled dataset, and fine-tune the training of the EEG basic model.
[0058] After selecting a candidate set, performing expert annotation, and constructing an annotated dataset, due to the importance and scarcity of the annotated samples, this embodiment uses a smoothed random mask data augmentation method defined as follows: For each labeled sample Generate enhanced samples The original labels are retained and added to the original dataset to generate an augmented labeled dataset. After that, the basic EEG model was developed. Further fine-tuning.
[0059] Smoothed random masking data augmentation method for EEG signals The values of a portion of the time window are replaced with zero. The implementation steps include:
[0060] EEG signals Random sampling time points ,in, To ensure uniform distribution, Indicates sample The start time point, Indicates sample The end time point, Indicates the length of the time window to be masked;
[0061] Sample With mask Multiply to obtain the enhanced sample. Its time window The value of is replaced with zero, where , Indicates the temperature parameter as The sigmoid function.
[0062] 104. Perform pseudo-label annotation on the remaining samples in the unlabeled dataset to generate a pseudo-labeled dataset;
[0063] In the steps described above, from the unlabeled dataset We select the samples with the most information for annotation and use data augmentation to expand the size of the labeled dataset to fine-tune the base model. However, the downstream dataset... The remaining unlabeled samples are ignored, despite their potential to further improve model performance. To address this limitation, embodiments of this application provide a consistency-based pseudo-labeling method specifically designed for EEG baseline models, aiming to enhance data through smooth, random masking. To mine the remaining unlabeled samples.
[0064] The pseudo-labeling method steps in this application embodiment include: for each unlabeled sample Generate enhanced samples Unlabeled samples and enhanced samples Input EEG basic model defined as The class probability distribution is obtained by calculating it using the following formula:
[0065]
[0066]
[0067] softmax Activation function; unlabeled samples and enhanced samples The predicted labels are respectively from and Obtain; if the two predicted labels are consistent (i.e. Then the original unlabeled sample Assign pseudo-labels Add it to the pseudo-label dataset If a sample is added, it is discarded to prevent noise propagation; otherwise, it is discarded. This process iterates until convergence, meaning no new samples are added throughout the evaluation process. This consistency-based pseudo-labeling method is invariant to physiologically plausible EEG signal changes. By requiring consistency between the original and enhanced EEG signals, the model achieves a robust representation consistent with the low signal-to-noise ratio characteristics of EEG, significantly improving pseudo-labeling efficiency without requiring confidence tuning of unlabeled data.
[0068] 105. Joint fine-tuning training of the basic EEG model based on augmented labeled dataset and pseudo-labeled dataset.
[0069] After the above steps, the existing augmented labeled sample set is obtained. and pseudo-label datasets The basic EEG model was used in small batches. and Joint training will be conducted on the same platform. In each batch, One labeled sample and Unlabeled samples The input is fed into the basic EEG model, where µ is the ratio of pseudo-labeled samples to labeled samples. Supervised loss is applied. and unsupervised loss The results are obtained by calculating using the following formulas respectively:
[0070]
[0071]
[0072] in The cross-entropy function is expressed by the following formula:
[0073]
[0074] in This refers to the number of categories. The final training loss of the base model is:
[0075]
[0076] in A balance was struck between supervised and unsupervised losses. During optimization, the parameters of the underlying EEG model were updated via backpropagation to minimize... This optimizes feature representation and classification boundaries. This joint training strategy utilizes both scarce labeled samples and a large number of unlabeled samples to enhance the model's generalization ability.
[0077] As an example, Figure 2 This is a schematic diagram of a technical framework used in the efficient fine-tuning method for the basic EEG model provided in the embodiments of this application. Figure 2This paper presents an efficient fine-tuning framework for an EEG baseline model based on active learning and semi-supervised learning. It intelligently selects the most valuable samples for labeling and assigns reliable pseudo-labels to unlabeled samples based on prediction consistency, thereby mining the information contained in unlabeled data. The framework mainly includes three stages: active selection and labeling, pseudo-label dataset construction, and joint training. In the active selection and labeling stage, the unlabeled sample set is screened and labeled as described above, selecting the most informative samples within a limited labeling budget. Then, data augmentation methods are used to enhance the labeled samples, constructing an augmented labeled dataset on which the EEG baseline model is further fine-tuned. In the pseudo-label dataset construction stage, pseudo-labels are assigned to unlabeled samples as described above, generating high-accuracy pseudo-labels and improving the model's robustness to low signal-to-noise ratios in EEG. In the joint training stage, the EEG baseline model is trained on both the augmented labeled dataset and the pseudo-label dataset, improving the model's generalization ability.
[0078] It can be seen that, Figure 2 This paper presents a novel data-efficient model fine-tuning framework that can select the most valuable sample labels within a limited labeling budget and perform data augmentation on labeled datasets to alleviate the scarcity of labeled data. Then, unlabeled samples are assigned reliable pseudo-labels based on the model's predictive consistency, effectively mining information from a large number of unlabeled samples, preventing the basic EEG model from overfitting on a small number of labeled samples, improving the model's generalization ability, and reducing the labeling cost of model fine-tuning.
[0079] The technical solution of this application addresses the high labeling cost problem caused by the need for a large amount of labeled data for fine-tuning of the EEG baseline model in downstream tasks. It uses a feature space-based active learning method to select the most informative samples from the downstream unlabeled dataset for labeling, and increases the size of the labeled dataset through data augmentation to alleviate the scarcity of labeled samples. To fully utilize the information contained in the remaining large number of unlabeled samples, a consistency-based pseudo-labeling method is used to generate pseudo-labels for each unlabeled sample, preventing the model from overfitting due to insufficient training data. Finally, the EEG baseline model is jointly trained on the augmented labeled dataset and the pseudo-labeled dataset. This process fully utilizes the knowledge gained by the EEG baseline model during large-scale data pre-training to select samples for labeling and generates reliable pseudo-labels based on the consistency of the model's output. This significantly improves the model's classification accuracy and generalization under a limited labeling budget, reducing the need for a large number of labeled samples when fine-tuning the EEG baseline model in downstream tasks.
[0080] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0081] The efficient fine-tuning method for the EEG basic model provided in this application embodiment can be applied to electronic devices such as mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). This application embodiment does not impose any restrictions on the specific type of electronic device.
[0082] The above mainly describes an efficient fine-tuning method for a basic EEG model. The following will describe a fine-tuning device for a basic EEG model.
[0083] Please see Figure 3 This application illustrates a device for fine-tuning a basic EEG model, comprising:
[0084] The acquisition module 301 is used to acquire the unlabeled EEG signal set of the downstream task;
[0085] The annotation module 302 is used to select the most informative samples in the unlabeled dataset for annotation, and to perform smooth random masking data augmentation on the annotated samples to construct an augmented annotation dataset. The EEG basic model is fine-tuned and trained based on the augmented annotation dataset.
[0086] The pseudo-labeling module 303 is used to perform smooth random masking data augmentation on the remaining samples of the unlabeled dataset, and input the original sample and its augmented sample into the model respectively. When the predicted values of the two are consistent, the predicted value is assigned as a pseudo label to the original sample to construct a pseudo-label dataset.
[0087] Training module 304 is used for joint fine-tuning training of the EEG base model on augmented labeled datasets and pseudo-labeled datasets.
[0088] In some embodiments, the determining module 302 includes:
[0089] The first annotation unit is used to randomly select a portion of the initial samples from the unlabeled EEG signal set for expert annotation, forming the initial annotation dataset; the pre-trained EEG basic model is initially trained based on the initial annotation dataset.
[0090] The first computational unit is used to construct prototype feature templates for each category based on the initially trained model.
[0091] The second annotation unit is used to filter out candidate sample sets in subsequent iterations; using the currently updated model, for samples in the unlabeled EEG signal set, its features are interpolated with the prototype feature template to generate interpolated features; based on the difference between the model's prediction results of the original features and the interpolated features, candidate samples are determined from the unlabeled EEG signal set; cluster analysis is performed on the candidate samples, and representative samples are selected for expert annotation to update the annotation dataset; the model is retrained based on the updated annotation dataset.
[0092] The first transformation unit is used to perform data augmentation on the labeled dataset and assign the original true labels of the labeled dataset to the data-augmented samples to construct the augmented labeled dataset.
[0093] In some embodiments, the determining module 303 includes:
[0094] The second transformation unit is used to perform data augmentation on samples in the unlabeled sample set to generate augmented samples.
[0095] The third annotation unit is used to input the unlabeled sample and its enhanced sample into the EEG basic model to obtain the first prediction result and the second prediction result. If the first prediction result and the second prediction result are consistent, the consistent prediction result is assigned as a pseudo-label to the unlabeled sample to construct a pseudo-label dataset.
[0096] In some embodiments, the determining module 304 includes:
[0097] The first training unit is used to extract samples from the augmented labeled dataset and the pseudo-labeled dataset according to a preset ratio in each training batch;
[0098] The second calculation unit is used to calculate the first loss value of the model on labeled samples and the second loss value on pseudo-labeled samples.
[0099] The first update unit is used to perform a weighted summation of the first loss value and the second loss value to obtain a joint loss value, and to update the model parameters based on the joint loss value.
[0100] The process by which each module in the EEG basic model fine-tuning device provided in this application implements its respective function can be specifically referred to the foregoing. Figure 1 The descriptions of the embodiments shown and other related method embodiments are not repeated here.
[0101] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0102] Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 4 in this embodiment includes: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40. When the processor 40 executes the computer program 42, it implements the steps in the embodiments of the efficient fine-tuning methods for the various EEG basic models described above, for example... Figure 1 Steps 101-105 are shown. Alternatively, when the processor 40 executes the computer program 42, it implements the functions of each module / unit in the above-described device embodiments, for example, implementing... Figure 3 The functions of modules 301-304 of the device shown.
[0103] The computer program 42 can be divided into one or more modules / units, which are stored in the memory 41 and executed by the processor 40 to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 42 in the electronic device 4.
[0104] The processor 40 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0105] The memory 41 can be an internal storage unit of the electronic device 4, such as a hard disk or memory. The memory 41 can also be an external storage device of the electronic device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Furthermore, the memory 41 can include both internal and external storage units of the electronic device 4. The memory 41 is used to store the computer program and other programs and data required by the electronic device. The memory 41 can also be used to temporarily store data that has been output or will be output.
[0106] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the above-described method embodiments.
[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0108] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0109] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0110] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.
[0111] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0112] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0113] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0114] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for efficient fine-tuning of a basic EEG model, characterized in that, include: S1) Obtain the unlabeled EEG signal set for the downstream task; S2) Under the preset annotation budget, a candidate sample set is selected from the unlabeled dataset for expert annotation to obtain an annotated dataset; S3) Perform smooth random mask data augmentation on the labeled dataset, and assign the original true labels corresponding to the labeled dataset to the augmented samples to generate an augmented labeled dataset; S4) Fine-tune the basic EEG model based on the augmented labeled dataset; S5) Perform pseudo-label annotation on the remaining samples of the unlabeled dataset to generate a pseudo-labeled dataset; S6) The basic EEG model is jointly fine-tuned and trained based on the augmented labeled dataset and the pseudo-labeled dataset.
2. The method as described in claim 1, characterized in that, The step of S2) to select the candidate sample set includes: A portion of the initial samples are randomly selected from the unlabeled dataset for expert annotation to form the initial labeled dataset; The basic EEG model was initially trained based on the initial labeled dataset. Based on the initially trained model, the samples of the labeled dataset... Encoding as features Then, the features of the labeled samples in each category are averaged to construct prototype feature templates for each category. ,in, This represents the pre-trained encoder of the basic EEG model; The model and the labeled dataset are updated through an iterative process, which includes: Using the currently trained model, for the samples of the unlabeled dataset to its characteristics With the prototype feature template Perform feature interpolation to generate interpolated features. ,in It is the interpolation rate; Based on the model, the original features With the interpolation features Based on the differences in prediction results, candidate samples are determined from the unlabeled dataset; Cluster analysis is performed on the candidate samples, and representative samples from each category are selected for expert annotation to update the annotation dataset; The model was then retrained based on the updated labeled dataset, and the updated prototype feature template was recalculated. ; Repeat this iterative process until the amount of labeled data reaches the stated labeling budget.
3. The method as described in claim 1, characterized in that, The step S3) of performing smooth random mask data augmentation on the labeled dataset includes: For the samples in the labeled dataset Random sampling time points ,in, To ensure uniform distribution, The sample The start time point, The sample The end time point, Indicates the length of the time window to be masked; The sample With mask Multiply to obtain the enhanced sample. Its time window The value of is replaced with zero, where the mask By two time It is composed of the superposition of sigmoid functions of variables, specifically defined as In this definition, Indicates the temperature parameter as The sigmoid function, its independent variable Substitute into the mask function respectively and .
4. The method as described in claim 1, characterized in that, The step of performing pseudo-label annotation in S5) includes: For the remaining samples of the unlabeled dataset Perform the smoothed random mask data augmentation to obtain the augmented sample. ; The same original sample and its corresponding augmented samples The first prediction result was obtained by inputting the basic EEG model into the input. Compared with the second prediction result ,in, , softmax For activation function, This represents the basic EEG model; If the first prediction result Compared with the second prediction result Consistent predictions will result in consistent outcomes. The original sample is assigned a pseudo-label; otherwise, no pseudo-label is assigned and it is returned to the unlabeled dataset.
5. The method as described in claim 1, characterized in that, The steps of joint training in S6 include: In each training batch, samples are drawn from the augmented labeled dataset and the pseudo-labeled dataset according to a preset ratio; Calculate the first loss value of the model on labeled samples. and the second loss value on pseudo-labeled samples. ,in, The number of labeled samples for each training batch. It is the ratio of pseudo-labeled samples to labeled samples. Represents the cross-entropy function; For the first loss value Compared with the second loss value We perform a weighted summation to obtain the joint loss value. ,in The model parameters are then updated based on this joint loss value.
6. A device for fine-tuning a basic EEG model, characterized in that, include: The acquisition module is used to acquire unlabeled EEG signal sets for downstream tasks; The annotation module is used to select the most informative samples in the unlabeled dataset for annotation, and to perform smooth random masking data augmentation on the annotated samples to construct an augmented annotated dataset. The EEG basic model is then fine-tuned and trained based on the augmented annotated dataset. The pseudo-labeling module is used to perform the smooth random mask data augmentation operation on the remaining samples of the unlabeled dataset, and input the sample and its augmented sample into the model respectively. When the predicted values of the two are consistent, the predicted value is assigned as a pseudo-label to the sample to construct a pseudo-label dataset. The training module is used for joint fine-tuning training of the EEG baseline model on the augmented labeled dataset and the pseudo-labeled dataset.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.