Epilepsy prediction method and system based on 2D-CNN and Cox-Stuart early stop mechanism

By using 2D-CNN and Cox-Stuart premature stop mechanisms in epilepsy prediction, features are directly extracted from EEG data and monitoring the loss function, solving the problems of high data annotation and complexity in the existing technology, achieving high efficiency , accurate prediction of epilepsy.

CN119235326APending Publication Date: 2025-01-03THE 940TH HOSPITAL OF THE CHINESE PEOPLES LIBERATION ARMY JOINT LOGISTICS SUPPORT FORCE
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411374554.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Existing epilepsy prediction methods require the collection of patient specific data for labeling and training when facing data that have never been seen, resulting in high time complexity and increased patient pain. At the same time, most methods are complex, affecting the best clinical treatment. time.

Method used

The epilepsy prediction method based on the premature stop mechanism of 2D-CNN and Cox-Stuart is adopted. By preprocessing the EEG data, the feature extraction and classification is directly used to reduce the time complexity and calculation complexity, and Cox-Stuart is used. Testing method monitors the loss function to avoid overfitting.

Benefits of technology

Efficient and accurate prediction of epilepsy is achieved, the computational complexity and time complexity of the model are reduced, and the generalization ability of the model is improved. The accuracy, sensitivity and specificity on the test set are all higher than 93%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119235326A_ABST
    Figure CN119235326A_ABST
Patent Text Reader

Abstract

The invention provides an epilepsy prediction method and system based on a 2D-CNN and a Cox-Stuart early stop mechanism, and the method comprises the steps: obtaining electroencephalogram data; preprocessing the electroencephalogram data, wherein the preprocessing comprises normalization and filtering; inputting the preprocessed signal into a pre-trained convolutional neural network epilepsy prediction model for feature extraction and classification, and predicting to obtain an epileptic seizure state; the training process of the pre-trained convolutional neural network epilepsy prediction model comprises the steps of putting training set data and verification set data into a CNN model for training and verification; judging whether a loss function of the verification set has a rising trend or not by adopting a Cos-Stuart test method, and early stopping; and storing the trained model parameters, and testing the model performance by using the test set data to obtain the pre-trained convolutional neural network epilepsy prediction model. Under the condition that only the data is preprocessed, the time domain signal of the data is directly used as the input of the model, so that the time complexity and the calculation complexity are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of disease prediction, and in particular to an epilepsy prediction method and system based on 2D-CNN and Cox-Stuart early stopping mechanism. Background Art

[0002] Epilepsy is a chronic brain disease. Its attacks are caused by sudden abnormal discharges of brain neurons, and the causes of the attacks are complex. The Guidelines of the International League Against Epilepsy summarize the following causes: genetic structural causes, infectious causes, structural causes, immune causes, metabolic causes, and unknown causes. The clinical manifestations of epilepsy include loss of consciousness, muscle twitching, and dyspnea. Studies have shown that repeated attacks of epilepsy are often accompanied by symptoms such as anxiety and depression. At present, there are about 50 million epilepsy patients in the world, regardless of age. Although a variety of epilepsy treatments have been proposed, about 30% of patients will relapse. The onset of epilepsy is sudden and recurrent, which brings great physical and mental distress to patients and their families. Although epileptic seizures can be predicted based on epilepsy diaries, the accuracy rate is less than 50%. Therefore, effective epilepsy prediction methods are of great significance.

[0003] In recent years, with the continuous development of neural networks, researchers have begun to use deep learning methods to try to classify epileptic EEG signals. Compared with machine learning, deep learning can process big data and extract high-dimensional features of data to improve the classification effect of the model. Pan et al. used the original EEG data and EEG data processed by FFT, STFT, and DWT as all inputs of CNN, and used the feature fusion mechanism to integrate the learned features. The proposed method can achieve an accuracy of more than 99%, but the experiment did not set test set data. The experimental results are all from cross-validation, which cannot prove the generalization ability of the model; Takahashi et al. used AE (autoencoder) to define high AE errors of more than 10 seconds in the interictal period as non-epileptic seizures but abnormal data after high-pass, low-pass, and notch filtering of the original data. Then, the data obtained by AE was used as the input of CNN. This method reduced the false alarm rate to 0.034 / h, which is one-fifth lower than the false alarm rate of the original CNN. Preprocessing steps are not necessary. For example, Golmohammadi directly used LFCCs (linear frequency cepstral coefficients) and their first-order and second-order inverses for feature extraction, and then input them into LSTM. Although the specificity was higher than 90%, the sensitivity was less than 35%. Jana et al. used NSGA-II (non-dominated sorting genetic algorithm) to select data from the three best channels, reducing the computational complexity, and directly used 1D-CNN to extract and classify the signals. The accuracy, sensitivity and specificity of the model were as high as 96%, but the experiment did not set test set data, and due to the high computational time complexity, only 5 patients' data were selected for channel selection and classification. Li et al. demonstrated that the convolutional neural network (CNN) with Waxman similarity graph produced the highest accuracy in all EEG data (iEEG, scalp EEG and combination). The 1-second epoch of the EEG was correctly assigned to their epileptic seizure period, pre-epileptic seizure period or inter-epileptic seizure period categories more than 98% of the time. However, there are few experimental data. Guo Shuwen et al. developed a deep convolutional neural network (DCNN) epilepsy EEG signal classification method (EEGC) based on transfer learning, which can classify the interictal period, preictal period and ictal period more accurately. The authors used transfer learning to overcome the problems of long training time and small amount of training data, and made full use of multi-channel information. The sensitivity of the three epileptic states was 97.8%, 93.6% and 95.8%, respectively, and the specificity was 99.2%, 97.1% and 99.3%, respectively.Shan Shaojie et al. selected the C3-P3 channel from multiple EEG channels, filtered the channel signal with a zero-phase shift filter, obtained the detail coefficients from DWT and calculated their energy values, then used LSTM to obtain the classification results, and performed Kalman filtering on the classification results to reduce the false alarm rate. The final prediction results achieved 98.95% accuracy and 98.73% sensitivity.

[0004] Most of the existing technologies use experiments independent of patients. Although this method obtains good results, when faced with data that has never been seen before, it is necessary to obtain the patient's data through EEG recording, and then the doctor labels the patient's epileptic seizure status, and put the labeled data into the model training. It is time-consuming and laborious, and increases the patient's pain and physical harm; moreover, most EEG data processing methods and models are relatively complex, resulting in high time complexity, which affects the optimal clinical treatment time. Therefore, it is very important to use all patient data as model input. For patient data that has never been seen before, inputting this data into the model can directly predict whether the patient will have epilepsy, without the need to collect data from the patient before and during the epileptic seizure period. Summary of the invention

[0005] In view of the above shortcomings, the present invention provides an epilepsy prediction method and system based on 2D-CNN and Cox-Stuart early stopping mechanism. The present invention proposes a model based on CNN and Cox-Stuart, which can directly use the time domain signal of the data as the input of the model when only preprocessing the data, reducing the time complexity and computational complexity. The experimental results show that the accuracy, sensitivity and specificity of the model on the test set are all higher than 93%.

[0006] To achieve the above purpose, the present invention adopts the following technical means:

[0007] The first aspect of the present invention is to provide an epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism, comprising:

[0008] Obtain EEG data;

[0009] Preprocess the EEG data, including normalization and filtering;

[0010] The preprocessed signal is input into a pre-trained convolutional neural network epilepsy prediction model for feature extraction and classification, and the epileptic seizure state is predicted; the training process of the pre-trained convolutional neural network epilepsy prediction model includes:

[0011] Preprocessing of epileptic EEG data, including data normalization and filtering;

[0012] The preprocessed epileptic EEG data are divided into training set data and validation set data, and the training set data and validation set data are put into the CNN model for training and verification; the Cos-Stuart test method is used to determine whether there is an upward trend and early stop for the loss function of the validation set; the model parameters after training are saved, and the model performance is tested using the test set data to obtain the pre-trained convolutional neural network epilepsy prediction model.

[0013] As a further improvement of the present invention, the epileptic EEG data includes waveform signals of the brain during the epileptic period and the non-epileptic period, and the start and end time of the epileptic attack have been marked; according to the start and end time of the epileptic attack, the epileptic attack state period is divided;

[0014] The epileptic EEG data are based on data from non-independent patients.

[0015] As a further improvement of the present invention, the epileptic EEG data is preprocessed, including normalization and filtering, specifically including:

[0016] Normalize and set max=1,min=0, we have:

[0017] X_std=(XX min ) / (X max -X min )

[0018] X_scaled=X_std*(max-min)+min

[0019] Among them, X is the original sequence, X max and X min are the maximum and minimum values ​​of the sequence, respectively. X_std is the standardized sequence. max and min are the upper and lower limits of the target scaling range, respectively. X_scaled is the normalized sequence.

[0020] The filtering uses a notch filter to filter out 60Hz power frequency noise, and a high-pass filter to filter out noise less than 1Hz.

[0021] As a further improvement of the present invention, the CNN model is a 2D-CNN model using 3 2-dimensional convolutional layers, 2 batch normalization layers, 2 maximum pooling layers, and 2 activation functions.

[0022] As a further improvement of the present invention, the Cox-Stuart test method is used to determine whether the validation set loss function has an upward trend so as to stop the training early; when p Cox-Stuart When the value is ≤0.05, and the positive number pairs are greater than the negative number pairs, it means that the loss function has an upward trend. The learning rate is reduced to 0.1 times of the original value. When the number of upward trends reaches the set threshold, the model is no longer trained. When p Cox-StuartWhen the value is ≤0.05, and the positive pair is smaller than the negative pair, it means that the loss function has a downward trend, and training continues. If the above two conditions are not met, continue to train the model; after multiple experiments, the threshold is determined.

[0023] As a further improvement of the present invention, the method of using test set data to test model performance includes:

[0024] When evaluating the model, the values ​​of the evaluation indicators are calculated through the confusion matrix; in the confusion matrix, TP, FP, TN and FN are defined as follows: TP stands for true positive, which means that the model prediction result is preictal and the true label is also preictal; TN stands for true negative, which means that the model prediction result is interictal and the true label is also interictal; FP stands for false positive, which means that the model prediction result is preictal but the true label is interictal; FN stands for false negative, which means that the model prediction result is interictal but the true label is preictal; TP+FN is the total number of positive labels, which is the number of all preictal labels; TN and FP are the total number of negative labels, which is the number of all interictal labels.

[0025] As a further improvement of the present invention, the evaluation indicators for evaluating the model include accuracy, sensitivity, and specificity; wherein, accuracy refers to the probability of correct prediction among all prediction labels; sensitivity refers to the probability that the model predicts the result to be pre-ictal among all true pre-ictal labels, which is the positive accuracy; specificity refers to the probability that the model predicts the result to be inter-ictal among all true inter-ictal labels, which is the negative accuracy.

[0026] The second aspect of the present invention is to provide an epilepsy prediction system based on 2D-CNN and Cox-Stuart early stopping mechanism, based on the epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism; comprising:

[0027] An acquisition module, used to acquire EEG data;

[0028] The preprocessing module is used to preprocess the EEG data, including normalization and filtering;

[0029] The feature extraction and classification module is used to input the preprocessed signal into a pre-trained convolutional neural network epilepsy prediction model for feature extraction and classification, and predict the epileptic seizure state; the training process of the pre-trained convolutional neural network epilepsy prediction model includes:

[0030] Preprocessing of epileptic EEG data, including data normalization and filtering;

[0031] The preprocessed epileptic EEG data are divided into training set data and validation set data, and the training set data and validation set data are put into the CNN model for training and verification; the Cos-Stuart test method is used to determine whether there is an upward trend and early stop for the loss function of the validation set; the model parameters after training are saved, and the model performance is tested using the test set data to obtain the pre-trained convolutional neural network epilepsy prediction model.

[0032] The third aspect of the present invention is to provide an electronic device, characterized in that it includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism is implemented.

[0033] A fourth aspect of the present invention is to provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism.

[0034] Compared with the prior art, the present invention has the following beneficial effects:

[0035] The epilepsy prediction method and system based on 2D-CNN and Cox-Stuart early stopping mechanism proposed in the present invention are intended to achieve early prediction of epileptic seizures by optimizing the model training process and improving the prediction accuracy. The original electroencephalogram data are obtained from medical equipment. These data record the electrical activity of the brain and are the basis for epilepsy prediction. The preprocessing steps include normalization and noise filtering. Normalization is to adjust the amplitude of the electroencephalogram data to a specific range to ensure the stability and convergence of the model training. Noise filtering is to remove high-frequency or low-frequency noise in the data through filtering technology to improve signal quality. The preprocessed signal is directly used as the input of a two-dimensional convolutional neural network (2D-CNN). Instead of going through the traditional manual feature extraction step, the powerful automatic feature learning ability of CNN is used to automatically extract features related to epileptic seizures from the original time domain signal. The CNN model further processes and classifies the extracted features through structures such as convolutional layers, pooling layers, and fully connected layers, and finally outputs the prediction results of the epileptic seizure state (such as before the attack, during the attack, after the attack, or normal state). The CNN model is trained using the training set data and the validation set data. During the training process, the model parameters are continuously adjusted by the back propagation algorithm to minimize the loss function. In order to avoid overfitting, the Cox-Stuart test method (note that this may be a reference to the "Cox-Stuart trend test" or similar methods, because the Cox-Stuart test itself is not directly used for early stopping in machine learning, but a similar idea can be used to detect the rising trend of the validation set loss function) is used to monitor the validation set loss function. When a significant upward trend in the loss function is detected, it is considered that the model begins to overfit, and the early stopping mechanism is triggered at this time to stop the training process. Features are automatically extracted from the original data, reducing manual intervention. Directly using the time domain signal as input avoids a complex conversion process. By optimizing the training process and the early stopping mechanism, the prediction accuracy of the model is improved. The CNN model has a strong generalization ability and is suitable for EEG data of different sources and qualities. The present invention achieves efficient and accurate prediction of epileptic seizures by combining 2D-CNN and the Cox-Stuart early stopping mechanism.

[0036] Furthermore, the 2D-CNN model proposed in the present invention is aimed at non-independent patients. It only needs to normalize and filter the data before it can be input into the model for feature extraction and classification of the data. The Cox-Stuart test method is used to set an early stopping mechanism to effectively reduce the time complexity and computational complexity. Compared with the prior art, the model proposed in the present invention has a simple structure, low computational complexity and time complexity, and the sensitivity, specificity, and accuracy on the test set are all higher than 94%, with strong generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1For the classification of epileptic states of the present invention;

[0038] Figure 2 This is a schematic diagram of the independent data division of patients in the present invention;

[0039] Figure 3 This is a schematic diagram of data division based on overall patients in the present invention;

[0040] Figure 4 This is the basic structure diagram of CNN of the present invention;

[0041] Figure 5 The convolution operation process of the present invention;

[0042] Figure 6 It is the ReLU and LeakyReLU function diagram of the present invention;

[0043] Figure 7 It is a schematic diagram of the maximum pooling and average pooling working of the present invention;

[0044] Figure 8 The Cox-Stuart test flow chart of the present invention;

[0045] Fig. 9 It is the experimental flow chart of the present invention;

[0046] Fig.10 This is the original power spectrum density diagram of chb01_01 of the present invention;

[0047] Fig.11 This is the power spectrum density diagram after chb01_01 notch filtering of the present invention;

[0048] Fig.12 This is the power spectrum density diagram of chb01_01 after high-pass filtering of the present invention;

[0049] Fig.13 It is the 2D-CNN model structure of the present invention;

[0050] Fig.14 The training set and validation set result diagram of the first experiment of the present invention;

[0051] Fig.15 The training set and validation set result diagram of the second experiment of the present invention;

[0052] Fig.16 The training set and validation set result diagram of the third experiment of the present invention;

[0053] Fig.17 The training set and validation set result diagram of the fourth experiment of the present invention;

[0054] Fig.18This is the test set confusion matrix of the four experiments of the present invention (the four experiments are arranged in order from left to right);

[0055] Fig.19 This is the first training set and validation set result diagram after adding the Cox-Stuart test method in the present invention;

[0056] Fig. 20 This is a graph showing the results of the second training set and validation set after the Cox-Stuart test method is added to the present invention;

[0057] Fig.21 This is a graph showing the third training set and validation set results after the Cox-Stuart test method is added to the present invention;

[0058] Fig. 22 This is a graph showing the fourth training set and validation set results after the Cox-Stuart test method is added to the present invention;

[0059] Fig.23 This is the test set confusion matrix of the four experiments of the present invention (the four experiments are arranged in order from left to right);

[0060] Fig.24 The following is a comparison of the experimental results of the present invention. DETAILED DESCRIPTION

[0061] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0062] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that comprises a series of steps or elements is not necessarily limited to those steps or elements explicitly listed but may include other steps or elements not explicitly listed or inherent to such process, method, product, or apparatus.

[0063] Terminology explanation:

[0064] Two-Dimensional Convolutional Neural Network (2D-CNN), A two-dimensional convolutional neural network (2D-CNN) is a deep learning model specifically designed to process image data. It captures local features of an image, such as texture, shape, etc., by sliding a convolution kernel across the two-dimensional space (width and height) of the image. These features are then used to perform tasks such as image classification and object detection.

[0065] The Cox-Stuart test is a nonparametric statistical method used to determine whether there is a trend in time series data. It is based on the principle of sign test and determines the existence of a trend by comparing the data differences at adjacent time points (or two time points separated by a certain time point).

[0066] The present invention proposes an epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism, comprising:

[0067] Obtain EEG data;

[0068] Preprocess the EEG data, including normalization and filtering;

[0069] The preprocessed signal is input into a pre-trained convolutional neural network epilepsy prediction model for feature extraction and classification, and the epileptic seizure state is predicted; the training process of the pre-trained convolutional neural network epilepsy prediction model includes:

[0070] Preprocessing of epileptic EEG data, including data normalization and filtering;

[0071] The preprocessed epileptic EEG data are divided into training set data and validation set data, and the training set data and validation set data are put into the CNN model for training and verification; the Cos-Stuart test method is used to determine whether there is an upward trend and early stop for the loss function of the validation set; the model parameters after training are saved, and the model performance is tested using the test set data to obtain the pre-trained convolutional neural network epilepsy prediction model.

[0072] The principle analysis of the present invention is as follows:

[0073] The first step is to obtain EEG data, which is usually collected through EEG devices, which place multiple electrodes on the scalp to record the brain's electrical activity. The collected EEG signals contain rich neural information, which is of great significance for the diagnosis of neurological diseases such as epilepsy.

[0074] Second, EEG data preprocessing is a key step in EEG data analysis. Its purpose includes improving data quality, reducing noise and artifacts, and making data more suitable for subsequent analysis. The preprocessing process mainly includes two steps: normalization and filtering:

[0075] Since the amplitude of EEG signals can vary due to a variety of factors, the signals need to be normalized to ensure that all signals are in a similar range. Normalization helps machine learning models learn and generalize better.

[0076] EEG signals often contain various noises and artifacts, such as electromagnetic interference from electronic devices, muscle activity, etc. Filtering technology can remove these unnecessary components and improve the signal-to-noise ratio.

[0077] Third, the convolutional neural network epilepsy prediction model is the main research content of the present invention, which is mainly based on the prediction model of convolutional neural network (CNN). Convolutional neural network is a deep learning model, which is particularly suitable for processing data with grid structure, such as images and videos. In epilepsy prediction, CNN realizes the prediction of epileptic seizures by automatically extracting and classifying preprocessed EEG signals.

[0078] CNN automatically extracts useful features from EEG signals through structures such as convolutional layers and pooling layers. These features can characterize signal changes before an epileptic seizure. The extracted features are passed to the fully connected layer, which uses these features to classify and predict epileptic seizures.

[0079] Therefore, the method of the present invention can automatically extract features: CNN can automatically extract useful features from raw data, avoiding the tediousness and subjectivity of manually designing features in traditional methods. Through convolution and pooling operations, CNN can efficiently process large-scale data and improve prediction speed. The fully trained CNN model has good generalization ability and can accurately predict unknown data. Combined with real-time EEG acquisition technology, the CNN model can realize real-time prediction of epilepsy and provide strong support for clinical diagnosis and treatment.

[0080] Fourth, the model training process is as follows:

[0081] 1) Normalize and filter the epileptic EEG data.

[0082] 2) Divide the preprocessed data into training set, validation set and test set.

[0083] 3) Use the training set data to train the CNN model and verify it with the validation set data. During the verification process, the Cos-Stuart test method is used to monitor the change trend of the loss function to determine whether overfitting or underfitting occurs, and adjust the model parameters accordingly.

[0084] 4) Save the model parameters after training and use the test set data to test the model performance. Evaluate the accuracy and generalization ability of the model based on the test results.

[0085] By acquiring high-quality EEG data, performing effective preprocessing, and building an efficient convolutional neural network model, accurate prediction of epileptic seizures can be achieved, providing strong support for the diagnosis and treatment of epilepsy patients.

[0086] Furthermore, the epileptic EEG data includes waveform signals of the brain during the epileptic period and the non-epileptic period, and the start and end time of the epileptic seizure has been marked; the epileptic seizure state period is divided according to the start and end time of the epileptic seizure; the epileptic EEG data is based on data from non-independent patients.

[0087] Epilepsy EEG data usually includes waveform signals of the brain during epilepsy and non-epileptic periods. These data are collected by placing multiple electrodes on the patient's scalp through an electroencephalogram (EEG) device, which can reflect the electrical activity of the brain in different states. The start and end time of the epileptic seizure has been clearly marked in the data, which is crucial for subsequent data processing and analysis.

[0088] According to the start and end time of epileptic seizures, epileptic EEG data can be divided into epileptic seizure state period and non-seizure state period. This division helps researchers or doctors to more accurately identify the characteristics of epileptic seizures and analyze the changes in brain electrical activity before and after epileptic seizures. At the same time, it also provides an important time window for subsequent model training and prediction.

[0089] The epilepsy EEG data is based on data from non-independent patients, which means that the data may come from multiple patients, each with their own unique epilepsy history and clinical manifestations. This diversity of data helps to train a more robust and generalized epilepsy prediction model. However, it is also necessary to pay attention to the problems that non-independent patient data may bring, such as differences between data, noise and artifacts, etc. These problems need to be effectively solved in the data preprocessing stage.

[0090] As an example, the present invention can identify specific waveforms (such as spikes, sharp waves, etc.) during epileptic seizures and background activities during non-epileptic seizures by analyzing the waveform signals of the brain during epileptic and non-epileptic periods. These waveform features are of great significance for the diagnosis and prediction of epilepsy. By dividing the time window according to the start and end time of the epileptic seizure, the changes in EEG activity before and after the epileptic seizure can be studied more accurately. This division of time windows helps to capture the instantaneous characteristics and dynamic processes of epileptic seizures. Based on the data of non-independent patients, the EEG data of multiple patients can be fused and analyzed. This fusion analysis helps to discover the commonalities and differences of epileptic seizures between different patients, and provides an important basis for the precision medicine of epilepsy.

[0091] Therefore, by comprehensively analyzing the epilepsy EEG data of multiple patients, a more accurate and robust epilepsy prediction model can be trained. This model can better identify the characteristics and patterns of epileptic seizures and improve the accuracy of prediction. The model trained based on data from non-independent patients has stronger generalization ability.

[0092] Optionally, the Cox-Stuart test is used to determine whether the validation set loss function has an upward trend so as to stop the training early; when p Cox-Stuart When the value is ≤0.05, and the positive number pairs are greater than the negative number pairs, it means that the loss function has an upward trend. The learning rate is reduced to 0.1 times of the original value. When the number of upward trends reaches the set threshold, the model is no longer trained. When p Cox-Stuart When the value is ≤0.05, and the positive pair is smaller than the negative pair, it means that the loss function has a downward trend, and training continues. If the above two conditions are not met, continue to train the model; after multiple experiments, the threshold is determined.

[0093] As an example, the method of testing the model performance using the test set data includes:

[0094] When evaluating the model, the values ​​of the evaluation indexes are calculated through the confusion matrix; in the confusion matrix, the definitions of TP, FP, TN and FN are as follows: TP stands for true positive, which means that the model prediction result is preictal and the true label is also preictal; TN stands for true negative, which means that the model prediction result is interictal and the true label is also interictal; FP stands for false positive, which means that the model prediction result is preictal but the true label is interictal; FN stands for false negative, which means that the model prediction result is interictal but the true label is preictal; TP+FN is the total number of positive labels, which is the number of all preictal labels; TN and FP are the total number of negative labels, which is the number of all interictal labels;

[0095] The evaluation indicators for evaluating the model include accuracy, sensitivity, and specificity; among them, accuracy refers to the probability of correct prediction among all predicted labels; sensitivity refers to the probability that the model predicts the result to be pre-ictal among all true pre-ictal labels, which is the positive accuracy; specificity refers to the probability that the model predicts the result to be inter-ictal among all true inter-ictal labels, which is the negative accuracy.

[0096] During the training process of the epilepsy prediction model, the Cox-Stuart test is used to monitor the trend of the validation set loss function to decide whether to stop early or adjust the learning rate. The Cox-Stuart test is used to determine the trend of the validation set loss function, that is, whether there is a significant upward or downward trend. This helps to promptly detect signs of overfitting or underfitting during model training so that appropriate measures can be taken. The Cox-Stuart test is a non-parametric statistical method based on a sign test. It does not depend on the specific distribution form of the data, but judges the trend by analyzing the distribution of positive and negative differences in the data. In the application of the validation set loss function, the loss values ​​in two or more consecutive iterations can be paired and the difference between them can be calculated. Then, the number of positive and negative numbers in these differences is counted, and the binomial distribution test is used to determine whether these differences have significant bias (i.e., an upward or downward trend).

[0097] After the model training is completed, the test set data is used to evaluate the model performance. The main evaluation indicators include accuracy, sensitivity and specificity. These indicators are calculated through the confusion matrix. TP, FP, TN and FN in the confusion matrix represent true positive, false positive, true negative and false negative, respectively. The Cox-Stuart test plays an important monitoring role in the training process of the epilepsy prediction model, which helps to timely discover and adjust the learning status of the model, thereby improving the prediction performance of the model.

[0098] The content of the present invention is described in detail below in conjunction with specific embodiments:

[0099] 1. Convolutional Neural Network and Cox-Stuart Test

[0100] 1.1 Introduction to CHB-MIT Scalp EEG Dataset

[0101] The present invention uses the scalp EEG dataset for intractable epilepsy (CHB-MIT) collected by Boston Children's Hospital. The dataset contains 23 subjects, and case 1 and case 21 are from the same patient, so there are 24 folders in total. The dataset is collected by the 10-20 international standard lead system with a sampling rate of 256Hz. .edf is a file format specifically used to record EEG signals. Each subject has 9 to 42 continuous .edf files, which record the waveform signals of the brain during the epileptic and non-epileptic periods, and the start and end times of the epileptic seizures have been marked by experts.

[0102] 1.2 Data selection method

[0103] 1.2.1 Channel Selection

[0104] When collecting EEG data from patients, the number of EEG channels and electrode names in the .edf files of some patients were slightly different, and there were repeated electrode names. In order to ensure good prediction results, it was finally decided to use 22 EEG channels that most subjects have: FP1-F7, F7-T7, T7-P7, P7-O1, FP1-F3, F3-C3, C3-P3, P3-O1, FP2-F4, F4-C4, C4-P4, P4-O2, FP2-F8, F8-T8, T8-P8-0, P8-O2, FZ-CZ, CZ-PZ, P7-T7, T7-FT9, FT9-FT10, FT10-T8, T8-P8-0 and T8-P8-1 are repeated channels, and T8-P8-1 is deleted. Since the start and end time of each .edf file is not marked in the 24th folder, it is impossible to divide the pre-ictal and interictal periods of the data and it is not considered. Therefore, a total of 23 folders of data were screened out, namely: chb01, chb02, chb03, chb04, chb05, chb06, chb07, chb08, chb09, chb10, chb11, chb12, chb13, chb14, chb15, chb16, chb17, chb18, chb19, chb20, chb21, chb22, chb23. The following table captures the number of EEG channels and electrode names of some .edf files. chb is the prefix name of all .edf files, chb01 refers to the first patient, chb01_01 refers to the first .edf file of the first patient, and so on.

[0105] Table 1 Channel numbers and electrode names of some patients

[0106]

[0107]

[0108] 1.2.2 Methods for classifying epileptic seizure states

[0109] Since the public data set CHB-MIT only marks the start and end time of the epileptic seizure, it is necessary to manually define the interictal and preictal data segments. According to the start and end time of the epileptic seizure, the present invention defines the preictal period as 15 minutes before the epileptic seizure to 5 minutes before the epileptic seizure, the postictal period as 30 minutes after the end of the epileptic seizure, and the interictal period as 2 hours after the current epileptic seizure to 2 hours before the next epileptic seizure. Due to the uneven distribution of EEG data in the preictal and interictal periods, a class of data with a small amount of data for a certain patient is overlapped by 10 seconds. Figure 1 This is a schematic diagram of an epileptic seizure.

[0110] 1.2.3 Experimental Dataset Division

[0111] Currently, there are two ways to divide epilepsy EEG data: patient-independent data and non-patient-independent data. The details are as follows.

[0112] 1. Patient-independent data partitioning

[0113] Patient independence means dividing the data of each patient into training set, validation set and test set. Then put the corresponding data set into the model for training, validation and testing. This method has better evaluation results than non-patient independent data sets. However, this method requires recording the patient's data in advance. Only when the patient has enough data at different attack periods can the model of the patient be trained to detect or predict the patient's attack period. The diagram of patient independent data division is shown in the figure below. Figure 2 Patient n indicates the nth patient.

[0114] 2. Non-patient independent data partitioning

[0115] Non-patient independence means integrating the data of all patients and then dividing the data set into training set, validation set, and test set. This method only needs to use the data set to train the model in advance, and then it can classify the data of subjects that have never been seen before, which is more suitable for clinical practice. However, this data division method has high requirements for the model. Only when the model has strong generalization ability can a better classification result be obtained.

[0116] This experiment uses a non-patient-independent data partitioning method. A total of 25,436 data, 20% of the data are randomly selected as the test set, and the test set data and the remaining data are saved separately in a fixed folder. Each time the code is run, 20% of the remaining data is randomly selected as the validation set data, and the rest is used as the training set. The division ratio of all data is: 6:2:2. Figure 3 shown.

[0117] 1.3 Convolutional Neural Network (CNN)

[0118] The basic structure of convolutional neural network (CNN) is: input layer, convolution layer, activation layer, pooling layer, fully connected layer, output layer, such as Figure 4 shown.

[0119] Among them, the convolution layer is the most important. The convolution layer can filter the input data through the convolution kernel to obtain the output data, thereby achieving the purpose of extracting high-dimensional features of the signal. Figure 5 It is the convolution operation process.

[0120] The activation layer mostly uses functions such as sigmoid, ReLU, and LeakyReLU to perform nonlinear transformation on the data, inject nonlinear neurons into the neural network, and thus improve the fitting ability of the neural network. The sigmoid function is prone to the problem of gradient disappearance, while the ReLU function solves the gradient disappearance problem and converges quickly. However, when x<0, some neurons may never be activated during training, resulting in "dead neurons". LeakyReLU adds a correction factor when x<0, so that the output of the negative part is no longer 0, solving this shortcoming of the ReLU function. Formulas (1) and (2) are the ReLU function and the LeakyReLU function. Figure 6 The function graphs of both.

[0121]

[0122]

[0123] The pooling layer can compress the feature space and reduce the computational complexity. The most commonly used pooling methods include maximum pooling, average pooling, and adaptive average pooling.

[0124] Max pooling finds the maximum value in the selected area of ​​the input feature map as the value of the pooling layer; average pooling calculates the average value of all values ​​in the selected area of ​​the input feature map as the value of the pooling layer; adaptive average pooling does not consider the size of the input feature map, and adaptively performs average pooling on the input feature map according to the required output shape size. The working diagram of max pooling and average pooling is shown below. Figure 7 shown.

[0125] 1.4 Cox-Stuart test

[0126] The Cox-Stuart test method uses positive and negative signs to determine whether a series has a certain trend. This method is applicable to various types of data and does not depend on the distribution of the data. It only determines whether there is an upward or downward trend based on the sign test. The calculation method is as follows. Figure 8 Flow chart of the Cox-Stuart test.

[0127] 1. Hypothesis: H0: The sequence has no trend; H1: The sequence has a trend;

[0128] 2. Input array {x1,x2,...,x n} and calculate c, the array length is n;

[0129]

[0130] 3. Calculate the value of group c: {d1 = x c -x0,d2=x c+1 -x1,...,d c =x n -x c-1}, statistics d i The number of positive and negative symbols num + 、num - , let k = min(num + ,num - );

[0131] 4. Calculate the probability p using the cumulative probability function of the binomial distribution Cox-Stuart , p is the probability of a positive sign or a negative sign appearing once;

[0132]

[0133] 5. If num + >num - If p≤0.05, the function value is considered to have an upward trend. + <num - If p≤0.05, the function value is considered to have a downward trend, otherwise, it is considered to have no obvious trend.

[0134] 2. Convolutional Neural Network (CNN) Epilepsy Prediction Model

[0135] This experiment first preprocesses the original data, including data normalization and filtering; the preprocessed training set data and validation set data are put into the designed CNN model for training and verification; the Cos-Stuart test is performed on the loss function of the validation set to determine whether there is an upward trend and stop early; the model parameters after training are saved, and the test set data is used to test the model performance to obtain the sensitivity, specificity, and accuracy of the test set; the experiment ends. Fig. 9 The experimental flow chart is shown in Figure 2.

[0136] 2.1 Preprocessing

[0137] The EEG signals in different attack states may have large or small differences in amplitude, and the signal amplitudes of different EEG channels may also be different. In order to better distinguish the interictal period and the preictal period, it is very necessary to normalize the original data. In the present invention, let max = 1, min = 0, and the formula is shown in (3):

[0138] X_std=(XX min ) / (X max -X min )

[0139] X_scaled=X_std*(max-min)+min (3)

[0140] The electromagnetic interference in the environment and the thermal noise of the device itself will cause great noise interference to the weak EEG signal. For the power frequency interference noise, a 50Hz or 60Hz notch filter is generally used for processing. The present invention uses a notch filter to filter out the 60Hz power frequency noise and a high-pass filter to filter out noise less than 1Hz. Fig.10 , Fig.11 , Fig.12 They are the original power spectral density diagram of the chb01_01 file, the power spectral density diagram after notch filtering, and the power spectral density diagram after high-pass filtering.

[0141] 2.2CNN-CoxStuart Model

[0142] After preprocessing the data, it is directly put into the designed network for feature extraction and classification. The present invention uses three 2D convolutional layers, two batch normalization layers, two maximum pooling layers, and two activation functions to design a 2D-CNN model with low time complexity, low computational complexity, and strong generalization ability. The model structure is as follows Fig.13 Table 2 shows the specific parameters of the model structure. Table 3 shows the hyperparameters of the model.

[0143] Table 2 Model structure parameters

[0144]

[0145] Table 3 Model training hyperparameters

[0146]

[0147] 2.3 Model early stopping method based on Cox-Stuart test method

[0148] When training the model, since the training set and validation set are different each time, the parameter initialization data is also different, so it is difficult to determine the number of training times. The Cox-Stuart test is used to determine whether the trend of the sequence is decreasing or increasing, and does not require a clear distribution of the data. It assumes few conditions, so the Cox-Stuart test can be used to determine whether the validation set loss function has an increasing trend so that the training can be stopped early. When p Cox-Stuart When the value is ≤0.05, and the positive number pairs are greater than the negative number pairs, it means that the loss function has an upward trend. At this time, the learning rate is reduced to 0.1 times the original value. When the number of upward trends reaches the set threshold, the model is no longer trained. When p Cox-Stuart When the value is ≤0.05, and the positive pair is smaller than the negative pair, it means that the loss function has a downward trend, and the training continues. If the above two conditions are not met, the model training continues. After many experiments, the threshold value is determined to be 10.

[0149] 3. Experimental results

[0150] 3.1 Evaluation indicators

[0151] When evaluating the model, the confusion matrix is ​​indispensable. The confusion matrix can be used to calculate the values ​​of evaluation indicators such as accuracy, specificity, and sensitivity. The confusion matrix is ​​shown in Table 4. Among them, the definitions of TP, FP, TN, and FN are as follows: TP stands for true positive, which means that the model prediction result is preictal and the true label is also preictal; TN stands for true negative, which means that the model prediction result is interictal and the true label is also interictal; FP stands for false positive, which means that the model prediction result is preictal but the true label is interictal. FN stands for false negative, which means that the model prediction result is interictal but the true label is preictal. According to the definition of the confusion matrix, TP+FN is the total number of positive labels, that is, the number of all preictal labels; TN and FP are the total number of negative labels, that is, the number of all interictal labels.

[0152] Table 4 Confusion matrix diagram

[0153]

[0154] The evaluation indexes used in the present invention include accuracy, sensitivity and specificity, and the formulas are (4) to (6) respectively.

[0155] Among them, accuracy refers to the probability of correct prediction among all predicted labels; sensitivity refers to the probability that the model prediction result is also pre-ictal among all real pre-ictal labels, that is, the positive accuracy; specificity refers to the probability that the model prediction result is also inter-ictal among all real inter-ictal labels, that is, the negative accuracy.

[0156]

[0157]

[0158]

[0159] 3.2 Performance Evaluation

[0160] Without using the Cox-Stuart test, the training epoch was set to 150 and a total of 4 experiments were performed. The results of the training set and the validation set are shown in Figure 14 to Figure 17 shown.

[0161] Depend on Fig.14 It can be seen that after 40 training epochs, the loss function has an upward trend; after 120 epochs, the accuracy, sensitivity, and specificity tend to be stable and are all greater than 95%.

[0162] Depend on Fig.15 It can be seen that after epoch 40, the loss function has an upward trend; after epoch 100, the accuracy tends to be stable and greater than 95%; after epoch 60, the sensitivity and specificity tend to be stable, with sensitivity greater than 90% and specificity greater than 95%.

[0163] Depend on Fig.16 It can be seen that after epoch 50, the loss function has an upward trend, the accuracy tends to be stable and greater than 95%; after epoch 100, the sensitivity tends to be stable and greater than 95%; after epoch 120, the specificity tends to be stable and greater than 95%.

[0164] Depend on Fig.17 It can be seen that after epoch 40, the loss function has an upward trend; after epoch 100, the accuracy and sensitivity tend to be stable and greater than 95%; after epoch 60, the specificity tends to be stable and greater than 90%.

[0165] Depend on Figure 14 to Figure 17 It can be seen that the loss function has an upward trend when epoch>40, and a very obvious upward trend when epoch>60. The accuracy, sensitivity, and specificity of the four experiments are all greater than 90%.

[0166] Use the test set to evaluate the performance of the model, and the resulting confusion matrix is ​​as follows Fig.18 Table 5 shows the results of 4 experiments and their average values.

[0167] Table 5 Experimental results

[0168]

[0169] The Cox-Stuart test method is used to determine whether the validation loss function has an upward trend and stop early, while other factors remain unchanged. The results of training and validating the model using the training set and validation set are as follows: Figure 19 to Figure 22 shown.

[0170] Depend on Fig.19 It can be seen that after epoch 60, the loss function has an upward trend; after epoch 40, the accuracy tends to be stable and greater than 95%; after epoch 60, the sensitivity tends to be stable and greater than 90%; after epoch 30, the specificity tends to be stable and greater than 95%.

[0171] Depend on Fig. 20 It can be seen that after epoch 80, the loss function, accuracy, and sensitivity tend to be stable, and the accuracy is greater than 90% and the sensitivity is greater than 95%; after epoch 30, the specificity tends to be stable and greater than 95%.

[0172] Depend on Fig.21 It can be seen that after epoch 60, the loss function has an upward trend, and the accuracy and sensitivity have a downward trend; the accuracy is greater than 90%, the sensitivity is greater than 85%, and the specificity is greater than 95%.

[0173] Depend on Fig. 22 It can be seen that after epoch 70, the loss function has a slight upward trend; after epoch 50, the accuracy and sensitivity tend to be stable and both are greater than 90%; when the accuracy is greater than 90%, after epoch 40, the specificity tends to be stable and greater than 90%.

[0174] Through comparative analysis Figure 19 to Figure 22 It was found that the epochs were all within 90, and the accuracy, sensitivity, and specificity of the training set and validation set were all above 90%.

[0175] Use the test set to evaluate the performance of the model. The confusion matrix of the classification results is as follows Fig.23 Table 6 shows the results of 4 experiments and their average values.

[0176] Table 6 Experimental results

[0177]

[0178] The experiment shows that the experimental results after adding the Cox-Stuart early stopping mechanism are very similar to those without the Cox-Stuart early stopping mechanism. This shows that adding the Cox-Stuart early stopping mechanism is feasible. The Cox-Stuart early stopping mechanism stops training in time when the loss function of the validation set shows an upward trend, which greatly reduces the computational complexity and time complexity of the model. Table 7 compares the experimental results of the two.

[0179] Table 7 Comparison of test set experimental results without and with the Cox-Stuart early stopping mechanism

[0180]

[0181] 3.3 Comparative Experiment

[0182] Since there are few existing technologies for epilepsy prediction that use non-patient-independent methods to divide data, there are only two comparative experiments in this experiment. In order to highlight the performance of the model, the present invention also conducted experiments with a pre-ictal period of 30 minutes and a pre-ictal period of 60 minutes. The experimental results are shown in Table 8 and Fig.24 As shown. It can be seen that when the pre-ictal period is set to 10 minutes, the results of this experiment are better than the prior art. When the pre-ictal period is set to 60 minutes, the sensitivity of this experiment is better than that of prior art 2. However, the accuracy and specificity are lower than those of prior art 2. When the pre-ictal period is set to 30 minutes, the results of this experiment are better than those of prior art 1, the sensitivity and accuracy are better than those of prior art 2, and the specificity differs from that of prior art 2 by 0.0056. When the pre-ictal period is set to 10 minutes, the experimental results of the present invention are better than those of prior art 1 and prior art 2. Prior art 1 converts the time domain signal of EEG into a time-frequency domain signal, and prior art 2 converts EEG data into a picture form for three-dimensional convolution processing, and its time complexity and computational complexity are higher than those of this experiment. Therefore, the model proposed in the present invention has advantages.

[0183] Table 8 Comparison of experimental results based on overall patients

[0184]

[0185] Among them, the prior art 1 is Elagamy M N. An Efficient Hybrid Model for Patient-Independent Seizure Prediction Using Deep Learning [J]. Applied Sciences, 2022, 12. DOI: 10.3390 / app12115516.

[0186] Prior art 2 is Wei X, Zhou L, Chen Z, et al. Automatic seizure detection using three-dimensional CNN based on multi-channel EEG [J]. BMC Medical Informatics and Decision Making, 2018, 18 (S5). DOI: 10.1186 / s12911-018-0693-8.

[0187] The 2D-CNN model proposed in the present invention is for non-independent patients. The data only needs to be normalized and filtered before it can be input into the model for feature extraction and classification; secondly, the early stopping mechanism is set using the Cox-Stuart test method to effectively reduce time complexity and computational complexity. Compared with other existing technologies, the model proposed in the present invention has a simple structure, low computational complexity and time complexity, and its sensitivity, specificity, and accuracy on the test set are all higher than 94%, with strong generalization ability.

[0188] The present invention also provides an epilepsy prediction system based on 2D-CNN and Cox-Stuart early stopping mechanism, comprising:

[0189] An acquisition module, used to acquire EEG data;

[0190] The preprocessing module is used to preprocess the EEG data, including normalization and filtering;

[0191] The feature extraction and classification module is used to input the preprocessed signal into a pre-trained convolutional neural network epilepsy prediction model for feature extraction and classification, and predict the epileptic seizure state; the training process of the pre-trained convolutional neural network epilepsy prediction model includes:

[0192] Preprocessing of epileptic EEG data, including data normalization and filtering;

[0193] The preprocessed epileptic EEG data are divided into training set data and validation set data, and the training set data and validation set data are put into the CNN model for training and verification; the Cos-Stuart test method is used to determine whether there is an upward trend and early stop for the loss function of the validation set; the model parameters after training are saved, and the model performance is tested using the test set data to obtain the pre-trained convolutional neural network epilepsy prediction model.

[0194] The present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism is implemented.

[0195] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism is implemented.

[0196] In summary, the present invention aims at the problem of how to effectively predict whether an epileptic patient is about to develop an attack, and proposes an epilepsy prediction model method based on a two-dimensional convolutional neural network (2D-CNN) of non-independent patients and the Cox-Stuart test method. First, the EEG data is normalized, and the noise of the EEG signal is filtered out using a notch filter and a high-pass filter; the filtered signal is input into the 2D-CNN model for feature extraction and classification, and the Cox-Stuart test method is used to detect whether early stopping is required, thereby reducing the computational complexity and time complexity of the model. The test set accuracy of the model is 0.963, the specificity is 0.9764, and the sensitivity is 0.9497, indicating that the model has good performance.

[0197] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0198] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0199] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0200] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0201] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. An epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism, characterized in that: include: Obtain EEG data; Preprocess the EEG data, including normalization and filtering; The preprocessed signal is input into a pre-trained convolutional neural network epilepsy prediction model for feature extraction and classification, and the epileptic seizure state is predicted; The training process of the pre-trained convolutional neural network epilepsy prediction model includes: Preprocessing of epileptic EEG data, including data normalization and filtering; The preprocessed epileptic EEG data are divided into training set data and validation set data, and the training set data and validation set data are put into the CNN model for training and verification; the Cos-Stuart test method is used to determine whether there is an upward trend and early stop for the loss function of the validation set; the model parameters after training are saved, and the model performance is tested using the test set data to obtain the pre-trained convolutional neural network epilepsy prediction model.

2. The epilepsy prediction method according to claim 1, characterized in that: The epileptic EEG data includes the waveform signals of the brain during the epileptic period and the non-epileptic period, and the start and end time of the epileptic attack have been marked; according to the start and end time of the epileptic attack, the epileptic attack state period is divided; The epileptic EEG data are based on data from non-independent patients.

3. The epilepsy prediction method according to claim 1, characterized in that: Preprocessing of epileptic EEG data includes normalization and filtering, specifically including: Normalize and set max=1,min=0, we have: X_std = (X-Xmin) / (Xmax-Xmin) X_scaled=X_std*(max-min)+min Among them, X is the original sequence, X max and X min are the maximum and minimum values ​​of the sequence, respectively. X_std is the standardized sequence. max and min are the upper and lower limits of the target scaling range, respectively. X_scaled is the normalized sequence. The filtering uses a notch filter to filter out 60Hz power frequency noise, and a high-pass filter to filter out noise less than 1Hz.

4. The epilepsy prediction method according to claim 1, characterized in that: The CNN model is a 2D-CNN model using 3 2-dimensional convolutional layers, 2 batch normalization layers, 2 maximum pooling layers, and 2 activation functions.

5. The epilepsy prediction method according to claim 1, characterized in that: The Cox-Stuart test method is used to determine whether the validation set loss function has an upward trend so that the training is stopped early; when p Cox-Stuart When the value is ≤0.05, and the positive number pairs are greater than the negative number pairs, it means that the loss function has an upward trend. The learning rate is reduced to 0.1 times of the original value. When the number of upward trends reaches the set threshold, the model is no longer trained. When p Cox-Stuart When the value is ≤0.05, and the positive number pair is smaller than the negative number pair, it means that the loss function has a downward trend, and the training continues. If the above two conditions are not met, the model continues to be trained; After many experiments, the threshold is determined.

6. The epilepsy prediction method according to claim 1, characterized in that: The use of test set data to test model performance includes: When evaluating the model, the values ​​of the evaluation indicators are calculated through the confusion matrix; in the confusion matrix, TP, FP, TN and FN are defined as follows: TP stands for true positive, which means that the model prediction result is preictal and the true label is also preictal; TN stands for true negative, which means that the model prediction result is interictal and the true label is also interictal; FP stands for false positive, which means that the model prediction result is preictal but the true label is interictal; FN stands for false negative, which means that the model prediction result is interictal but the true label is preictal; TP+FN is the total number of positive labels, which is the number of all preictal labels; TN and FP are the total number of negative labels, which is the number of all interictal labels.

7. The epilepsy prediction method according to claim 1, characterized in that: The evaluation indicators for evaluating the model include accuracy, sensitivity, and specificity; among them, accuracy refers to the probability of correct prediction among all predicted labels; sensitivity refers to the probability that the model predicts the result to be pre-ictal among all true pre-ictal labels, which is the positive accuracy; specificity refers to the probability that the model predicts the result to be inter-ictal among all true inter-ictal labels, which is the negative accuracy.

8. An epilepsy prediction system based on 2D-CNN and Cox-Stuart early stopping mechanism, characterized in that: include: An acquisition module, used to acquire EEG data; The preprocessing module is used to preprocess the EEG data, including normalization and filtering; A feature extraction and classification module is used to input the preprocessed signal into a pre-trained convolutional neural network epilepsy prediction model for feature extraction and classification, and predict the epileptic seizure state; The training process of the pre-trained convolutional neural network epilepsy prediction model includes: Preprocessing of epileptic EEG data, including data normalization and filtering; The preprocessed epileptic EEG data are divided into training set data and validation set data, and the training set data and validation set data are put into the CNN model for training and verification; the Cos-Stuart test method is used to determine whether there is an upward trend and early stop for the loss function of the validation set; the model parameters after training are saved, and the model performance is tested using the test set data to obtain the pre-trained convolutional neural network epilepsy prediction model.

9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism as claimed in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the epilepsy prediction method based on 2D-CNN and Cox-Stuart early stopping mechanism according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Cross-patient epileptic seizure prediction method and system based on joint domain adaptation and medium

    CN120678385A