Epileptic seizure prediction method based on global context awareness generative network

Through global context perception generation network and multi-scale time-frequency feature deep convolution model, the shortcomings of traditional models in capturing dynamic characteristics of EEG signals are solved, the accuracy and reliability of epilepsy prediction are improved, and the differences in seizure status are overcome question.

CN119033387AInactive Publication Date: 2024-11-29HARBIN UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411460789.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2024-11-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Due to the high uncertainty and individual differences in epilepsy, the traditional feature learning model is prone to biasing towards certain types of samples and falling into the phenomenon of 'filtering bubbles', affecting the accuracy and reliability of predictions, and the existing generative adversarial networks are There are shortcomings in capturing the time series dynamic characteristics of EEG signals.

Method used

Using a method based on global context-aware generation network, the time window signal fragment is obtained through filtering and time window segmentation, a global dependency perception generator and steady-state distribution regulation discriminator are constructed, and the global dependency relationship and context information are captured, and the synthetic signal fragment is generated for use. Data enhancement and combined with multi-scale time-frequency feature depth convolution model, we deeply explore the key features of epilepsy EEG.

Benefits of technology

The problem of continuous differences in seizure status was overcome, the richness of EEG data samples and the accuracy of epilepsy prediction were improved, and the learning ability and prediction performance of the model were enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119033387A_ABST
    Figure CN119033387A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of epileptic seizure prediction, and discloses an epileptic seizure prediction method based on a global context awareness generative network, which comprises the following steps: acquiring electroencephalogram signals at the early stage and the interval of epileptic seizure; performing filtering and time window segmentation on the electroencephalogram signals to obtain time window signal fragments; constructing a global context sensing generation network, and performing global dependency relationship capture and context information integration on the time window signal segments to obtain synthetic signal segments; and constructing a multi-scale time-frequency feature deep convolution epileptic seizure prediction model, performing multi-scale time-frequency analysis on a data enhancement sample, and deeply mining key features of epilepsy electroencephalogram. According to the epileptic seizure prediction method based on the global context perception generative network, the problem of continuous difference of seizure states is solved, the space richness of electroencephalogram data samples is ensured, the prediction precision is improved, and a new thought and technical means are provided for the field of epileptic seizure prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of epileptic seizure prediction, and in particular to an epileptic seizure prediction method based on a global context-aware generation network. Background Art

[0002] Epilepsy is a common neurological disease characterized by high incidence, suddenness, and recurrence, which has a significant impact on patients' lives. Due to the high uncertainty and individual differences in epileptic seizures, traditional feature learning models show significant differences in the number, duration, and interval of seizures among patients, resulting in the inability of limited samples to accurately reflect the diversity of EEG signals. This imbalance makes the model prone to bias towards a certain type of sample, falling into the "filter bubble" phenomenon, and gradually narrowing to a specific type of feature representation, which directly affects the model's ability to learn seizure patterns, and thus affects the accuracy and reliability of predictions.

[0003] However, the adversarial mechanism-oriented generative adversarial network aims to characterize complex EEG features in high-dimensional signal space through interactive learning strategies between the generator and the discriminator. However, the existing generative adversarial network model is limited in the generation of epileptic EEG signals because the occurrence and development of epileptic seizures contain unique time series dynamic characteristics, which restricts the ability of the generative adversarial network to accurately capture and reconstruct these complex dynamic features, making the generated EEG signals lack the long-term contextual dependency that is crucial for epileptic seizure prediction algorithms.

[0004] In view of this, the prediction method must have the ability to process and adapt to these changes, and perform data enhancement to achieve high-precision epileptic seizure prediction. Therefore, it is worth exploring in depth to build a global context-aware generative network that can generate synthetic signal fragments with global dependency structures, so as to ensure that the stably generated epileptic EEG signals contain unique time series dynamic characteristics in a more reasonable and consistent manner with the actual occurrence and development of epileptic seizures, and to expand the original samples. Summary of the invention

[0005] The purpose of the present invention is to provide an epileptic seizure prediction method based on a global context-aware generative network, which overcomes the problem of continuous variability in seizure states, ensures the richness of the EEG data sample space, and thus improves prediction accuracy.

[0006] To achieve the above object, the present invention provides an epileptic seizure prediction method based on a global context-aware generative network, comprising the following steps:

[0007] S1. Obtaining EEG signals before and during epileptic seizures; wherein the EEG signals are non-invasive scalp EEG signals;

[0008] S2, filtering and time window segmenting the EEG signal to obtain time window signal segments;

[0009] S3, build a global context-aware generation network to capture global dependencies and integrate context information of time window signal segments to obtain synthetic signal segments for original sample data enhancement;

[0010] S4. Construct a multi-scale time-frequency feature deep convolution epileptic seizure prediction model, perform multi-scale time-frequency analysis on data augmentation samples, deeply explore the key features of epileptic EEG, and ensure high-precision epileptic seizure prediction.

[0011] Preferably, in step S2, the EEG signal is filtered and purified by using a suitable filter, and the EEG signal is segmented by using a time window of a certain time length and an overlap rate to obtain a time window signal segment x, as shown below:

[0012]

[0013] Among them, x n is the nth time window signal segment; X(t) is the original EEG signal time series; ε is the overlap rate between signal segments; L is the length of the sliding time window; n=1,2,… represents the index of the time window; N is the number of sliding time windows, T is the total sampling points of epileptic EEG; and

[0014] N = 2 × [T / L] + 1;

[0015] Where [ ] represents the rounding function.

[0016] Preferably, in step S3, the global context-aware generation network includes a global dependency-aware generator and a steady-state distribution regulation discriminator, and the specific process is as follows:

[0017] S31, constructing a global dependency-aware generator, and transforming a random noise vector initialized to conform to a normal distribution to obtain a synthetic signal segment that maintains a global dependency structure;

[0018] S32, constructing a steady-state distribution control discriminator, and discriminating the time window signal segment and the synthetic signal segment to obtain a discriminant result with optimized distribution consistency;

[0019] S33. Based on the global context-aware generative network, after the generator and the discriminator are trained against each other, a synthetic signal segment with global dependency structure consistency is obtained for original sample data enhancement.

[0020] Preferably, the input features obtained by applying linear transformation and activation function to the input random noise vector in step S31 are as follows:

[0021]

[0022] X input=ReLU(W input ·z+b input );

[0023] Where z is a random noise vector sampled from a normal distribution; represents a standard normal distribution with a mean of 0 and a variance of 1; ReLU represents a nonlinear activation function; Wi nput and b input Represents the weight matrix and bias vector from the input layer to the hidden layer;

[0024] The self-attention mechanism is as follows:

[0025] Q=W q Conv(X input ,W Conv,G,i ,b Conv,G,i );

[0026] K=W k Conv(X input ,W Conv,G,i ,b Conv,G,i );

[0027] V=W v Conv(X input ,W Conv,G,i ,b Conv,G,i );

[0028]

[0029] Among them, Q, K and V represent query, key and value matrices, i.e., attention triples; W q , W k and W v Represents the weight matrix of the query, key, and value matrices; Conv represents a 1D convolution with a convolution kernel of 1×3; W Conv,G,i and b Conv,G,i represents the weight matrix and bias vector of the convolutional layer before the self-attention mechanism in the generator; Attention represents the output of the self-attention mechanism; QK T represents the similarity between the query matrix and the key matrix; A scaling factor to prevent the inner product from being too large and causing the gradient to disappear; the softmax function normalizes the score to make it a probability distribution;

[0030] The resulting synthetic signal fragment that maintains the global dependency structure is as follows:

[0031]

[0032] Among them, W out and b outRepresents the weight matrix and bias vector of the output layer; Conv represents a 1D convolution with a convolution kernel of 1×3; W Conv,G,j and b Conv,G,j Represents the weight matrix and bias vector of the convolutional layer after the self-attention mechanism in the generator; W fc,G and b fc,G represents the weight matrix and bias vector of the fully connected layer in the generator; ReLU represents the nonlinear activation function; Attention represents the output of the self-attention mechanism; Q, K, and V represent the query, key, and value matrices;

[0033] At the same time, the objective function of the constructed global dependency-aware generator is:

[0034]

[0035] Among them, G represents the generator; L G represents the loss function of the generator; Indicates that in generating data distribution P g Next, the synthetic signal fragment The score given by the discriminator D Expected value; Denotes the discriminator D for the synthetic signal segment 's rating.

[0036] Preferably, the judgment result based on the distribution consistency optimization obtained in step S32 is as follows:

[0037] D(x)=W fc,D ·COnv(x,W Conv,D ,b Conv,D )+b fc,D ;

[0038]

[0039] Where x represents the time window signal segment; Represents the distribution of real data P r and generate data distribution P g The samples obtained by random linear interpolation between D(x) and Denotes the discriminator D for the time window signal fragment x and the interpolated sample Rating of W Conv,D and b Conv,D Represents the weight matrix and bias vector of the convolutional layer in the discriminator; W fc,D and b fc,D Represents the weight matrix and bias vector of the fully connected layer in the discriminator;

[0040] At the same time, the objective function of the constructed steady-state distribution control discriminator is as follows:

[0041]

[0042] Among them, L D represents the loss function of the discriminator; Indicates that in the real data distribution P r , the expected value of the score D(x) given by the discriminator D for the time window signal segment x; λ is the weight coefficient of the gradient penalty; Represents the distribution of real data P r and generate data distribution P g The distribution of samples obtained by random linear interpolation between ; Indicates the interpolation sample distribution Next, interpolation samples Squared deviation from the gradient Expected value; Indicates that the discriminator D is in the difference sample The L2 norm of the gradient of the output at ;

[0043] Then, the real data distribution P r and generate data distribution P g The distance measurement strategy W(P r ,P g ), specifically described as:

[0044]

[0045] in, Indicates that in all real data distribution P r and generate data distribution P g is the joint distribution set of marginal distributions Π(P r ,P g ) takes the minimum value; Indicates that under the joint distribution γ, the sample pair The distance between Expected value; represents the time window signal segment x and the synthetic signal segment The distance measure between .

[0046] Preferably, the multi-scale time-frequency feature deep convolution epilepsy attack prediction model constructed based on step S4 is to perform multi-scale time-frequency analysis on the data enhancement samples, and deeply explore the key features of epileptic EEG to ensure high-precision epilepsy attack prediction, as follows:

[0047] S41. Perform multi-scale time-frequency analysis on data enhancement samples based on wavelet packet transform to obtain refined epileptic EEG time-frequency features;

[0048] S42. Based on deep convolutional neural network, deep feature learning and representation are performed on the refined epileptic EEG time-frequency features to achieve epileptic seizure prediction.

[0049] Preferably, based on the wavelet packet transform in step S41, a multi-scale time-frequency analysis is performed on the data enhancement sample to obtain refined epileptic EEG time-frequency features, as follows:

[0050] S411, based on db4 wavelet as the basis function, four-layer decomposition is performed to enhance the data sample, and a wavelet packet decomposition result is obtained; wherein the wavelet packet decomposition result includes a low-frequency approximate signal and a high-frequency detail signal, as follows:

[0051] The low frequency approximation signal is as follows:

[0052]

[0053] Among them, A1(t) is the low-frequency approximate signal obtained by the first decomposition; A j+1 (t) is the low-frequency approximate signal obtained by decomposition at the j+1th layer; s(t) is the original input signal; m represents the index of time delay; h(n) is the low-pass filter coefficient of the db4 wavelet;

[0054] The high frequency detail signal is as follows:

[0055]

[0056] Where D1(t) is the high-frequency detail signal obtained by the first decomposition; D j+1 (t) is the high-frequency detail signal obtained by decomposition at the j+1th layer; g(n) is the high-pass filter coefficient of the db4 wavelet;

[0057] The corresponding relationship between nodes and frequency ranges is as follows:

[0058] The AAAA4 node represents the delta wave, which corresponds to the lowest frequency band of brain waves, 0.5-4 Hz;

[0059] The DAAA4 node represents theta waves, which correspond to the lower frequency brain waves, 4 to 8 Hz;

[0060] ADAA4 node represents alpha waves, corresponding to the middle frequency brain waves, 8-12 Hz;

[0061] The AADA4, DDAA4, DADA4, ADDA4, and DDDA4 nodes collectively represent beta waves, corresponding to the higher-frequency brain waves, 12 to 32 Hz;

[0062] The remaining nodes collectively represent gamma waves, which correspond to the highest-frequency brain waves, 32 to 64 Hz;

[0063] S412, according to the wavelet packet decomposition result, the decomposition coefficient and energy of the multi-scale time-frequency feature are calculated to obtain the refined epileptic EEG time-frequency feature; wherein the decomposition coefficient and energy of the multi-scale time-frequency feature include the wavelet packet decomposition coefficient of each layer node and the energy distribution of each layer node, which are as follows:

[0064] The wavelet packet decomposition coefficients of each layer node are as follows:

[0065]

[0066] The energy distribution of each layer of nodes is as follows:

[0067]

[0068] Where j is the decomposition level index; k represents a specific node at the jth level; W j,k (t) is the wavelet packet decomposition coefficient at the kth node in the jth layer, reflecting the intensity of the specific frequency component of the signal at that moment; ψ j,n (t) represents the corresponding db4 wavelet basis function; E j,k (t) is the energy distribution at the kth node in the jth layer;

[0069] At the same time, the refined epileptic EEG time-frequency features are as follows:

[0070]

[0071] Among them, J represents the total number of decomposition layers; K j Represents the total number of nodes in the jth layer.

[0072] Preferably, based on the deep convolutional neural network in step S42, deep feature learning and characterization are performed on the refined epileptic EEG time-frequency features to achieve epileptic seizure prediction, specifically as follows:

[0073] S421. Through five convolutional layers, activation function layers and pooling layers, the key features of the refined epileptic EEG time-frequency features are deeply extracted; wherein the key feature h obtained is as follows:

[0074] h i =Pool i (ReLU i (Conv i (H(t),K Conv,i ,d Conv,i )));

[0075] h = concat(h1,h2,h3,h4,h5);

[0076] Among them, h iRepresents the output features after the i-th layer convolution, activation and pooling operations; Pool i Represents the 2D pooling of the i-th layer; ReLU i represents the activation function of the i-th layer; Conv i represents the 2D convolution with a convolution kernel of 3×3 in the i-th layer; H(t) represents the refined time-frequency characteristics of the input epileptic EEG; K Conv,i and d Conv,i Represents the weight matrix and bias vector of the i-th layer convolution; concat represents the feature concatenation operation;

[0077] S422. The key features are integrated and classified through the fully connected layer, the softmax layer and the cross entropy loss layer to achieve epileptic seizure prediction. Among them, the loss L between the predicted probability distribution and the true label output by the cross entropy loss layer for back propagation and updating is as follows:

[0078]

[0079] Among them, Y i represents the i-th element in the one-hot encoding vector of the true label, that is, the sample belongs to the i-th category; C is the number of categories; flatten represents the flattening operation; h represents the key feature of the refined epileptic EEG time-frequency feature; K fc,i , K fc,j and d fc,i ,d fc,j Represents the weight matrix and bias vector of the i-th and j-th classes of the fully connected layer.

[0080] Therefore, the present invention adopts the above-mentioned epileptic seizure prediction method based on the global context-aware generative network to capture the global dependencies and integrate the context information of epileptic EEG, overcome the problem of continuous differences in seizure states, obtain synthetic signal fragments for original sample data enhancement, and perform multi-scale time-frequency analysis on the data enhancement samples, thereby ensuring the spatial richness of EEG data samples and improving the prediction effect of epileptic seizures.

[0081] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] Figure 1 It is a flow chart of an epileptic seizure prediction method based on a global context-aware generative network of the present invention;

[0083] Figure 2 It is a schematic diagram of the process of constructing a global context-aware generation network and enhancing original sample data in the present invention;

[0084] Figure 3It is a schematic diagram of the process of constructing a multi-scale time-frequency feature deep convolution epilepsy attack prediction model to achieve epilepsy attack prediction. DETAILED DESCRIPTION

[0085] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0086] like Figure 1 As shown, the present invention provides an epileptic seizure prediction method based on a global context-aware generative network, comprising the following steps:

[0087] S1, obtaining EEG signals before and during epileptic seizures;

[0088] S2, filtering and time window segmenting the EEG signal to obtain time window signal segments;

[0089] S3, build a global context-aware generation network to capture global dependencies and integrate context information of time window signal segments to obtain synthetic signal segments for original sample data enhancement;

[0090] S4. Construct a multi-scale time-frequency feature deep convolution epileptic seizure prediction model, perform multi-scale time-frequency analysis on data augmentation samples, deeply explore the key features of epileptic EEG, and ensure high-precision epileptic seizure prediction.

[0091] Example

[0092] The epileptic seizure prediction system based on the global context-aware generation network of this embodiment includes: a data collection module, a data processing module, a model building and training module, and a prediction and evaluation module.

[0093] Data collection module: Use multi-channel electroencephalogram (EEG) equipment to monitor and record the EEG signals of epilepsy patients over a long period of time.

[0094] Data processing module: including data preprocessing, noise filtering, signal segmentation and other steps. The original EEG signal is subjected to denoising, filtering and time window segmentation. At the same time, according to the marker information of epileptic seizures, the signal is divided into pre-ictal and interictal periods.

[0095] Model building and training module: By building a global context-aware generative network, we generate samples before epileptic seizures and perform data enhancement to make the ratio of positive and negative samples reach 1:1, overcoming the problem of data imbalance; then we use a multi-scale time-frequency feature deep convolutional network to extract features and classify them to distinguish between the signals before and between epileptic seizures. After data enhancement, we use a four-layer wavelet transform to perform multi-scale time-frequency analysis on the samples and extract refined time-frequency features. These features reflect the energy distribution of the signal at different time and frequency scales, providing rich information for the prediction model.

[0096] Prediction and evaluation module: The extracted time-frequency features are input into the deep convolutional neural network, the spatial features are extracted through the convolution layer, the nonlinear features are strengthened by the activation layer, the features are integrated and classified by the fully connected layer and the softmax layer, and the input real-time EEG signal is predicted to determine whether it is in the early stage of epileptic seizure. The prediction performance of the model is evaluated using indicators such as accuracy, recall rate, and F1 score, and the performance of the model is further analyzed through the ROC curve and AUC value.

[0097] S1. Based on the data collection module, the EEG signals before and during the epileptic seizure are obtained; wherein the EEG signals are non-invasive scalp EEG signals rather than intracranial EEG signals, which can reduce the pain and burden of patients.

[0098] S2, based on the data processing module, the EEG signal is filtered and purified by using a suitable filter, and the EEG signal is segmented by using a time window of a certain length and an overlap rate to obtain a time window signal segment x, as shown below:

[0099]

[0100] Among them, x n is the nth time window signal segment; X(t) is the original EEG signal time series; ε is the overlap rate between signal segments; L is the length of the sliding time window; m = 1, 2, ... represents the index of the time window; N is the number of sliding time windows, T is the total sampling points of epileptic EEG; and

[0101] N = 2 × [T / L] + 1;

[0102] Where [ ] represents the rounding function.

[0103] S3, construct a global context-aware generation network, capture the global dependency and integrate the context information of the time window signal fragment, and obtain the synthetic signal fragment for the original sample data enhancement; wherein, the global context-aware generation network includes a global dependency-aware generator and a steady-state distribution regulation discriminator, such as Figure 2 As shown, the specific process is as follows:

[0104] S31. Construct a global dependency-aware generator and transform the random noise vector initialized to conform to the normal distribution to obtain a synthetic signal segment that maintains the global dependency structure.

[0105] The input features obtained by applying linear transformation and activation function to the input random noise vector are as follows:

[0106]

[0107] X input =ReLU(Winput ·z+b input );

[0108] Where z is a random noise vector sampled from a normal distribution; represents a standard normal distribution with a mean of 0 and a variance of 1; ReLU represents a nonlinear activation function; W input and b input Represents the weight matrix and bias vector from the input layer to the hidden layer.

[0109] The self-attention mechanism is as follows:

[0110] Q=W q Conv(X input ,W Conv,G,i ,b Conv,G,i );

[0111] K=W k Conv(X input ,W Conv,G,i ,b Conv,G,i );

[0112] V=W v Conv(X input ,W Conv,G,i ,b Conv,G,i );

[0113]

[0114] Among them, Q, K and V represent query, key and value matrices, i.e., attention triples; W q , W k and W v Represents the weight matrix of the query, key, and value matrices; Conv represents a 1D convolution with a convolution kernel of 1×3; W Conv,G,i and b Conv,G,i represents the weight matrix and bias vector of the convolutional layer before the self-attention mechanism in the generator; Attention represents the output of the self-attention mechanism; QK T represents the similarity between the query matrix and the key matrix; A scaling factor is used to prevent the inner product from being too large, which causes the gradient to disappear; the softmax function normalizes the score to make it a probability distribution.

[0115] The resulting synthetic signal fragment that maintains the global dependency structure is as follows:

[0116]

[0117] Among them, W out and b outRepresents the weight matrix and bias vector of the output layer; Conv represents a 1D convolution with a convolution kernel of 1×3; W Conv,G,h and b Conv,G,j Represents the weight matrix and bias vector of the convolutional layer after the self-attention mechanism in the generator; W fc,G and b fc,G represents the weight matrix and bias vector of the fully connected layer in the generator; ReLU represents the nonlinear activation function; Attention represents the output of the self-attention mechanism; Q, K, and V represent query, key, and value matrices.

[0118] At the same time, the objective function of the constructed global dependency-aware generator is:

[0119]

[0120] Among them, G represents the generator; L G represents the loss function of the generator; Indicates that in generating data distribution P g Next, the synthetic signal fragment The score given by the discriminator D Expected value; Denotes the discriminator D for the synthetic signal segment 's rating.

[0121] S32. A steady-state distribution control discriminator is constructed, and the time window signal segment and the synthetic signal segment are discriminated. The obtained distribution consistency optimization discriminant result is as follows:

[0122] D(x)=W fc,D Conv(x,W Conv,D ,b Conv,D )+b fc,D ;

[0123]

[0124] Where x represents the time window signal segment; Represents the distribution of real data P r and generate data distribution P g The samples obtained by random linear interpolation between D(x) and Denotes the discriminator D for the time window signal fragment x and the interpolated sample Rating of W Conv,D and b Conv,D Represents the weight matrix and bias vector of the convolutional layer in the discriminator; W fc,D and b fc,D Represents the weight matrix and bias vector of the fully connected layer in the discriminator.

[0125] At the same time, the objective function of the constructed steady-state distribution control discriminator is as follows:

[0126]

[0127] Among them, L D represents the loss function of the discriminator; Indicates that in the real data distribution P r , the expected value of the score D(x) given by the discriminator D for the time window signal segment x; λ is the weight coefficient of the gradient penalty; Represents the distribution of real data P r and generate data distribution P g The distribution of samples obtained by random linear interpolation between ; Indicates the interpolation sample distribution Next, interpolation samples Squared deviation from the gradient Expected value; Indicates that the discriminator D is in the difference sample The L2 norm of the gradient of the output at .

[0128] Then, the real data distribution P r and generate data distribution P g The distance measurement strategy W(P r ,P g ), specifically described as:

[0129]

[0130] in, Indicates that in all real data distribution P r and generate data distribution P g is the joint distribution set Π(P r ,P g ) takes the minimum value; Indicates that under the joint distribution γ, the sample pair The distance between Expected value; represents the time window signal segment x and the synthetic signal segment The distance measure between .

[0131] S33. Based on the global context-aware generative network, after the generator and the discriminator are trained against each other, a synthetic signal segment with global dependency structure consistency is obtained for original sample data enhancement.

[0132] The present invention introduces a self-attention mechanism to capture the long-range dependencies of epileptic EEG signals, effectively extract global features, and avoid local information loss. At the same time, combined with the Wasserstein metric and gradient constraints, it is ensured that the generated synthetic signal fragments have good contextual consistency and generation stability. These synthetic signal fragments are used to enhance the original sample data, the label distribution of the sample set is optimized, and a 1:1 balance of positive and negative samples is achieved to improve the diversity and balance of the data set, thereby providing richer and more representative training samples for subsequent epileptic seizure prediction models, effectively solving the bias problem caused by the imbalance of the positive and negative sample ratios in the original data, and significantly improving the learning effect of the prediction model during the training process, and enhancing the prediction accuracy of the model. In addition, by introducing additional representative pre-epileptic seizure EEG positive samples, the input quality of the prediction model is optimized at the data level, enabling it to more comprehensively capture the pre-epileptic seizure characteristics, enhance sensitivity to different signal patterns, and thus improve prediction performance.

[0133] S4. Constructing a multi-scale time-frequency feature deep convolution epilepsy seizure prediction model is to perform multi-scale time-frequency analysis on data augmentation samples and deeply explore the key features of epileptic EEG to ensure high-precision epilepsy seizure prediction, such as Figure 3 As shown, the specific process is as follows:

[0134] S41. Based on wavelet packet transform, multi-scale time-frequency analysis is performed on the data enhancement samples to obtain refined epileptic EEG time-frequency features, as follows:

[0135] S411, based on db4 wavelet as the basis function, four-layer decomposition is performed to enhance the data sample, and a wavelet packet decomposition result is obtained; wherein the wavelet packet decomposition result includes a low-frequency approximate signal and a high-frequency detail signal, as follows:

[0136] The low frequency approximation signal is as follows:

[0137]

[0138] Among them, A1(t) is the low-frequency approximate signal obtained by the first decomposition; A j+1 (t) is the low-frequency approximate signal obtained by decomposition at the j+1th layer; s(t) is the original input signal; m represents the index of the time delay; h(n) is the low-pass filter coefficient of the db4 wavelet.

[0139] The high frequency detail signal is as follows:

[0140]

[0141] Where D1(t) is the high-frequency detail signal obtained by the first decomposition; D j+1(t) is the high-frequency detail signal obtained by decomposition at the j+1th layer; g(n) is the high-pass filter coefficient of the db4 wavelet.

[0142] The corresponding relationship between nodes and frequency ranges is as follows:

[0143] The AAAA4 node (0.5-4 Hz) represents the delta wave, which corresponds to the lowest frequency band of brain waves;

[0144] The DAAA4 node (4-8 Hz) represents theta waves, which correspond to the lower frequency brain waves;

[0145] ADAA4 node (8-12 Hz) represents alpha waves, corresponding to the middle frequency brain waves;

[0146] The AADA4, DDAA4, DADA4, ADDA4, and DDDA4 nodes (12-32 Hz) collectively represent beta waves, corresponding to higher-frequency brain waves;

[0147] The remaining nodes (32-64 Hz) collectively represent gamma waves, which correspond to the highest frequency brain waves.

[0148] S412, according to the wavelet packet decomposition result, the decomposition coefficient and energy of the multi-scale time-frequency feature are calculated to obtain the refined epileptic EEG time-frequency feature; wherein the decomposition coefficient and energy of the multi-scale time-frequency feature include the wavelet packet decomposition coefficient of each layer node and the energy distribution of each layer node, which are as follows:

[0149] The wavelet packet decomposition coefficients of each layer node are as follows:

[0150]

[0151] The energy distribution of each layer of nodes is as follows:

[0152]

[0153] Where j is the decomposition level index; k represents a specific node at the jth level; W j,k (t) is the wavelet packet decomposition coefficient at the kth node in the jth layer, reflecting the intensity of the specific frequency component of the signal at that moment; ψ j,n (t) represents the corresponding db4 wavelet basis function; E j,k (t) is the energy distribution at the kth node in the jth layer.

[0154] At the same time, the refined epileptic EEG time-frequency features are as follows:

[0155]

[0156] Among them, J represents the total number of decomposition layers; K jRepresents the total number of nodes in the jth layer.

[0157] S42. Based on deep convolutional neural network, deep feature learning and representation are performed on the refined epileptic EEG time-frequency features to achieve epileptic seizure prediction.

[0158] S421. Through five convolutional layers, activation function layers and pooling layers, the key features of the refined epileptic EEG time-frequency features are deeply extracted; wherein the key feature h obtained is as follows:

[0159] h i =Pool i (ReLU i (Conv i (H(t),K Conv,i ,d Conv,i )));

[0160] h = concat(h1,h2,h3,h4,h5);

[0161] Among them, h i Represents the output features after the i-th layer convolution, activation and pooling operations; Pool i Represents the 2D pooling of the i-th layer; ReLU i Represents the activation function of the i-th layer; Conv i represents the 2D convolution with a convolution kernel of 3×3 in the i-th layer; H(t) represents the refined time-frequency characteristics of the input epileptic EEG; K Conv,i and d Conv,i Represents the weight matrix and bias vector of the i-th layer convolution; concat represents the feature concatenation operation.

[0162] S422. Through the fully connected layer, softmax layer and cross entropy loss layer, the key features are integrated and classified to achieve epileptic seizure prediction.

[0163] The cross entropy loss layer outputs the loss L between the predicted probability distribution and the true label for backpropagation and update, as shown below:

[0164]

[0165] Among them, Y i represents the i-th element in the one-hot encoding vector of the true label, that is, the sample belongs to the i-th category; C is the number of categories; flatten represents the flattening operation; h represents the key feature of the refined epileptic EEG time-frequency feature; K fc,i , K fc,j and d fc,i d fc,j Represents the weight matrix and bias vector of the i-th and j-th classes of the fully connected layer.

[0166] By introducing a four-layer wavelet packet transform time-frequency analysis method, the model can decompose and capture the key frequency band features related to epileptic seizures in EEG signals at multiple frequencies and time scales. Combined with the representation ability of deep convolutional networks, the model can automatically learn and extract feature patterns that are important at different scales and classify them accordingly. A comprehensive analysis of different frequency components helps to enhance the accuracy and reliability of the model in predicting epileptic seizures.

[0167] Therefore, the present invention adopts the above-mentioned epileptic seizure prediction method based on the global context-aware generative network, establishes global dependencies to obtain long-range EEG context information, generates signal segments for enhancing the original sample data, solves the problem of continuous differences in seizure states, and ensures the richness of the EEG data sample space; utilizes the multi-scale time-frequency feature deep convolution epilepsy seizure prediction model to perform multi-scale time-frequency analysis on the enhanced data samples, and then deeply extracts and learns the key features in epileptic EEG, significantly improving the accuracy of epileptic seizure prediction, thereby providing more reliable support for clinical applications.

[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for predicting epileptic seizures based on a global context-aware generative network, characterized in that: The following steps are involved: S1. Obtaining EEG signals before and during epileptic seizures; wherein the EEG signals are non-invasive scalp EEG signals; S2, filtering and time window segmenting the EEG signal to obtain time window signal segments; S3, build a global context-aware generation network to capture global dependencies and integrate context information of time window signal segments to obtain synthetic signal segments for original sample data enhancement; S4. Construct a multi-scale time-frequency feature deep convolution epileptic seizure prediction model, perform multi-scale time-frequency analysis on data augmentation samples, deeply explore the key features of epileptic EEG, and ensure high-precision epileptic seizure prediction.

2. The epileptic seizure prediction method based on a global context-aware generative network according to claim 1, characterized in that: In step S3, the global context-aware generation network includes a global dependency-aware generator and a steady-state distribution regulation discriminator. The specific process is as follows: S31, constructing a global dependency-aware generator, and transforming a random noise vector initialized to conform to a normal distribution to obtain a synthetic signal segment that maintains a global dependency structure; S32, constructing a steady-state distribution control discriminator, and discriminating the time window signal segment and the synthetic signal segment to obtain a discriminant result with optimized distribution consistency; S33. Based on the global context-aware generative network, after the generator and the discriminator are trained against each other, a synthetic signal segment with global dependency structure consistency is obtained for original sample data enhancement.

3. The epileptic seizure prediction method based on a global context-aware generative network according to claim 2, characterized in that: The synthetic signal segment with the global dependency structure obtained in step S31 is as follows: Among them, W out and b out Represents the weight matrix and bias vector of the output layer; Conv represents a 1D convolution with a convolution kernel of 1×3; W Conv,G,j and b Conv,G,j Represents the weight matrix and bias vector of the convolutional layer after the self-attention mechanism in the generator; W fc,G and b fc,G represents the weight matrix and bias vector of the fully connected layer in the generator; ReLU represents the nonlinear activation function; Attention represents the output of the self-attention mechanism; Q, K, and V represent the query, key, and value matrices; At the same time, the objective function of the constructed global dependency-aware generator is: Among them, G represents the generator; L G represents the loss function of the generator; Indicates that in generating data distribution P g Next, the synthetic signal fragment The score given by the discriminator D Expected value; Denotes the discriminator D for the synthetic signal segment 's rating.

4. The epileptic seizure prediction method based on a global context-aware generative network according to claim 2, characterized in that: The judgment result based on the distribution consistency optimization obtained in step S32 is as follows: D(x)=W fc,D ·Conv(x,W Conv,D ,b Conv,D )+b fc,D ; Where x represents the time window signal segment; Represents the distribution of real data P r and generate data distribution P g The samples obtained by random linear interpolation between D(x) and Denotes the discriminator D for the time window signal fragment x and the interpolated sample Rating of W Conv,D and b Conv,D Represents the weight matrix and bias vector of the convolutional layer in the discriminator; W fc,D and b fc,D Represents the weight matrix and bias vector of the fully connected layer in the discriminator; At the same time, the objective function of the constructed steady-state distribution control discriminator is as follows: Among them, L D represents the loss function of the discriminator; Indicates that in the real data distribution P r , the expected value of the score D(x) given by the discriminator D for the time window signal segment x; λ is the weight coefficient of the gradient penalty; Represents the distribution of real data P r and generate data distribution P g The distribution of samples obtained by random linear interpolation between ; Indicates the interpolation sample distribution Next, interpolation samples Squared deviation from the gradient Expected value; Indicates that the discriminator D is in the difference sample The L2 norm of the gradient of the output at ; Then, the real data distribution P r and generate data distribution P g The distance measurement strategy W(P r ,P g ), specifically described as: in, Indicates that in all real data distribution P r and generate data distribution P g is the joint distribution set Π(P r ,P g ) takes the minimum value; Indicates that under the joint distribution γ, the sample pair The distance between Expected value; represents the time window signal segment x and the synthetic signal segment The distance measure between .

5. The epileptic seizure prediction method based on a global context-aware generative network according to claim 1, characterized in that: The multi-scale time-frequency feature deep convolution epilepsy attack prediction model constructed in step S4 performs multi-scale time-frequency analysis on the data enhancement samples and deeply mines the key features of epileptic EEG to ensure high-precision epilepsy attack prediction, as follows: S41. Perform multi-scale time-frequency analysis on data enhancement samples based on wavelet packet transform to obtain refined epileptic EEG time-frequency features; S42. Based on deep convolutional neural network, deep feature learning and representation are performed on the refined epileptic EEG time-frequency features to achieve epileptic seizure prediction.

6. The epileptic seizure prediction method based on a global context-aware generative network according to claim 5, characterized in that: Based on the deep convolutional neural network in step S42, deep feature learning and characterization are performed on the refined epileptic EEG time-frequency features to achieve epileptic seizure prediction, as follows: S421, through five convolutional layers, activation function layers and pooling layers, the key features of refined epileptic EEG time-frequency features are deeply extracted; S422. The key features are integrated and classified through the fully connected layer, the softmax layer and the cross entropy loss layer to achieve epileptic seizure prediction. Among them, the loss L between the predicted probability distribution and the true label output by the cross entropy loss layer for back propagation and updating is as follows: Among them, Y i represents the i-th element in the one-hot encoding vector of the true label, that is, the sample belongs to the i-th category; C is the number of categories; flatten represents the flattening operation; h represents the key feature of the refined epileptic EEG time-frequency feature; K fc,i , K fc,j and d fc,i d fc,j Represents the weight matrix and bias vector of the i-th and j-th classes of the fully connected layer.