Epilepsy is a common neurological disease,characterized by sudden,repetitive,and difficult to cure.Therefore,designing an early warning mechanism is very beneficial for patients.This thesis proposes an online epilepsy early warning algorithm based on deep learning.Using scalp electroencephalogram(EEG)data,our goal is to accurately and real-time detect the preictal brain state,that is,the model needs to effectively distinguish between preictal and interictal EEG fragments.We use the original EEG signal as input and only use a non overlapping segmentation method to divide the data into 5-second EEG fragments.In addition,we do not use any preprocessing methods such as filtering,denoising,and artifact removal,which reduces the amount of computation and is conducive to real-time prediction.In order to comprehensively consider the spatial and temporal information of EEG data,this thesis designs two fusion models,CANet+Bi GRUTA and CNN-ET.CANet is a convolutional neural network(CNN)that introduces coordinate attention,Bi GRUTA is a bidirectional gated recurrent unit(Bi GRU)that introduces temporal attention,and ET refers to Encoder of Transformer.The two models adopt different fusion architectures.CANet+Bi GRUTA is more like "parallel",where the two models process data separately and are relatively independent of each other,while CNN-ET is more like "series",with the output of the previous model serving as the input of the latter model.To further illustrate the effectiveness of the model,we used a benchmark model and a comparison model to verify.The role of the benchmark model is to verify the effectiveness of the model architecture,so we choose multilayer perceptron(MLP),the most fundamental model in the field of deep learning,as the benchmark model.The role of the comparison model is to verify the effectiveness of each module of the model.In this thesis,CNN+Bi GRU and CNN-Bi GRU are designed as comparison models of CANet+Bi GRUTA and CNN-ET,respectively.In order to enhance the performance of the model and bring it closer to real life scenarios,we used a post processing method of group prediction to smooth the output.In this thesis,the length of the group is set to2 minutes.This thesis uses the well-known public dataset CHB-MIT for experiments.The experimental results show that the performance of both models is better than that of the comparison model and significantly better than that of the benchmark model.The CNNET has the best effect,with an accuracy,sensitivity,and specificity of 95.34%,93.67%,and 97.01%,respectively,and a prediction time of 0.1613 s.Compared to the benchmark model MLP,the three indicators have been improved by 19.51%,27.10%,and 11.92%;Compared to its comparison model CNN-Bi GRU,it has increased by 4.80%,7.29%,and 2.31%,and the prediction time has only increased by 0.0298 seconds.CANet+Bi GRUTA has the second best effect,with the accuracy,sensitivity,and specificity of 94.57%,92.57%,and 96.58%,respectively,and the prediction time of0.3308 seconds.Compared with the benchmark model MLP,the three indicators have increased by 18.74%,26.00%,and 11.49%;Compared to its comparison model CNN+Bi GRU,it has increased by 1.14%,1.57%,and 0.71%,but the prediction time has increased by 0.1547 s.CNN-ET not only performs well overall,but also performs well for each patient.Of the 16 patients,13 performed best,with the classification accuracy of patients 1,9,20,and 23 even reaching 100%.CANET+Bi GRUTA only achieved 100% accuracy in patients 20 and 23,which proves that CNN-ET has good versatility and generalization ability,and can effectively address the physical problems of different patients,More importantly,the prediction time of CNN-ET is only half of that of CANet+Bi GRUTA.For online epilepsy early warning tasks with a prediction time of 0.1613 seconds in units of 2 minutes,the task goal can be basically achieved.Therefore,considering comprehensively,we believe that CNN-ET is the best model in this study.In order to further explore the importance of each module in CNN-ET,we conducted ablation study,which proved that ET had a significant improvement on the entire model.Removing the ET module reduced the accuracy,sensitivity,and specificity of the model by 12.15%,16.58%,and 7.72%,respectively.Layer normalization also improved to a certain extent.Without using layer normalization,the three indicators of the model decreased by 1.85%,2.64%,and 1.05%,respectively.Although CNN-ET is a black box algorithm,our ablation study can prove to some extent that the model is effective. |