Epileptic seizure prediction method of adaptive attention mechanism fusion network
Through the adaptive attention mechanism fusion network, the time-frequency domain characteristics of EEG signals are dynamically extracted and multi-dimensional feature fusion is carried out, which solves the problem of incomplete feature extraction in the existing technology, and significantly improves the accuracy and reliability of epilepsy prediction. .
Patent Information
- Application Number
- CN202411182779.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-06
AI Technical Summary
The prior art is difficult to effectively extract the multi-dimensional characteristics of EEG signals in epilepsy prediction, especially the spatial and temporal spectrum-dependent characteristics, resulting in poor prediction performance.
A fusion network of adaptive attention mechanisms is designed to dynamically extract time frequency domain features through an adaptive short-time Fourier neural network combining residual connections and triple attention mechanisms, and epilepsy occurs through focal loss training strategies. Pattern recognition and classification.
The accuracy and reliability of epilepsy prediction were significantly improved. The experimental results showed that the average accuracy and sensitivity on the CHB-MIT dataset reached 94.8% and 96.7%, and the false alarm rate was reduced to 0.072.
Smart Images

Figure CN119073910A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of electroencephalogram signal processing, and in particular provides an end-to-end epileptic seizure prediction method of an adaptive attention mechanism fusion network. Background Art
[0002] Epilepsy is a common chronic central nervous system disease caused by abnormal discharges of brain neurons, characterized by recurrent seizures. There are a large number of patients affected by this disease worldwide. The suddenness and high incidence of epilepsy make epileptic seizures a great threat to the quality of life and health of patients. Therefore, there is an urgent need to predict epileptic seizures in order to reduce the damage caused by epileptic seizures.
[0003] Epilepsy prediction is an interdisciplinary research field, which makes it possible to study epilepsy prediction from many aspects. With the advancement of neuroelectrophysiology, imaging, biological signal processing and machine learning, it is possible to extract useful information from complex EEG signals to predict epilepsy. Since EEG signals are strongly correlated with the occurrence of brain diseases, epilepsy prediction based on the spatiotemporal information of EEG signals has become a mainstream trend.
[0004] The diagnosis and prediction of epilepsy mainly rely on the analysis of EEG signals by medical workers, but due to individual differences and subjectivity, errors may occur in the diagnosis. In recent years, with the continuous deepening of research on epilepsy prediction, more and more methods have been applied to epilepsy prediction. Due to the advantages of automatic feature extraction and classification prediction, deep learning has stronger generalization ability. For the prediction of time series, the combination of recurrent neural network (RNN) and convolutional neural network (CNN) is often used. However, most existing methods convert EEG signals into time-frequency series for prediction through short-time Fourier transform or wavelet transform, which makes it difficult to extract effective time series features, and does not consider multi-dimensional representations including spatiotemporal spectral dependence in the brain at the same time, resulting in poor performance in epileptic seizure prediction. Therefore, it is necessary to design a reasonable model to effectively integrate the multi-dimensional features of EEG signals to avoid information redundancy and waste of resources, while also identifying the original features.
[0005] In response to the above problems, this paper designs an epileptic seizure prediction model based on short-time Fourier transform neural network to adaptively extract time-frequency domain features. In the feature extraction module, a convolutional neural network with an adaptive integration mechanism is used. In addition, considering the multi-dimensional comprehensive information of EEG signals, a triple attention mechanism of time, space, and channel is constructed. In the convolutional attention module (CBAM), residual connections are introduced to form a multiple attention mechanism to effectively fuse multi-domain features, and a certain prediction accuracy is achieved through sufficient network training. Summary of the invention
[0006] In response to the problems existing in the related art, the present invention provides an epileptic seizure prediction method based on an adaptive attention mechanism fusion network.
[0007] The technical solution adopted by the present invention is as follows: an end-to-end epileptic seizure prediction method based on an adaptive attention mechanism fusion network comprises the following steps:
[0008] S1. Prepare the data set, perform data enhancement and preprocessing on the EEG data, and divide the data segments according to different seizure states;
[0009] S2. Construct an adaptive short-time Fourier neural network and use the adaptive integration mechanism based on minimum mean square error to dynamically extract local or global features in the time and frequency domain.
[0010] S3. The triple attention mechanism and hierarchical architecture with residual connection are used to strengthen the long-term dependencies in the EEG signals of the extracted time-frequency series data and integrate the time-frequency features.
[0011] S4. A focal loss training strategy is used to alleviate the problem of sample class imbalance, and epileptic seizure patterns are identified and classified based on the multidimensional fusion features of time-frequency series.
[0012] In step S1, the data is screened, denoised, enhanced, baseline corrected and artifact removed; a fixed length of EEG data is selected in each seizure state to define the time window of the epileptic seizure event, and the data segments are divided and labeled based on this; the EEG data is resampled, and independent component analysis is used to enhance the useful components of the data and suppress noise.
[0013] Furthermore, in the basic parameters, the EEG data is divided into three data segments: seizure, unseizure, and seizure-supplement. A 64-s window size is used, and a moving distance of 32 s step is set between two consecutive windows. Each data segment is intercepted to a length of 64 s, and independent component analysis is performed at a sampling rate of 256 Hz.
[0014] In step S2, an adaptive short-time Fourier neural network is constructed, and an improved discrete short-time Fourier transform (DTFT) is introduced to perform time-frequency domain conversion of EEG data; the original DTFT formula is:
[0015] Where m is the time step, indicating the center of the current time frame, and ω[nm] is the Hanning smoothing window function, which is:
[0016] Where n=1, 2, ... N-1, N represents the total length of the window function, and M represents the effective length of the window function. The Hanning smoothing window is introduced to reduce the boundary effect, thereby improving the filtering quality.
[0017] Furthermore, the improved DTFT introduces an adaptive filter consisting of a band-stop filter based on a Butterworth filter and a high-pass filter. High-pass filtering is performed first to ensure that low-frequency noise is removed first, and then band-stop filtering is performed to remove high-frequency noise and low-frequency drift, retaining its main frequency components and improving the band-stop filtering effect. The improved DTFT formula is:
[0018] Among them, y bandpass [n] is the result after being processed by the adaptive filter. The process is as follows: y highpass [n]=HighpassFiliter(x[n],cutoff,fs) y bandpass [n] = BandstopFilter(y highpass ,lowcut,highcut,fs) In the formula, cutoff, lowcut, highcut are the cutoff frequencies. The cutoff frequency of the high-pass filter is 1Hz, and the band-stop filter removes the frequencies of 60Hz-65Hz and 120Hz-125Hz.
[0019] In step S2, an adaptive short-time Fourier neural network is constructed, and an adaptive time-frequency sequence integration mechanism based on the minimum mean square error (LMS) with trainable parameters is designed to adjust the fixed characteristics of the Fourier transform and dynamically extract the features of the time-frequency domain. For the input signal x(n), after passing through the transverse filter with adjustable parameters, the output is y(n). The LMS algorithm automatically adjusts the parameters of the filter according to the error between the output signal y(n) of the filter and the expected signal d(n), so that the filter adapts to the time-varying statistical characteristics of the random signal. The implementation process is as follows: Assume the input signal is a vector: X(n)=[x(n),x(n-1),…x(nL)] T The output of the LMS adaptive filter is: The error signal is e n , then: e(n)=d(n)-y(n)=d(n)-W T (n)X(n) Taking the minimum mean square value of the error signal e(n) as the optimal statistical criterion and defining the cost function as J(n), we have: J(n)=E[e 2 (n)] The change of J over time characterizes the convergence speed and convergence accuracy of the filter. When J takes the minimum value, the weight coefficient of the filter reaches the optimal value. Using the fastest gradient descent algorithm, adjust the filter weight vector W(n) along the negative gradient direction of the performance surface, search for the minimum point of the performance surface, and solve the optimal weight vector W opt ,available: Then the update formula for calculating the LMS adaptive filter weight vector is:
[0020] Furthermore, the adaptive time-frequency series integration mechanism introduces dynamic periodic weights and extended DTFT, enhances the discrete Fourier transform to process dependencies in time series data, and allows for a more comprehensive analysis of time series data.
[0021] In step S3, the triple attention mechanism and hierarchical architecture with residual connection are used to introduce triple attention layers to construct multi-dimensional interactions between input feature maps, and weighted operations are performed on each attention layer to achieve feature fusion in different dimensions. The input information is positionally encoded to obtain the absolute position information of each position, and a residual block is introduced after each attention layer to strengthen the long-term dependency in the EEG signal of the extracted time-frequency series data. The residual block function is: F(x)=H(x)+x Where H(x) is the output of the feedforward network and x is the original input.
[0022] In step S3, the triple attention is applied to the input tensor X in ∈R N*W*H , a cross-dimensional attention layer is considered, called triple attention layer, which uses three branches to capture the dependencies between the (N, W), (N, H), (W, H) dimensions of the input tensor respectively. It captures inter-channel and spatial dependencies and establishes cross-dimensional interactions. Where N, W, H are the number width and height of the feature map respectively.
[0023] In step S4, after the output of the introduced residual block, i.e., multiple attentions, passes through the feedforward network, the remaining original inputs are added, wherein the original inputs serve as the basis for the residual connection, so that the network can learn the residual function and capture and fuse the intrinsic features of the data in multiple dimensions.
[0024] Combined with the above technical solutions, the advantages of the present invention over the prior art are: the present invention introduces an adaptive attention mechanism based on DTFT to dynamically extract and fuse time-frequency domain features for epileptic seizure prediction. The Hanning window and spectral power ratio are introduced in the time-frequency domain conversion module to realize serial fusion of multiple features; in view of the problems that automatic feature extraction in the time-frequency domain usually relies on fixed parameters and analytical modes and cannot adapt to the dynamic environment of the sample space, an adaptive algorithm based on the minimum mean square error is introduced in combination with a neural network to adaptively select thresholds according to the dynamic changes of samples, thereby strengthening the representation of time-frequency domain features. In addition, a triple attention feature fusion network is combined to realize epileptic seizure prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in describing the embodiments.
[0026] Figure 1 It is the overall flow chart of the present invention;
[0027] Figure 2 This is the structure diagram of the adaptive Fourier convolutional neural network;
[0028] Figure 3 This is the structure diagram of the triple attention mechanism;
[0029] Figure 4 It is the residual block structure diagram. DETAILED DESCRIPTION
[0030] In order to make the above-mentioned objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present application will be described specifically, clearly and completely in conjunction with the accompanying drawings. The embodiments of the present invention will be further described in detail in conjunction with the accompanying drawings.
[0031] The innovation of the present invention lies in: based on the short-time Fourier transform neural network model, it cleverly combines the adaptive algorithm to dynamically extract the time-frequency features of the EEG signal, and combines the time, space, and channel triple attention mechanism to fuse multi-dimensional features. The design concept of the present invention breaks through the limitations of traditional machine learning methods in processing complex EEG data, introduces an adaptive attention mechanism, dynamically extracts the time-frequency features of the EEG signal, and fuses the features through the triple attention mechanism, and finally recognizes and classifies the epileptic seizure pattern through a classifier. Experimental results show that the present invention significantly improves the accuracy and reliability of epileptic seizure prediction.
[0032] like Figure 1 As shown, this embodiment is an end-to-end epileptic seizure prediction method based on an adaptive attention mechanism, which specifically includes the following steps:
[0033] S1, set the corresponding parameters for EEG data, perform data enhancement and preprocessing operations such as screening, denoising, enhancement, baseline correction and artifact removal on the data; select a fixed time length of EEG data in different seizure states to define the time window of epileptic seizure events, and divide and label the data segments based on this; resample the EEG data, use independent component analysis to enhance useful data components, explore the potential structure of pre-ictal and ictal data, and suppress noise.
[0034] For example, in the basic parameters, the EEG data is divided into three data segments: seizure, unseizure, and seizure-supplement, and corresponding sample data is placed in each data segment. A 64s window size is used, and a moving distance of 32s steps is set for two consecutive window data segments, and a 64s length is intercepted; resampling is performed at a sampling rate of 256Hz to enhance useful data components.
[0035] S2, constructs an adaptive short-time Fourier neural network and uses an adaptive integration mechanism based on minimum mean square error to dynamically extract local or global features in the time and frequency domains.
[0036] Exemplarily, based on short-time Fourier transform, adaptive filtering and Hanning smoothing window are introduced to filter the EEG data and perform time-frequency domain conversion to enhance the time-frequency domain representation. The implementation process is as follows: The original DTFT formula is: Where m is the time step, indicating the center of the current time frame, and ω[nm] is the Hanning smoothing window function, which is: Where n=1, 2, ... N-1, N represents the total length of the window function, and M represents the effective length of the window function. The Hanning smoothing window is introduced to reduce the boundary effect, thereby improving the filtering quality.
[0037] Specifically, the improved DTFT introduces an adaptive filter consisting of a band-stop filter based on a Butterworth filter and a high-pass filter. High-pass filtering is first performed to ensure that low-frequency noise is removed first, and then band-stop filtering is performed to remove high-frequency noise and low-frequency drift, retaining its main frequency components and improving the band-stop filtering effect. The improved DTFT formula is: Among them, y bandpass [n] is the result after being processed by the adaptive filter. The process is as follows: y highpass [n]=HighpassFilter(x[n], cutoff, fs) y bandpass [n] = BandstopFilter(y highpass , lowcut, highcut, fs) In the formula, cutoff, lowcut, and highcut are the cutoff frequencies. The cutoff frequency of the high-pass filter is 1Hz, and the band-stop filter removes the frequencies of 60Hz-65Hz and 120Hz-125Hz.
[0038] Specifically, an adaptive short-time Fourier neural network is constructed, and an adaptive time-frequency sequence integration mechanism based on the minimum mean square error (LMS) with trainable parameters is designed to adjust the fixed characteristics of the Fourier transform and dynamically extract the features of the time-frequency domain. For the input signal x(n), after passing through the transverse filter with adjustable parameters, the output is y(n). The LMS algorithm automatically adjusts the parameters of the filter according to the error between the output signal y(n) of the filter and the expected signal d(n), so that the filter adapts to the time-varying statistical characteristics of the random signal. The implementation process is as follows: Assume the input signal is a vector: X(n)=[x(n),x(n-1),…x(nL)] T The output of the LMS adaptive filter is: The error signal is e n , then: e(n)=d(n)-y(n)=d(n)-W T (n)X(n) Taking the minimum mean square value of the error signal e(n) as the optimal statistical criterion and defining the cost function as J(n), we have: J(n)=E[e 2 (n)] The change of J over time characterizes the convergence speed and convergence accuracy of the filter. When J takes the minimum value, the weight coefficient of the filter reaches the optimal value. Using the fastest gradient descent algorithm, adjust the filter weight vector W(n) along the negative gradient direction of the performance surface, search for the minimum point of the performance surface, and solve the optimal weight vector W opt ,available: Then the update formula for calculating the LMS adaptive filter weight vector is:
[0039] The adaptive time-frequency series integration mechanism in the present invention introduces dynamic periodic weights and extended DTFT, enhances the discrete Fourier transform to process dependencies in time series data, allows a more comprehensive analysis of time series data, and dynamically adjusts the input of the convolutional neural network, thereby achieving significant feature extraction.
[0040] S3, introduces the triple attention mechanism and hierarchical architecture of residual connection to strengthen the long-term dependency in the EEG signal of the extracted time-frequency series data and fuse the time-frequency features. By introducing the triple attention mechanism and hierarchical architecture of residual connection, the triple attention layer (TAL) is introduced to construct the multi-dimensional interaction between the input feature maps, and each attention layer is weighted to achieve feature fusion in different dimensions.
[0041] Exemplarily, the input information is positionally encoded to obtain the absolute position information of each position, and a residual block is introduced after each attention layer to strengthen the long-term dependency in the EEG signal of the extracted time-frequency series data. The residual block function is: F(x)=H(x)+x Where H(x) is the output of the feedforward network and x is the original input. Normalization after the addition operation ensures that the output of the residual connection is numerically stable, which helps the flow of gradients and the training of the model. By using residual modules in multiple attention and feedforward networks, the model is able to learn complex feature representations more effectively while maintaining the stability of the training process.
[0042] Specifically, the input information is positionally encoded to obtain the absolute position information of each position. Specifically, the triple attention is used for the input tensor X in ∈R N*W*H , a cross-dimensional attention layer is considered, called triple attention layer, which uses three branches to capture the dependencies between the (N, W), (N, H), (W, H) dimensions of the input tensor respectively. It captures inter-channel and spatial dependencies and establishes cross-dimensional interactions. Where N, W, H are the number width and height of the feature map respectively. X out =X _NW ~X 1 +X _NH ~X 2 +X _HW ~X 3 Where ~ represents the multiplication of broadcast elements, X _NW and X _NH Yes X in The permutation result, X _HW With X in Equal, X i (i=1, 2, 3) is the generation weight corresponding to the i-th attention branch.
[0043] The triple attention mechanism in this invention takes into account the influence of space and channel on time series features, and more effectively integrates time-frequency features in different attention mechanisms. In addition, the residual block connection is introduced to ensure the effective integration of the extracted rich features, reduce redundant information and obtain multi-dimensional feature fusion with higher performance.
[0044] S4, a focal loss training strategy is used to alleviate the problem of sample category imbalance. The epileptic seizure pattern is recognized and classified based on the correlation of the EEG signal time-frequency series over a long time span. The prediction of epileptic seizures is achieved by evaluating and optimizing the trained model.
[0045] For example, in the task of predicting epileptic seizures, uneven time records of epileptic seizure states will lead to low training efficiency. The misjudgment rate of samples with longer inter-ictal recording time will increase, reducing the accuracy of the model. Based on this, the present invention adopts a focal loss training strategy to alleviate the problem of sample imbalance.
[0046] To further illustrate the relevant effects of the embodiments of the present invention, the following experiment was conducted: The end-to-end fusion network based on the adaptive attention mechanism achieved significant results on the CHB-MIT epilepsy prediction dataset. To ensure efficient computing and processing capabilities, the experiment was performed on the NVIDIA4090 GPU. Among the 24 patients, 6 patients were divided as training sets, and the remaining 18 patients were used as test machines. A ten-fold cross-training method was used for the 6 patients in the training set, and 20,000 iterations were performed. Different learning rates were set for different parts of the network during the training process. The initial learning rate was set to 0.001, and the optimal solution of the learning rate was dynamically adjusted as the training progressed. As shown in Table 1, AUC represents accuracy, Sn represents sensitivity, and FPR / h represents the false alarm rate per hour. In the epilepsy prediction model based on time series information, our model has achieved an average accuracy of 94.8%, an average sensitivity of 96.7%, and an average false alarm rate of 0.072 as a whole. The present invention significantly improves the prediction performance compared to the existing model.
[0047] Table 1 Experimental results and comparison based on CHB-MIT dataset: Method AUC Sn FPR / h DCNN+Bi-LSTM 0.856 0.907 0.592 CE-stSENet 0.857 0.86 0.369 STFT+CNN 0.886 0.822 1.237 Ours 0.948 0.967 0.072
[0048] Finally, it should be noted that the above embodiments are only for illustrating the preferred technical concept and features of the present invention, and are not used to limit the present invention. The purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and it cannot be used to limit the protection scope of the present invention. For those skilled in the art, any modification, equivalent replacement, improvement, etc. made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. An epileptic seizure prediction method based on an adaptive attention mechanism fusion network, characterized in that: The method includes: S1. Prepare the data set, perform data enhancement and preprocessing on the EEG data, and divide the data segments according to different seizure states; S2, construct an adaptive short-time Fourier neural network and dynamically extract local or global features in the time-frequency domain using an adaptive integration mechanism based on minimum mean square error; S3, using the triple attention mechanism and hierarchical architecture with residual connection to strengthen the long-term dependencies in the EEG signals of the extracted time-frequency series data and integrate the time-frequency features; S4. A focal loss training strategy is used to alleviate the problem of sample class imbalance, and epileptic seizure patterns are identified and classified based on the multidimensional fusion features of time-frequency series.
2. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 1 is characterized by: In S1, the data is preprocessed, including: screening, denoising, enhancing, baseline correction and artifact removal operations on the data; selecting a fixed time length of EEG data in different attack states to define the time window of the epileptic attack event, and dividing the data segments based on this; resampling the EEG data, and using independent component analysis to enhance the useful components of the data and suppress noise.
3. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 1 is characterized by: In S2, an adaptive short-time Fourier neural network is constructed, and an improved discrete short-time Fourier transform (DTFT) is introduced to perform time-frequency domain conversion of EEG data; the original DTFT formula is: Among them, m is the time step, which represents the center of the current time frame, and ω[nm] is the Hanning smoothing window function, which is formulated as follows: Where n=1, 2, ... N-1, N represents the total length of the window function, and M represents the effective length of the window function. The Hanning smoothing window is introduced to reduce the boundary effect, thereby improving the filtering quality.
4. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 3 is characterized by: The improved DTFT introduces an adaptive filter consisting of a band-stop filter based on a Butterworth filter and a high-pass filter. High-pass filtering is performed first to ensure that low-frequency noise is removed first, and then band-stop filtering is performed to remove high-frequency noise and low-frequency drift, retaining its main frequency components and improving the band-stop filtering effect. The improved DTFT formula is: Among them, y bandpass [n] is the result after being processed by the adaptive filter.
5. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 1, characterized in that: In S2, an adaptive short-time Fourier neural network is constructed, and an adaptive time-frequency sequence integration mechanism based on the minimum mean square error (LMS) with trainable parameters is designed to adjust the fixed characteristics of the Fourier transform and dynamically extract the features of the time-frequency domain. The weight vector update formula of the adaptive mechanism is: Where W(n) is the weight vector, μ>0 is the step size factor, is the descent gradient, e(n) is the error signal, and X(n) is the input vector.
6. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 5 is characterized by: The adaptive time-frequency series integration mechanism introduces dynamic periodic weights and extended DTFT, enhances the discrete Fourier transform to process dependencies in time series data, and allows for a more comprehensive analysis of time series data.
7. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 1 is characterized by: In S3, a triple attention mechanism and hierarchical architecture with residual connections are introduced to introduce a triple attention layer (TAL) to construct multi-dimensional interactions between input feature maps, and weighted operations are performed on each attention layer to achieve feature fusion in different dimensions. The input information is positionally encoded to obtain the absolute position information of each position, and a residual block is introduced after each attention layer to strengthen the long-term dependency in the EEG signal of the extracted time-frequency series data. The residual block function is: F(x)=H(x)+x Where H(x) is the output of the feedforward network and x is the original input.
8. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 7 is characterized by: The triple attention is applied to the input tensor X in ∈R N*W*H , a cross-dimensional attention layer is considered, called triple attention layer, which uses three branches to capture the dependencies between the (N, W), (N, H), (W, H) dimensions of the input tensor respectively. It captures inter-channel and spatial dependencies and establishes cross-dimensional interactions. Where N, W, H are the number, width, and height of feature maps, respectively.
9. The epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 7, characterized in that: After the output of the introduced residual block, i.e., multiple attentions, passes through the feedforward network, the remaining original inputs are added, wherein the original inputs serve as the basis for the residual connection, so that the network can learn the residual function and capture and fuse the intrinsic features of the data in multiple dimensions.
10. The end-to-end epileptic seizure prediction method of the adaptive attention mechanism fusion network according to claim 1, characterized in that: In S4, a focal loss training strategy is used to alleviate the problem of sample class imbalance, and epilepsy attack patterns are recognized and classified based on the correlation of EEG signal time-frequency series over a long time span. The prediction of epileptic seizures is achieved by evaluating and optimizing the trained model.
Citation Information
Cited By
Epileptic seizure prediction method based on lightweight deep statistical model
CN119400431A
