Transform-based brain wave epilepsy detection method

By using a Transformer-based deep learning method to dynamically fuse the predicted probability vectors of multiple machine learning models, the problem of large number of parameters and complex parameter tuning in existing epilepsy detection models is solved, achieving more efficient epilepsy detection results and improving detection accuracy and generalization ability.

CN121434846APending Publication Date: 2026-01-30HUBEI UNIV FOR NATITIES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511520320.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-23
Publication Date
2026-01-30

AI Technical Summary

Technical Problem

Existing graph neural network models have a large number of parameters, require a large amount of high-quality data for training, and are complex to tune. They are difficult to apply effectively with small datasets, and existing models have insufficient accuracy and generalization ability in epilepsy detection.

Method used

By employing the Transformer deep learning method, input data is constructed through the training and prediction probability vectors of multiple machine learning models. Dynamic training is then performed using the attention of the Transformer model to achieve dynamic fusion between models, thereby improving the accuracy and generalization ability of epilepsy detection.

Benefits of technology

It improves the accuracy and generalization ability of epilepsy detection, can more accurately capture the long-term dependence and multi-scale patterns of EEG signals, provides an interpretable fusion process, and enhances the robustness and scalability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121434846A_ABST
    Figure CN121434846A_ABST
Patent Text Reader

Abstract

The invention provides a brain wave epilepsy detection method based on Transform. The method comprises the following steps: acquiring EDF data of a multi-channel electroencephalogram from a database, processing the EDF data, generating a CSV file, and performing data preprocessing on the generated CSV file; defining a plurality of machine learning models, and independently training the models on the EEG feature data to obtain the classification performance of the models; predicting a probability vector by using a machine learning model to construct Transform model input data; the attention of the Transform model is used for dynamic training, and a trained Transform fusion model is obtained; and outputting a prediction result, and storing the trained Transform fusion model. According to the method, more efficient model fusion is realized through dynamic fusion, and the accuracy and generalization ability of epilepsy detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of machine learning, and particularly relates to a brain wave epilepsy detection method based on a Transformer. BACKGROUND

[0002] The brain is one of the most critical and complex organs of the human body, and epilepsy is a brain disease, which is usually caused by abnormal discharge of brain neurons. Clinically, it is manifested as various symptoms such as visible disturbance of consciousness, convulsions, and abnormal sensation. The mechanism of epilepsy is complex, and may involve genetic factors, brain structure abnormalities, metabolic disorders, and trauma, so early and accurate diagnosis and effective monitoring of epilepsy are of great significance.

[0003] Multi-channel electroencephalogram is a voltage fluctuation graph detected by multiple electrodes placed on the scalp of a subject over a long period of time, which can accurately reflect effective information such as epilepsy type, seizure origin site, and recurrence risk after the first seizure, and plays an important role in the detection and monitoring of epilepsy. Epilepsy signals on the electroencephalogram show some characteristic waveforms, which are different from normal brain rhythms, mainly including sharp waves, spiky waves, slow waves, etc., which are the core basis for diagnosing epilepsy. The detection of electroencephalogram signals is one of the most important means for diagnosing epilepsy. In clinical practice, scalp electroencephalogram data applied to the detection and prediction of seizures can bring good results.

[0004] Epilepsy signals originate from abnormal synchronous discharge of neurons in the cerebral cortex. Normal brain activity is achieved through regular and non-synchronous discharge of neurons to complete information transmission, but in epilepsy patients, neurons in certain regions suddenly become synchronous and overexcited due to ion channel abnormalities, neurotransmitter imbalance, etc., resulting in large-scale abnormal electrical activity. This abnormal discharge propagates along the neural network, causing temporary brain dysfunction, which is manifested as clinical symptoms such as loss of consciousness, convulsions, abnormal sensation or behavior, etc.

[0005] In recent years, graph neural networks have been widely used in the detection of epilepsy electroencephalogram signals. Generally speaking, through continuous optimization of network structure, graph neural networks can effectively identify the presence of seizures and reveal their seizure patterns when analyzing electroencephalogram data. However, the graph neural network model has a huge number of parameters, and the training effect is heavily dependent on a large amount of high-quality and accurately labeled epilepsy EEG data, which is difficult to find in reality. In addition, the structure of the graph neural network model is flexible but sensitive, such as the number of layers, the number of heads, the embedding dimension, the learning rate, etc. The parameter settings are complex, which is not suitable for direct training under small data, and the parameter tuning cost is high. SUMMARY

[0006] In view of the above, the present application aims to overcome the above-mentioned problems in the prior art, and proposes a brain wave epilepsy detection method based on Transformer, which uses a Transformer deep learning method to fuse multiple machine learning models, and performs multiple training to obtain more excellent results.

[0007] To achieve the above purpose, the technical scheme of the present application is as follows:

[0008] In a first aspect, the present application provides a brain wave epilepsy detection method based on Transformer, comprising the following steps:

[0009] Step 1: Obtain EDF data of multi-channel electroencephalogram from the database, process the EDF data, generate a CSV file, and perform data preprocessing on the generated CSV file;

[0010] Step 2: Define multiple machine learning models, and independently train these models on EEG feature data to obtain their classification performance;

[0011] Step 3: Use the machine learning model prediction probability vector to construct the Transformer model input data;

[0012] Step 4: Dynamically train the attention of the Transformer model to obtain a trained Transformer fusion model;

[0013] Step 5: Output the prediction result, and save the trained Transformer fusion model.

[0014] Further, in step 1, the EDF data is processed to include:

[0015] First, extract a signal of every 10 seconds from the EDF format brain electrical data, and calculate a series of statistical and nonlinear features, then according to the label, mark whether each time period contains a seizure, provide a training label for subsequent supervised learning, and finally save the result as a structured CSV file.

[0016] Further, in step 1, the data preprocessing includes:

[0017] The CSV file is subjected to data preprocessing of removing variance and feature normalization to eliminate differences and make each feature on the same scale.

[0018] Further, in step 2, the multiple machine learning models include: logistic regression model, random forest model, multilayer perceptron, kernel support vector machine, and naive Bayes model.

[0019] Further, the step 4 includes:

[0020] The probability of each and its learning model is first mapped to an embedding vector through a linear layer, position encoding is added, and model sequential information is retained;

[0021] The multi-layer Transformer encoder captures the complex interaction relationship between models, and finally makes a binary classification prediction through a small MLP, outputting a binary classification result.

[0022] Further, the model is evaluated, including the following indicators:

[0023]

[0024] Wherein, TP: the number of samples correctly predicted by the model as positive, FP: the number of samples incorrectly predicted by the model as positive, FN: the number of samples incorrectly predicted by the model as negative, TN: actually negative, and predicted negative.

[0025] In a second aspect, the present application provides a brain wave epilepsy detection device based on Transformer, comprising

[0026] The first processing module is configured to obtain EDF data of multi-channel electroencephalogram from a database, process the EDF data, generate a CSV file, and perform data preprocessing on the generated CSV file.

[0027] The second processing module is configured to define a plurality of machine learning models, and independently train the models on EEG feature data to obtain their classification performance.

[0028] The third processing module is configured to use the machine learning model prediction probability vector to construct Transformer model input data.

[0029] The fourth processing module is configured to use the attention of the Transformer model for dynamic training to obtain a trained Transformer fusion model.

[0030] The fifth processing module is configured to output a prediction result and save the trained Transformer fusion model.

[0031] In a third aspect, the present application provides an electronic device comprising a processor and a memory in communication with the processor and configured to store instructions executable by the processor, wherein the processor is configured to execute the above-mentioned brain wave epilepsy detection method based on Transformer.

[0032] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the above-mentioned brain wave epilepsy detection method based on Transformer.

[0033] EEG epilepsy detection method based on transformer

[0034] Compared with the prior art, the EEG epilepsy detection method based on transformer has the following advantages:

[0035] The EEG data is first trained by multiple different basic machine learning models (logistic regression, random forest, multilayer perceptron, kernel support vector machine, naive Bayes), the preferences, decision boundaries and generalization characteristics of different models are completely different, and different dimensions of information can be mined from the data. Then the prediction probabilities of them on the training set and the test set are spliced into new input data to input into a custom Transformer fusion model to learn the dependency between different basic models, and through dynamic fusion, more efficient model fusion is realized, thereby improving the accuracy and generalization ability of epilepsy detection. BRIEF DESCRIPTION OF DRAWINGS

[0036] The accompanying drawings, which form a part of this application, are intended to provide further understanding of the application and are incorporated herein for explanation in connection with the specific embodiments of the application. The specific embodiments of the application and their descriptions serve to explain the application without unduly limiting it. In the drawings:

[0037] Figure 1 is an EDF file processing diagram in the embodiment of the application;

[0038] Figure 2 is a fusion model training flowchart in the embodiment of the application;

[0039] Figure 3 is a method flowchart in the embodiment of the application;

[0040] Figure 4 is a model performance index diagram of the application. DETAILED DESCRIPTION

[0041] It should be noted that the embodiments in the application and the features in the embodiments can be combined with each other without conflict.

[0042] The application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0043] Embodiment 1:

[0044] The application provides a brain wave epilepsy detection method based on a Transformer, a plurality of different basic machine learning models (logistic regression, random forest, multilayer perceptron, kernel support vector machine, naive Bayes) are used to train EEG data, the preferences, decision boundaries and generalization characteristics of different models are completely different, and different dimensions of information can be mined from the data. Then the prediction probabilities of them on the training set and the test set are spliced into new input data to input into a custom Transformer fusion model to learn the dependency between different basic models, and through dynamic fusion, more efficient model fusion is realized, so as to improve the accuracy and generalization ability of epilepsy detection.

[0045] In epilepsy detection, compared with the traditional graph neural network fusion model, the Transformer fusion model can not only more accurately capture the long-time dependence and multi-scale mode of the EEG signal, but also dynamically adjust the model weight according to each sample and provide an interpretable fusion process, which makes it superior to the traditional deep learning fusion method in robustness, scalability and clinical practicability.

[0046] EDF is a standard data storage format used to save data of continuous physiological signals such as multi-channel electroencephalogram (EEG). In processing the EDF file, the system first extracts a signal of 10 seconds from the EDF format electroencephalogram data, and calculates a series of statistical and nonlinear features such as root mean square value (RMS), sample entropy, spectral entropy, wavelet energy and fractal dimension. These features can effectively capture the change rule of electroencephalogram activity during the seizure. Then according to the label, each time period is marked whether it contains a seizure, and the training label is provided for subsequent supervised learning. The final result is saved as a structured CSV file. The EDF file processing flow is shown in Figure 1 .

[0047] The method of the application is divided into multiple levels: first, in the basic model stage, a plurality of classifiers with obvious structural differences are selected, and the specific machine learning models are as follows:

[0048] 1. Logistic Regression model, which predicts the probability of an event belonging to a certain class by establishing a logistic function model, enhances robustness and can effectively reduce overfitting. Logistic regression = linear regression + Sigmoid function. The core is the logistic function (Sigmoid function), which maps any real number to the interval (0, 1) to represent the probability value. The formula of the logistic function is as follows:

[0049]

[0050] where e is the base of the natural logarithm, approximately equal to 2.71828.

[0051] 2. Random Forest, which can handle high-dimensional features of EEG data, has strong anti-fitting ability. For classification tasks, assuming there are N trees, the prediction result of each tree is h i (x), then the final prediction result is (where T is the number of trees):

[0052]

[0053] 3. Multi-layer Perceptron (MLP), suitable for medium-sized data, can handle complex nonlinear relationships. It is a feedforward neural network composed of multiple neurons, including input layer, output layer and hidden layer. Where W [l] represents the weight matrix of the lth layer, b [l] represents the bias vector, a [l] represents the activation layer, i.e. the output of the current layer, and σ refers to the activation function. For the lth layer of neurons:

[0054] z [l] = W [l] a [l-1] + b [l]

[0055] a [l] = σ(z [l] )4. Kernel Support Vector Machine (Kernel SVM), which can handle complex features and has high accuracy in binary classification. The goal of support vector machines is to find a hyperplane that separates samples of different classes as much as possible. This hyperplane can be represented as:

[0056] W·X + b = 0

[0057] where W is the weight vector and b is the bias term.

[0058] 5. Naive Bayes, which has good results on small sample EEG data and fast computation speed. This model is mainly based on Bayes' theorem: its formula is:

[0059]

[0060] P(C|X) is the posterior probability of class C given feature X. P(X|C), P(X|C), P(X|C) is the likelihood probability of observing feature X under class C. P(C) is the prior probability of class C. P(X) is the probability of feature X, which can be considered a constant because X is known for each sample to be classified.

[0061] In the meta-feature construction stage, instead of direct concatenation, an innovative approach is used: the predicted probability vectors of each model are used as new features, and these vectors are concatenated into a new high-dimensional "meta-feature space." This preserves the confidence distribution of each model for the samples and explicitly records the complementarity information between models, providing fine-grained input for subsequent fusion. This effectively reduces overfitting and enhances robustness. The concatenation formula is shown below:

[0062] z(x) = [p1(x), p2(x), ..., p n [x], where n is the number of vectors.

[0063] Subsequently, in the custom fusion phase, positional encoding is used to address the ordering issue of model tokens. This ensures that each token indicates "which model it is," allowing the Transformer to distinguish between different base models during attention computation, thus better constructing their relationships. Positional encoding generates a set of fixed-pattern vectors for different models, with the following formula: where pos is the model number and d is the embedding dimension.

[0064]

[0065] Finally, a multi-layer Transformer encoder is used to capture the dependencies and complementarities between different models; then, pooling and a small MLP classification head are used for fusion prediction to output a binary classification result. Overall, it achieves adaptive dynamic weighted fusion of prediction results from multiple base models, resulting in stronger robustness, generalization, and interpretability in epilepsy detection than simple voting or averaging.

[0066] Finally, the metrics are saved for evaluation. The specific metrics are as follows:

[0067]

[0068] Where TP: Number of samples correctly predicted as positive by the model. FP: Number of samples incorrectly predicted as positive by the model. FN: Number of samples incorrectly predicted as negative by the model. TN: Samples that were actually negative and were also predicted as negative.

[0069] The training process of the fusion model is as follows Figure 2 As shown. Finally, the trained detection model and results are saved for use in the epilepsy detection model inference.

[0070] The specific implementation process of the method of the present invention is as follows: Figure 3 As shown:

[0071] 1. Retrieve EDF data from the database;

[0072] 2. Process the EDF data to generate a CSV file for subsequent reading and processing by machine learning models;

[0073] 3. Data preprocessing of the CSV file for variance removal and feature normalization, aiming to eliminate differences and make each feature on the same scale;

[0074] 4. Defining machine learning models and independently training these models on EEG feature data to obtain their classification performance;

[0075] 5. Using the training results of the machine learning models as new input data for splicing to form new features;

[0076] 6. Training the Transformer fusion model;

[0077] 6.1. The probability of each base model is first mapped to an embedding vector through a linear layer. Position encoding is added to preserve the model order information;

[0078] 6.2. A multi-layer Transformer encoder captures complex interaction relationships between models. Finally, a small MLP is used for binary classification prediction;

[0079] 7. Save the results of each model, and the performance indicators of the model are as shown in Figure 4 It can be seen that the accuracy of LogisticRegression is high, but there are many false positives; Random Forest is prone to missed detection; MLP and Kernel SVM are generally weak; Naive Bayes is too high without reservation; the use of Transformer to fuse models has greatly improved the effect compared to single models, successfully combining the shortcomings of each model and avoiding the defects of single models.

[0080] Embodiment 2:

[0081] A brain wave epilepsy detection device based on Transformer, comprising

[0082] A first processing module is configured to obtain EDF data of multi-channel electroencephalogram from a database, process the EDF data, generate a CSV file, and perform data preprocessing on the generated CSV file;

[0083] A second processing module is configured to define a plurality of machine learning models, and independently train these models on EEG feature data to obtain their classification performance;

[0084] A third processing module is configured to use the machine learning model prediction probability vector to construct Transformer model input data;

[0085] A fourth processing module is configured to use the attention of the Transformer model for dynamic training to obtain a trained Transformer fusion model;

[0086] The fifth processing module is configured to output the prediction result and save the trained Transformer fusion model.

[0087] Embodiment 3

[0088] An electronic device includes a processor and a memory connected to the processor and configured to store instructions executable by the processor, the processor configured to perform the above-mentioned method for detecting epilepsy based on a Transformer.

[0089] The method for detecting epilepsy based on a Transformer.

[0090] Embodiment 4

[0091] A computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the above-mentioned method for detecting epilepsy based on a Transformer.

[0092] The collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the present disclosure comply with relevant laws and regulations and do not violate public order and good customs.

[0093] It should be noted that the personal information from the user should be collected for legal and reasonable purposes, and should not be shared or sold outside these legal uses. In addition, such collection / sharing should be carried out after the user's informed consent is received, including but not limited to informing the user to read the user agreement / user notice before the user uses the function, and signing an agreement / authorization including authorization of relevant user information. In addition, any necessary steps should be taken to protect and ensure access to such personal information data, and to ensure that other people with access to personal information data comply with their privacy and procedures.

[0094] The present disclosure contemplates that user-selectable options for allowing or disabling access to personal information data can be provided to the user. That is, the present disclosure contemplates that hardware and / or software components can be provided to prevent or detect unauthorized access to such personal information data. Where the personal information data is stored on the user's device, the data can be deleted, for example, when the user deletes the device's contents or when the device is factory reset. In addition, where the personal information data is stored on the device, the data can be rendered inaccessible by disabling the device's functionality. In addition, the personal information data can be removed from the user's personal identification to protect the user's privacy.

[0095] The acquisition, transmission, storage, use, processing, etc. of data in the technical solutions of the present disclosure comply with the relevant provisions of national laws and regulations.

[0096] It should be noted that in the embodiments of the present disclosure, some industry existing solutions, components, models, etc. may be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility of the technical solution implementation of the present application, but does not mean that the applicant has or will necessarily use the solution.

[0097] In the foregoing embodiment description, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present disclosure. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the skilled in the art can combine and combine the different embodiments or examples described in the specification and the features of the different embodiments or examples without contradiction.

[0098] In addition, the terms "first", "second" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "multiple" is at least two, for example, two, three, etc., unless otherwise explicitly specified.

[0099] Any process or method descriptions in flow charts or otherwise described herein represent embodiments that can be understood as a module, segment, or portion of code that includes one or more executable instructions for implementing the specified logical function or process. The scope of the preferred embodiments of the present disclosure includes additional implementation in which the functions described in the illustrated or discussed order are performed in a different order, including substantially simultaneously, or in reverse order, according to the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.

[0100] The logic and / or steps represented in the flowcharts and / or described herein, for example, can be considered as a sequence of instructions to implement logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device, such as a computer-based system, processor- based system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The computer-readable medium can be a computer- readable storage medium or a computer-readable signal medium. The computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include the following: an electrical connection having one or more wires (electrical connections), a portable computer diskette (a magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium can even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, for example, via optical scanning of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and stored in a computer memory.

[0101] It should be understood that aspects of the present disclosure can be implemented in hardware, software, firmware or combinations thereof. In the above embodiments, the various steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As such, if implemented in hardware, and in another embodiment, any of the following technologies, known in the art, or their combinations can be used to implement the above-described embodiments: discrete logic circuitry having logic gates for logic functions on data signals, application-specific integrated circuits having appropriate combinational logic gates, programmable gate arrays (PGA), field programmable gate arrays (FPGA), and the like.

[0102] Those skilled in the art can understand that all or part of the steps carried out by the above-mentioned embodiments can be completed by programs instructing related hardware, and the programs can be stored in a computer-readable storage medium. When the programs are executed, one or a combination of the steps of the method embodiments is included.

[0103] In addition, each functional unit in each embodiment of the present disclosure can be integrated in one processing module, or each unit can exist physically separately, or two or more units can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software functional module. When the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium.

[0104] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present disclosure have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present disclosure.

Claims

1. A method for detecting brain waves of epilepsy based on a Transformer, characterized in that: The method comprises the following steps: Step 1: obtaining EDF data of multi-channel electroencephalogram from a database, processing the EDF data, generating a CSV file, and performing data preprocessing on the generated CSV file; Step 2: defining a plurality of machine learning models, and independently training the models on EEG feature data to obtain their classification performance; Step 3: constructing Transformer model input data using a machine learning model prediction probability vector; Step 4: dynamically training using the attention of the Transformer model to obtain a trained Transformer fusion model; Step 5: outputting a prediction result, and saving the trained Transformer fusion model.

2. The method of claim 1, wherein the method is based on a Transformer. In step 1, the EDF data is processed by: First, extract a signal of 10 seconds from the EDF format electroencephalogram data, and calculate a series of statistical and nonlinear features, then according to the label, label whether each time period contains a seizure, provide training labels for subsequent supervised learning, and finally save the result as a structured CSV file.

3. The method of claim 1, wherein the method is based on a Transformer. In step 1, the data preprocessing includes: Performing data preprocessing of variance removal and feature normalization on the CSV file to eliminate differences and make each feature on the same scale.

4. The method of claim 1, wherein the method is based on a Transformer. In step 2, the plurality of machine learning models include: a logistic regression model, a random forest model, a multilayer perceptron, a kernel support vector machine, and a naive Bayes model.

5. The method of claim 1, wherein the method is based on a Transformer. Step 4 includes: The probability of each machine learning model is first mapped to an embedding vector through a linear layer, and position encoding is added to preserve the model order information; A multi-layer Transformer encoder captures complex interaction relationships between models, and finally a small MLP is used for binary classification prediction to output a binary classification result.

6. The method of claim 1, wherein the method is based on a Transformer. The model is also evaluated, including the following indicators: Where TP is the number of samples correctly predicted as positive by the model, FP is the number of samples incorrectly predicted as positive by the model, FN is the number of samples incorrectly predicted as negative by the model, and TN is the actual negative and predicted negative. 7.A brain wave seizure detection apparatus based on a Transformer, characterized in that: It includes: A first processing module for obtaining EDF data of multi-channel electroencephalogram from a database, processing the EDF data, generating a CSV file, and performing data preprocessing on the generated CSV file; A second processing module for defining a plurality of machine learning models, and independently training the models on EEG feature data to obtain their classification performance; A third processing module for constructing Transformer model input data using a machine learning model prediction probability vector; A fourth processing module for dynamically training using the attention of the Transformer model to obtain a trained Transformer fusion model; A fifth processing module for outputting a prediction result, and saving the trained Transformer fusion model.

8. An electronic device, comprising a processor and a memory connected to the processor in communication, and configured to store executable instructions of the processor, characterized in that: The processor is configured to execute the method of any one of claims 1-6.

9. A computer readable storage medium storing a computer program, characterized in that: The computer program is executed by the processor to implement the method of any one of claims 1-6.