A method for epileptic seizure prediction based on a lightweight deep statistical model
By adopting lightweight deep statistical model and hybrid data augmentation technology in epilepsy prediction, combining convolutional neural network and dual-stream semi-expanded fusion module, the problems of model instability and low prediction accuracy in the existing technology are solved, and high-precision epilepsy prediction across patients are achieved.
Patent Information
- Application Number
- CN202510007029.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-01-03
AI Technical Summary
The prior art has problems such as nonstationarity, low responsiveness and long-sequence signals in epilepsy prediction, which lead to instability of the model, high computational complexity and low prediction accuracy.
The epilepsy prediction method based on lightweight deep statistical model is adopted. By constructing a hybrid data augmentation model, a deep statistical model and a fully supervised network, data augmentation, feature extraction and model training are carried out, and a convolutional neural network and a dual-stream semi-expanded fusion module are combined to achieve high-precision prediction of epilepsy.
It successfully breaks through the dependence of traditional epilepsy prediction models on individualized data, realizes high-precision epilepsy prediction across patients, improves the accuracy and robustness of the model, and overcomes bottlenecks such as poor prediction accuracy and long time caused by insufficient samples.
Smart Images

Figure CN119400431B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of medical data processing and is an epileptic seizure prediction method based on a lightweight deep statistical model. Background Art
[0002] Epilepsy is a neurological disease. Common epilepsy diagnosis requires electroencephalogram (EEG) examination, brain imaging (such as MRI or CT scan), and blood and urine tests. EEG medical signal data is a non-invasive examination method for detecting and recording brain electrical activity, which is often used in the diagnosis and evaluation of epilepsy. Due to the complex EEG signal changes before an epileptic seizure, its mechanism and prediction pattern may vary greatly among different patients. The precursor signals and patterns of epileptic seizures may be different for each person, which increases the difficulty of prediction. In addition, epilepsy prediction requires a large amount of EEG data, and this data needs to be accurately labeled. Too little data accumulation results in insufficient information for the prediction model to learn and generalize, resulting in a decrease in the performance of the model.
[0003] The Chinese patent publication number is "CN117752308A", and the name is "Epilepsy prediction method and device". This method first obtains the EEG sequence data to be tested; predicts the EEG data based on the dual-channel fusion model to obtain the epilepsy prediction result; wherein, the two channel branches of the dual-channel fusion model are constructed by the encoding network and the convolutional neural network respectively, and the encoding network is constructed based on the self-attention mechanism; the dual-channel fusion model is trained with sample EEG data as training samples and fusion features as training features; the fusion features are determined based on the global features output by the encoding network and the local features output by the convolutional neural network. The epilepsy seizure prediction method implemented by this method is limited by the amount of large-scale EEG column data, as well as the defects of the non-stationarity of the existing public EEG data set itself and the insufficient representation of long sequence information, resulting in problems such as high computational complexity, underfitting and low real-time prediction accuracy in the training model stage. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] In view of the shortcomings of the prior art, the present invention provides an epileptic seizure prediction method based on a lightweight deep statistical model, which solves the problem of model instability caused by non-stationarity, low responsiveness and long sequence signals in the original EEG signal data. It also solves the problems of complex computational efficiency and low prediction accuracy of traditional epileptic seizure prediction methods.
[0006] (II) Technical solution
[0007] In order to achieve the above-mentioned purpose, the present invention specifically adopts the following technical solutions:
[0008] A method for predicting epileptic seizures based on a lightweight deep statistical model, the method specifically comprising the following steps:
[0009] S1, prepare the data set: prepare the CHB-MIT data set. The first 70% of the CHB-MIT data set is used for label generation and network training; the last 30% of the CHB-MIT data set is used for the final model testing;
[0010] S2, constructing a hybrid data enhancement model: the hybrid data enhancement model includes a data segmentation module, a data removal module, a random channel replacement module and a signal denoising module; the CHB-MIT dataset in step S1 is input into the hybrid data enhancement model to obtain an enhanced EEG dataset library;
[0011] S3, building a deep statistical model: The deep statistical model includes the design of the statistical model and the construction of the neural network; the enhanced EEG data obtained in step S2 is input into the statistical model for labeling and network training;
[0012] S4, fully supervised network training: The fully supervised training process includes loss function design and adaptation, training strategy design and evaluation index design; select a suitable loss function kernel and design the prediction loss; the loss function kernel is the mean square error; design evaluation indicators to evaluate the performance of the prediction model, including designing response success rate indicators, adaptation sensitivity and specificity indicators;
[0013] S5, model testing and fine-tuning: training the epilepsy prediction model to obtain a pre-trained model, inputting a data set of one third of the data prepared in step S1 into the pre-trained model for testing, and using the data set of another one third of the data to fine-tune the model according to the evaluation index value of the test, optimizing the model parameters, and improving the performance of epilepsy prediction;
[0014] S6, model solidification and saving: After the fine-tuning in step S5 is completed, the fine-tuned network parameters are solidified and the final epilepsy prediction model is saved; the model is tested again using the remaining one-third of the data set in step S1, and the EEG sequence can be directly input into the trained end-to-end model to obtain the epilepsy attack prediction score.
[0015] Furthermore, the hybrid data augmentation model was decoupled into a data segmentation module, a data removal module, a random channel permutation module and a signal denoising module to solve the problems of data scarcity, noise interference, variability and insufficient samples; to improve the accuracy of deep learning models in epilepsy prediction and overcome bottlenecks such as poor prediction accuracy and long prediction time due to insufficient samples.
[0016] The data segmentation module is used to segment the EEG segment into smaller non-overlapping segments, each segment is 30 seconds long, and the maximum frame length is preferred to achieve higher performance;
[0017] The data rejection module is used to determine completely or partially damaged EEG segments when there is "data dropout" in the EEG segments, when the EEG signal values of all channels under a given time sample are zero, and the damaged EEG segments have more than 20% missing values, and exclude them from the training and test sets;
[0018] The random channel replacement module is used to randomly replace and increase or decrease all channels of the signal after data elimination processing; a random number generator is used to randomly disrupt the order of the 23 channels, merge the channel data, and then splice the enhanced short sequence samples into a complete EEG signal in chronological order;
[0019] The signal denoising module is used to denoise the randomly permuted signal and output an EEG signal.
[0020] Furthermore, the statistical model design includes Fourier transform of EEG signals, calculation of energy spectrum, setting two constraints and generating dynamic label sets, which transforms the original EEG signal data into a data set with label information, providing a basis for subsequent analysis and prediction tasks;
[0021] The two constraint values are divided into whether the total energy at each time point is greater than the maximum threshold, and the number of energies at each time point that are greater than the set threshold;
[0022] The label set statistically checks whether the density exceeding the threshold at each time point of the corresponding time domain signal in the energy spectrum is greater than the energy threshold. If it is greater than the energy threshold, the label is set to 1.0, which means an epileptic seizure; otherwise, the label is 0.0, and epilepsy will not occur. The generated label information [a, b, c, d] includes energy number, start time, end time and confidence.
[0023] Furthermore, the neural network is constructed using a convolutional neural network, which is composed of parallel paths. Each individual path consists of a semi-dilated convolution module, a maximum pooling module, a Flatten layer, a fully connected layer, and an activation module. This enables learning of abstract features related to epilepsy, and combines data enhancement and regularization techniques to improve the generalization ability of the model, achieve accurate prediction of epileptic states in unknown data, and establish a reliable seizure prediction system.
[0024] The semi-dilated convolution module consists of 5 semi-dilated convolutions with kernel size n×n and different dilation rates, which are used to extract feature information at different scales. By using different dilation rates, EEG data can be observed from different scales, helping the network to better understand the global structure and local patterns of EEG data.
[0025] The maximum pooling module pooling sampling is used to downsample the input feature map, reduce the spatial dimension of the feature map, and retain the most significant features, which helps the model learn a more general feature representation;
[0026] After the Flatten layer is used for convolution and pooling operations, the feature map needs to be flattened into a one-dimensional vector so as to be passed to the fully connected layer for classification or regression operations;
[0027] The fully connected layer is used to integrate and transform features;
[0028] The activation module uses the Sigmoid function as the activation function of the output layer.
[0029] Furthermore, the fully supervised learning network is trained using labeled EEG data and its parameters are adjusted by back-propagation to accurately predict epileptic states.
[0030] Furthermore, the mean square error is selected as the loss function kernel. MSE trains the model by minimizing the squared difference between the predicted value and the actual value.
[0031] Furthermore, the response success rate indicator is designed to measure the performance of the model on an unbalanced data set. The RS indicator takes into account the recognition of positive and negative samples by the epilepsy prediction model, so it can better measure. The closer RS is to 1, the stronger the prediction ability of the model; the closer RS is to 0, the weaker the prediction ability of the model.
[0032] Furthermore, the adaptation sensitivity index is used to measure the model's ability to successfully detect positive examples in prediction. The number of samples that are actually positive examples and predicted as positive examples is one of the important indicators for evaluating model performance.
[0033] Furthermore, the specificity index is used to measure the model's ability to successfully exclude negative examples in prediction, and is also one of the important indicators for evaluating model performance.
[0034] (III) Beneficial effects
[0035] 1. This invention uses the powerful sequence data representation and memory capabilities of convolutional neural networks to successfully break through the reliance of traditional epilepsy prediction models on individualized data and achieve high-precision prediction of epileptic seizures across patients. The model not only has the accuracy to capture subtle sequence changes, but also demonstrates excellent cross-domain adaptability in diverse patient groups.
[0036] 2. The present invention first merges n-channel signal sequences and removes redundant data from the channels; then uses short-time Fourier transform to convert the EEG signal from the time domain space to the frequency domain space to analyze the local frequency characteristics of the signal; then calculates the power spectrum and total power of the signal at one-dimensional time points to analyze the energy distribution of the signal; finally, an adaptive power extraction method is designed to obtain a time-confidence pseudo-label array through total power value constraints and super-threshold point number constraints.
[0037] 3. The network has a dual-branch structure. The lower branch extracts the deep information of EEG sequence data through the dual-stream semi-dilated fusion module (DHFM), and the upper branch establishes the connection between DHFM and the feature map of the original sequence data through transposed convolution. The multi-layer semi-dilated convolution of DHFM captures multi-scale information by adjusting the dilation rate, while achieving a balance between computational complexity and receptive field, effectively reducing model redundancy.
[0038] 4. The present invention constructs a simple and efficient end-to-end pseudo-supervised learning framework. In the field of epileptic seizure prediction, the time-confidence pseudo-label is used as the only criterion for constraining network training for the first time and has achieved success. The EEG column data after hybrid data enhancement is input into the above neural network, and is finally forced to be used for loss with time-confidence, directly positioning the network prediction level at the epileptic seizure time point, effectively improving the accuracy and real-time performance of the prediction before the epileptic seizure. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flowchart of an epileptic seizure prediction method based on a lightweight deep statistical model;
[0040] Figure 2 This is a working principle diagram of the hybrid data enhancement model of the present invention;
[0041] Figure 3 This is a working principle diagram of the statistical model of the present invention;
[0042] Figure 4 This is a working principle diagram of the convolutional neural network model described in the present invention;
[0043] Figure 5 A neural network and training strategy framework diagram for fully supervised learning according to the present invention;
[0044] Figure 6 A comparison diagram of the results of the epilepsy attack prediction method of the present invention and the existing method; DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 are within the scope of protection of the present invention.
[0046] Embodiment 1;
[0047] like Figure 1 As shown, Example 1 of the present invention provides a flowchart of an epileptic seizure prediction method based on a lightweight deep statistical model, and the method specifically includes the following steps:
[0048] S1, prepare the data set: prepare the CHB-MIT data set, and first shuffle the first 70% of the CHB-MIT data set (Degradationshuffle) to ensure the initial uniformity of the mixed data set. The first 70% of the CHB-MIT data set is used for label generation and network training; the last 30% of the CHB-MIT data set is used for the final model test.
[0049] S2, construct a hybrid data enhancement model: construct a hybrid data enhancement model including a data segmentation module, a data removal module, a random channel replacement module designed by the present invention, and a signal denoising module. By dividing the EEG signal of the training data set into smaller sequences according to the time dimension, the EEG segments are divided into smaller non-overlapping segments, each of which is 30 seconds long; damaged EEG segments with data loss at different times are removed from the training set; using the random replacement multi-channel data strategy designed by the present invention, the order of 23 channels is randomly disrupted according to the random number generator, the channel data is merged, and then the enhanced short sequence samples are spliced into a complete EEG signal in time order, and finally, the enhanced complete EEG signal is input into the epilepsy prediction model for training; finally, the randomly replaced signal is denoised, and the EEG signal is output, the EEG data is reasonably enhanced, and the data set is trimmed and expanded.
[0050] S3, build a deep statistical model: build a deep statistical model including a statistical model and a convolutional neural network. The first step is to build a statistical model, and combine statistical methods to analyze and model the EEG signal. First, analyze the power spectrum of the EEG signal, determine the threshold of a specific frequency band, and design an adaptive power extraction method for detecting abnormal activities. The power spectrum of the EEG signal above the threshold is constrained again to prevent the accuracy from being reduced due to a few abnormal signals. The second step is to build a convolutional neural network for epileptic seizure prediction, and the network architecture includes two parallel branches. The first branch implements data upsampling through the feature mapping layer, transposed convolution block 1 and transposed convolution block 2; the second branch performs feature extraction and downsampling through the dual-stream semi-expanded fusion module 1 (DHFM1) and the dual-stream semi-expanded fusion module 2 (DHFM2). The two branches are finally fused in the epilepsy prediction module, where the transposed convolution block 2 upsamples to DHFM2, and the convolution block 2 downsamples to the transposed DHFM2, which helps to maintain data information and improve prediction accuracy. The first branch learns and extracts high-level abstract features of the input data through feature mapping layers and transposed convolution blocks, while reconstructing refined feature maps using upsampling operations. The second branch learns and extracts low-level features of the original input data through DHFM, and reduces the size of the feature map using downsampling operations. Finally, the feature maps of the two branches are aggregated in the epilepsy prediction module, which integrates feature information at different levels and scales, thereby improving the accuracy and robustness of epilepsy prediction. This parallel structure allows the network to learn both detailed and global features simultaneously, thereby better predicting the possibility of epileptic seizures. The overall architecture is designed to improve the accuracy and robustness of the model, enabling it to cope with changes in different patients and datasets.
[0051] S4, fully supervised network training: The fully supervised training process includes loss function design and adaptation, training strategy design and evaluation index design; in the training stage, our working mode is end-to-end mode, and the original EEG signal samples are subjected to data mixing enhancement and statistical model to generate [a, b, c, d] array labels, which are used for subsequent model training tasks; the EEG samples are sent to the neural network, and the output array labels of the network are continuously constrained to fit the optimal model under the action of the loss function. In the present invention, the network model selects the mean square error (MSE) as the loss function kernel to effectively measure the difference between the output of the epileptic seizure prediction model and the true array label, providing a clear training goal for the model. Designing a new loss function for epileptic seizure prediction , ensuring that the model accurately captures key features and effectively predicts. Add L2 regularization terms to the loss function to maintain the complexity and generalization ability of the model. Use the Adam optimizer to speed up the convergence of the model to the optimal solution. Use the exponential decay strategy to optimize the model learning process and improve the generalization performance on the training set and test set. Design the response success rate (RS) indicator to intuitively reflect the model's recognition accuracy of epileptic seizures, providing an important reference for model improvement. Introduce sensitivity (TP) and specificity (TN) indicators to comprehensively evaluate the model's recognition ability on true positive and true negative examples, providing a comprehensive evaluation of model performance.
[0052] S5, model testing and fine-tuning: Model testing and fine-tuning: Train the epilepsy prediction model to obtain a pre-trained model, input the data set of one third of the data prepared in step S1 into the pre-trained model for testing, and use the data set of the other one third of the data to fine-tune the model according to the evaluation index value of the test, optimize the model parameters, and further improve the performance of epilepsy prediction;
[0053] S6, model solidification and saving: After the fine-tuning in step S5 is completed, the fine-tuned network parameters are solidified and the final epilepsy prediction model is saved; the model is tested again using the remaining one-third of the data set in step S1, and the EEG sequence can be directly input into the trained end-to-end model to obtain the epilepsy attack prediction score.
[0054] Embodiment 2;
[0055] like Figure 1 As shown, the invention implementation example 1 provides a flowchart of an epileptic seizure prediction method based on a lightweight deep statistical model, and the method specifically includes the following steps:
[0056] S1, prepare the dataset: prepare the CHB-MIT dataset. The first 70% of the CHB-MIT dataset is used for label generation and network training; the last 30% of the CHB-MIT dataset is used for final model tuning and testing; the CHB-MIT dataset is expanded using the channel random permutation method; the CHB-MIT dataset contains long-term electroencephalogram (EEG) records from 24 children with epilepsy, and the CHB-MIT dataset contains multiple types of epileptic seizures, including partial seizures and generalized seizures. According to different patient identifiers, the EEG data in the dataset are divided into multiple sequences, each sequence represents a patient's data record. In each sequence, the patient's epileptic seizure time point and non-seizure time point are marked. Each record in the dataset provides rich clinical information, such as the patient's age, gender, epilepsy type, medication status, etc. The dataset also provides corresponding annotation files, which contain information such as the time and type of epileptic seizures.
[0057] S2, constructing a hybrid data enhancement model: constructing a data enhancement model including a data segmentation module, a data removal module, a random channel replacement module designed by the present invention, and a signal denoising module, such as Figure 2 The CHB-MIT dataset was fused into a large-scale dataset, the distribution characteristics of the EEG signal were analyzed, and a signal segmentation program was written to segment it into smaller non-overlapping segments in the time dimension, each with a length of 30 seconds, such as Figure 2 (a). Perform power statistics in a specific frequency band, identify abnormal frequency components, and filter them in the time window. For EEG signal segments with data loss or damage at different times, with more than 20% missing values, they are removed from the training and test sets, such as Figure 2 (b). Multiple channels of each short sequence were randomly permuted, the order of multiple channels was randomly disrupted, and channels were reorganized. The EEG data of each patient were recorded from 23 channels, namely, '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', 'FT9-FT10', 'T8-P8', 'FZ-CZ', 'CZ-PZ', 'P7-T7', 'T7-FT9', 'FT9-FT10', 'FT10-T8', 'P8-O2'. First, determine the position of the channel to be randomized, use a random number generator to randomly shuffle the order of the 23 channels, merge the channel data, and then splice the enhanced short sequence samples into a complete EEG signal in chronological order, such as Figure 2 (c) Complete the expansion of the dataset.
[0058] S3, build a deep statistical model: build a deep statistical model including a statistical model and a convolutional neural network model. The first step is to build a statistical model, such as Figure 3 , combined with statistical methods, the EEG signal is analyzed and modeled. First, the EEG signal after hybrid enhancement processing is subjected to short-time Fourier transform. Through short-time Fourier transform, the energy distribution of the EEG signal at different frequencies can be obtained. Through frequency domain analysis, abnormal frequency components can be identified to help detect possible abnormal EEG signals. The short-time Fourier transform formula design process is expressed as follows:
[0059]
[0060] in, Represented in the frequency domain The signal representation at is the spectrum obtained by short-time Fourier transform; is a windowing function used to reduce spectrum leakage; Time domain signal; N is the length of the signal, that is, the number of samples contained in the sequence.
[0061] Then, by analyzing the power spectrum of the EEG signal and calculating the Gaussian distribution, an adaptive power extraction method is set, which includes two constraints. First, the threshold of a specific frequency band is determined. ,in According to the signal frequency The mean and standard deviation The calculation is used to detect abnormal activity of epileptic EEG signals. The threshold is calculated using the following formula:
[0062]
[0063] in, is the weight coefficient used to weight the mean and standard deviation; is the frequency The mean of the power spectrum at ; is a parameter that controls the standard deviation multiple; is the frequency The standard deviation of the power spectrum at .
[0064] Constraint 1: Total EEG energy at each time point Is it greater than the maximum threshold? ;
[0065] Constraint 2: Detect EEG signals above the threshold ,if The conditional probability is greater than And if the condition of constraint 1 is met, then this EEG segment is marked as an abnormal signal , that is, epileptic seizure. The abnormal signal marking process of constraint 2 can be expressed as:
[0066]
[0067] in, is the frequency The signal power at It's a signal is the conditional probability of abnormal signal; is the set probability value, here set .
[0068] Then, calculate the normal signal separately and abnormal signals The conditional probability , , which can be expressed using the formula as follows:
[0069]
[0070]
[0071] in, , Represent the mean of the power spectrum of normal signal and abnormal signal respectively; , Represent the standard deviation of the power spectrum of normal signal and abnormal signal respectively.
[0072] Gaussian distribution calculation uses a suitable Gaussian kernel to calculate the kernel density, and then the probability of epileptic seizures is obtained through Bess calculation to complete the setting of two epileptic seizure constraint conditions. The formula for selecting the Gaussian kernel is as follows:
[0073]
[0074] in, Represents the signal itself.
[0075] Select the Gaussian kernel function and calculate the normal signal below and abnormal signals The Gaussian conditional probability is calculated as follows:
[0076]
[0077]
[0078] in, Indicates the first observations; Indicates the first observations; N and M are the number of segments of normal signals and abnormal signals respectively; K represents the above-mentioned Gaussian kernel function; h represents the bandwidth in the Gaussian kernel density estimation, which is used to control the smoothness of the kernel function.
[0079] Finally, the conditional probability is calculated by Bayes' theorem. When , it is determined that epilepsy has occurred. The conditional probability formula of abnormal signal is expressed as:
[0080]
[0081] After the above statistical modeling calculations, an array label [a, b, c, d] is generated, and the original EEG signal data is converted into a data set with label information.
[0082] The construction of convolutional neural network model, such as Figure 4, the input is EEG signal, which is passed through a 3×3 convolution layer to extract the local features of the input EEG signal. Then it is divided into two parallel branches. One branch first passes through the feature mapping layer to further extract and enrich the features, and transpose convolution block 1 and transpose convolution block 2 to upsample the input; the second branch passes through the dual-stream semi-expanded fusion module 1 (DHFM1) and the dual-stream semi-expanded fusion module 2 (DHFM2), and the last two branches are summarized in the epilepsy prediction module; among them, transpose convolution block 2 upsamples to DHFM2 to increase the size of the feature map to a certain size so that it can be summarized with DHFM2. DHFM2 downsamples to transpose convolution block 2. The first branch learns and extracts high-level abstract features of the input data through feature mapping layers and transpose convolution blocks, and uses upsampling operations to reconstruct refined feature maps. The second branch learns and extracts low-level features of the original input data through DHFM, and uses downsampling operations to reduce the size of the feature map. Finally, the feature maps of the two branches are summarized in the epilepsy prediction module, which integrates feature information at different levels and scales, thereby improving the accuracy and robustness of epilepsy prediction.
[0083] Among them, DHFM also has two parallel branches. The first path has six consecutive layers, namely 3 convolutional layers and 3 maximum pooling layers. The convolutional layer consists of 5 parallel half-expanded convolutions with 3×3 kernels, and their half-expansion rates are 1, 2, 4, 8, and 16, respectively. A maximum pooling layer with a 2×2 kernel is used on each convolutional layer. The number of kernels (K) used in the three half-expanded convolutional layers is set to 64, 128, and 256, respectively. The second path has the same structure as the first path, but uses a 5×5 kernel instead of 3×3. This helps to extract different representation maps from interval and predictive EEG scale maps, thereby improving the performance and generalization ability of the proposed model. The two paths summarize the feature map, then expand it into a one-dimensional vector, and finally perform a nonlinear transformation through the activation function Sigmoid to increase the expression ability of the network. Among them, the expression of the activation function is as follows:
[0084]
[0085] S4, fully supervised network training: The fully supervised training process includes loss function design and adaptation, training strategy design, and evaluation index design, such as Figure 5; During the training phase, our working mode is end-to-end mode. The original EEG signal samples are processed through the data enhancement model to generate an expanded data set. The expanded data set is then used as the input of the statistical model to output an array label containing energy number-onset time-end time-confidence. The label is also used for subsequent model training tasks. The EEG samples are sent into the neural network to provide a clear training goal for the model, ensuring that the model accurately captures key features and effectively predicts. At the same time, the Adam optimizer is used to speed up the model's convergence to the optimal solution. The output and array label are compared through the loss function In this invention, the network model selects the mean square error (MSE) as the loss function kernel, which effectively measures the difference between the output of the epilepsy seizure prediction model and the true array label. Under the action of the loss function, the network's output array label is constantly constrained to fit the optimal model. Designing a loss function for epilepsy seizure prediction , and add the L2 regularization term to the loss function to generate a new loss function To maintain the complexity and generalization ability of the model. The specific formula is designed as follows:
[0086]
[0087]
[0088] in, is the energy loss term; is the time loss term; is the confidence loss term; , , is the weight of each part of the loss function; is the regularization coefficient, which is used to control the influence of the regularization term; is the weight parameter of the model. The specific formula used is as follows:
[0089]
[0090]
[0091]
[0092] in, and Represents the true energy label and the energy value predicted by the neural network; and They represent the real onset start time label and the start time predicted by the neural network respectively; and They represent the real end time label of the seizure and the end time predicted by the neural network respectively; and Represent the true confidence label and the confidence predicted by the neural network respectively;
[0093] The Adam optimizer is used to speed up the convergence of the model to the optimal solution. The exponential decay strategy is used to optimize the model learning process and improve the generalization performance on the training set and test set. The success rate of designing a new response ( ) indicator directly reflects the model's accuracy in identifying epileptic seizures and provides an important reference for model improvement. Response success rate ( ) by the number of attacks success rate ( ) and the onset time error ( ) jointly evaluate. It can be expressed using the formula:
[0094]
[0095] in, Represents the total number of EEG signal sequences for each subject in the test data set, The predicted The number of epileptic seizures in a sequence, Indicates The actual number of epileptic seizures in a sequence (the batch-size in the test phase is set to 1, that is, all EEG signal sequences of a subject are tested in one round). Used to evaluate whether the model accurately predicts the number of seizures in the test set.
[0096] The present invention further divides the errors of the start and end times into layers and introduces the time deviation parameter of the weight , so that the model output actively performs nonlinear penalties on the start and end times:
[0097]
[0098] in, represents an asymmetric weight parameter, allowing different penalties to be imposed on errors at the beginning and end of the prediction, represents an active selection process; Represents the total number of EEG signal sequences for each subject in the test data set; and Respectively represent the predicted The time of onset of the seizure and the actual time of onset; and Represent the predicted end time and the actual end time respectively. Used to evaluate the accuracy of the prediction of the onset time. The function performs nonlinear scaling so that large errors have a more pronounced effect.
[0099] The sensitivity (TPR) and specificity (TNR) indicators are introduced to comprehensively evaluate the model's ability to identify true positives and true negatives, providing a comprehensive evaluation of the model's performance. The specific formula is designed as follows:
[0100]
[0101]
[0102] in is the total length of the time period; used to normalize the time error; is the starting time error; is the end time error; is the confidence error; , , is the weight coefficient, satisfying + + =1, used to adjust the impact of each error term. : True positives (number of seizures correctly identified by the model), : the number of true negatives (the number of non-epileptic seizures correctly identified by the model), : number of false positives (number of times the model incorrectly identified them as epileptic seizures), FN: number of false negatives (number of times the model missed epileptic seizures).
[0103] S5, model testing and fine-tuning: training the epilepsy prediction model to obtain a pre-trained model, inputting a data set of one third of the data prepared in step S1 into the pre-trained model for testing, and using the data set of another one third of the data to fine-tune the model according to the evaluation index value of the test, optimizing the model parameters, and further improving the performance of epilepsy prediction;
[0104] All software programming parts of the present invention are carried out on the open source Pytorch framework, and hardware training, testing, model tuning and later program modularization are all carried out on an Nvidia GeForce RTX4090 GPU computer. The loss function kernel of the present invention uses MSE loss, and in order to improve the detection accuracy, the energy number, onset time, end time and confidence are separately used MSE loss, and the loss weights are respectively , , , During network training, the number of multi-core processes is set to 4, the learning rate is set to 0.01, the SGD gradient descent method is used to constrain network optimization, the batch size is set to 64, and the network achieves stable convergence after 100 epochs.
[0105] S6, model solidification and saving: After the fine-tuning in step S5 is completed, the fine-tuned network parameters are solidified and the final epilepsy prediction model is saved; the model is tested again using the remaining one-third of the data set in step S1, and the EEG sequence can be directly input into the trained end-to-end model to obtain the epilepsy attack prediction score.
[0106] Among them, the implementation of convolution, normalization, activation function, sample cropping and sample elimination are algorithms well known to those skilled in the art, and the specific processes and methods can be found in corresponding textbooks or technical literature.
[0107] The EEG data enhancement technology based on sequence segmentation and multi-channel random permutation strategy proposed in the present invention alleviates the bottlenecks such as poor prediction accuracy and long prediction time caused by insufficient samples, and provides a new way to solve the accuracy and stability problems that urgently need to be solved in the current EEG signal processing field. The present invention designs an epilepsy prediction method based on a deep statistical model to solve the problems of complex computational efficiency and low prediction accuracy of traditional epilepsy attack prediction methods. Under the same conditions, the feasibility and superiority of this method are further verified by calculating the relevant indicators of the epilepsy attack prediction results obtained by the existing method.
[0108] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for predicting epileptic seizures based on a lightweight deep statistical model, characterized in that: The method specifically comprises the following steps: S1, prepare the dataset: prepare the CHB-MIT dataset. The first 70% of the CHB-MIT dataset is used for label generation and network training; the last 30% of the CHB-MIT dataset is used for the final model testing; S2, constructing a hybrid data enhancement model: the hybrid data enhancement model includes a data segmentation module, a data removal module, a random channel replacement module and a signal denoising module; the CHB-MIT dataset in step S1 is input into the hybrid data enhancement model to obtain an enhanced EEG dataset library; S3, building a deep statistical model: The deep statistical model includes the design of statistical models and the construction of neural networks; Inputting the enhanced EEG data in step S2 into the statistical model for labeling and network training; The construction of the statistical model first performs short-time Fourier transform on the EEG signal after hybrid enhancement processing to obtain the energy distribution of the EEG signal at different frequencies; then sets the threshold of a specific frequency band; then performs energy spectrum calculation and sets two constraints for adaptive power extraction; then performs abnormal signal detection; secondly, calculates the power spectrum mean μ of the abnormal signal B , standard deviation σ B , the probability of normal signals and abnormal signals; finally, the probability of epileptic seizure is calculated using Gaussian kernel and Bayesian theorem; The threshold T of the specific frequency band f is the mean value μ of the signal frequency f f and standard deviation σ f The calculation can be expressed as: T f =w f ·(m f +k·s f ) Among them, w f is the weight coefficient used to weight the mean and standard deviation; μ f is the mean of the power spectrum at frequency f; k is a parameter that controls the multiple of the standard deviation; σ f is the standard deviation of the power spectrum at frequency f, The two constraints are: Constraint 1: whether the total EEG energy at each time point is greater than the maximum threshold, E i >T f ; Constraint 2: detect EEG signals above the threshold. If the conditional probability is higher than α, mark this EEG signal segment as abnormal, i.e., an epileptic seizure; The abnormal signal detection process can be expressed by the following formula: Where R(f) is the signal power at frequency f; P(f|P(f)) is the conditional probability that the signal X(f) is an abnormal signal; α is the set probability value, here α=0.6, The calculation probability of the normal signal and the abnormal signal is expressed by the formula: Among them, μ A , μ B Respectively represent the mean of the power spectrum of normal signal and abnormal signal; σ A , σ B Represent the standard deviation of the power spectrum of normal signal and abnormal signal respectively, The Gaussian kernel is expressed using the formula Among them, x represents the signal itself, The kernel density calculation is expressed using the formula: Among them, A i represents the i-th observation value obtained from the normal signal; B i represents the i-th observation value obtained from the abnormal signal; N and M are the number of segments of normal signal and abnormal signal respectively; K represents the above Gaussian kernel function; h represents the bandwidth in Gaussian kernel density estimation, which is used to control the smoothness of kernel function. The Bayesian theorem conditional probability formula can be expressed as: When the probability P>α, it is determined to be an epileptic seizure, and the above statistical modeling is used to generate array labels [a, b, c, d]; S4, fully supervised network training: The fully supervised training process includes loss function design and adaptation, training strategy design and evaluation index design; select a suitable loss function kernel and design the prediction loss; the loss function kernel is the mean square error; design evaluation indicators to evaluate the performance of the prediction model, including designing response success rate indicators, adaptation sensitivity and specificity indicators; The loss function is composed of energy loss L e , time loss L t and confidence loss L c Weighted to the total loss L total =αL e +βL t +γL c Decide; The energy loss formula is: The time loss formula is: The confidence loss formula is: Among them, y e and Represents the true energy label and the energy value predicted by the neural network; y onset and Respectively represent the real onset start time label and the start time predicted by the neural network; y offset and Respectively represent the real end time label of the attack and the end time predicted by the neural network; y c and Represent the true confidence label and the confidence predicted by the neural network respectively; S5, model testing and fine-tuning: training the epilepsy prediction model to obtain a pre-trained model, inputting a data set with one third of the data volume prepared in step S1 into the pre-trained model for testing, using the response success rate and other two evaluation indicators for evaluation, and using the data set with another one third of the data volume for model fine-tuning according to the evaluation indicator values of the test, optimizing the model parameters, and improving the performance of epilepsy prediction; The method for predicting epileptic seizures based on a lightweight deep statistical model is characterized by: a response success rate R e-t The success rate R e and the onset time error R t Joint evaluation; R e It is used to evaluate whether the model's predicted number of attacks is accurate, using the formula: Where N represents the total number of EEG signal sequences of each subject in the test data set, P i represents the predicted number of epileptic seizures in the ith sequence, A i represents the actual number of epileptic seizures in the ith sequence (the batch-size in the test phase is set to 1, that is, all EEG signal sequences of a subject are tested in one round), R t It is used to evaluate whether the model's onset prediction time is accurate, using the formula: Among them, ξ (s.e) represents an asymmetric weight parameter, which allows different penalties to be imposed on the errors at the start and end of the prediction, (se) represents the active selection process; M represents the total number of EEG signal sequences for each subject in the test data set; and represent the predicted start time and actual start time of the jth epileptic seizure, respectively; and Represent the predicted end time and the actual end time respectively. R e-t The closer it is to 1, the stronger the predictive ability of the model; e-t The closer it is to 0, the weaker the predictive ability of the model; S6, model solidification and saving: After the fine-tuning in step S5 is completed, the fine-tuned network parameters are solidified and the final epilepsy prediction model is saved; the model is tested again using the remaining one-third of the data set in step S1, and the EEG sequence can be directly input into the trained end-to-end model to obtain the epilepsy attack prediction score.
2. The method for predicting epileptic seizures based on a lightweight deep statistical model according to claim 1, characterized in that: The hybrid data enhancement model is decoupled into a data segmentation module, a data removal module, a random channel replacement module, and a signal denoising module to solve the problems of data scarcity, noise interference, variability, and insufficient samples; improve the accuracy of deep learning models in epilepsy prediction, and overcome bottlenecks such as poor prediction accuracy and long prediction time caused by insufficient samples; The data segmentation module is used to segment the EEG segment into smaller non-overlapping segments, each segment is 30 seconds long, and the maximum frame length is preferred to achieve higher performance; The data rejection module is used to determine completely or partially damaged EEG segments when there is "data dropout" in the EEG segments, when the EEG signal values of all channels under a given time sample are zero, and the damaged EEG segments have more than 20% missing values, and exclude them from the training and test sets; The random channel replacement module is used for random replacement and increase or decrease of all channels of the signal after data elimination processing; The order of the 23 channels was randomly shuffled using a random number generator, the channel data was merged, and then the enhanced short sequence samples were spliced into a complete EEG signal in chronological order; The signal denoising module is used to denoise the randomly permuted signal and output an EEG signal.
3. The method for predicting epileptic seizures based on a lightweight deep statistical model according to claim 1, characterized in that: The neural network architecture consists of two parallel branches; Before entering the two branches, the signal first passes through a 3×3 convolutional layer to extract local features of the input EEG signal; The first branch first passes through the feature mapping layer to further extract and enrich features, and the transposed convolution block 1 and the transposed convolution block 2 upsample the input; The second branch passes through the dual-stream semi-expanded fusion module 1 DHFM1 and the dual-stream semi-expanded fusion module 2 DHFM2, and the last two branches are summarized in the epilepsy prediction module; wherein the transposed convolution block 2 upsamples DHFM2 to increase the size of the feature map to a certain size so as to be summarized with DHFM2; DHFM2 downsamples to the transposed convolution block 2; Each DHFM module in the second branch also has two branches. The first branch consists of 5 parallel semi-dilated convolutions with 3×3 kernels, and their semi-dilation rates are 1, 2, 4, 8 and 16 respectively; each semi-dilated convolution layer is followed by a maximum pooling layer with 2×2 kernels; the number of kernels K used in the three semi-dilated convolution layers is 64, 128 and 256 respectively; the second branch has the same structure as the first path, but the kernel of the semi-dilated convolution is 5×5 instead of 3×3; the two paths are aggregated for feature mapping, then expanded into a one-dimensional vector, and finally nonlinearly transformed through an activation function.
4. The method for predicting epileptic seizures based on a lightweight deep statistical model according to claim 1, characterized in that: The fully supervised learning network is trained using labeled EEG data, and its parameters are adjusted via back-propagation to accurately predict epileptic states.
5. The method for predicting epileptic seizures based on a lightweight deep statistical model according to claim 1, characterized in that: The adaptation sensitivity index is used to measure the model's ability to successfully detect positive examples in prediction. The number of samples that are actually positive examples and predicted as positive examples is one of the important indicators for evaluating model performance.
6. The method for predicting epileptic seizures based on a lightweight deep statistical model according to claim 1, characterized in that: The specificity index is used to measure the model's ability to successfully exclude negative examples in prediction, and is also one of the important indicators for evaluating model performance.
Citation Information
Patent Citations
Electrocardio multi-mode contrast learning method for single-lead arrhythmia diagnosis
CN118333130A