Single-channel epileptic seizure early warning method based on deep double-cross metric learning

Through the deep dual cross-measurement learning method, the dual cross-map attention network and the routing Transformer network are used, combined with the hard triple-optimized measurement learning strategy, the problem of epilepsy warning in single-channel iEEG data is solved, and the warning effect of high sensitivity and low false alarm rate is achieved.

CN120093219APending Publication Date: 2025-06-06BEIHANG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510173482.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-17
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The prior art is difficult to effectively use single-channel iEEG data for epilepsy warning, mainly due to insufficient time-frequency characteristic analysis, the increase in redundant information caused by the global receptive field of the Transformer model, and the lack of representation learning strategies for adapting to small sample data.

Method used

Using the deep double cross-measurement learning method, a graph dependency relationship between multi-scale and multi-rhythmic representation is established by constructing a dual cross-graph attention network and a routing Transformer network, a graph dependency relationship between multi-scale and multi-rhythmic representation is extracted, and a redundant information is removed. At the same time, a metric learning strategy based on hard triple optimization is adopted to optimize the intra-class and inter-class distance between inter-sescal and pre-sescal features.

Benefits of technology

More effective seizure warning on single-channel iEEG data was achieved, improving the average warning sensitivity (Sn) of individual patients to 89.1%, and the hourly false alarm rate (FPR) was lower than 0.104, significantly improving the warning performance of individual patients.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120093219A_ABST
    Figure CN120093219A_ABST
Patent Text Reader

Abstract

The invention provides a single-channel epileptic seizure early warning method based on deep double-cross metric learning. Wherein a double-crossover graph attention network is designed, and a dependency relationship between a multi-scale time feature and a multi-rhythm spectrum feature is disclosed; a routing Transform network is used to extract key routing features with epileptic seizure potential; and using a metric learning strategy based on hard triple optimization to optimize intra-class and inter-class distances of routing features in the inter-attack period and the early-attack period in an iteration mode. In one embodiment of the invention, verification is carried out on an intracranial single-channel electroencephalogram data set containing 10 epilepsy patients, the average early warning sensitivity (Sn) reaches 89.1%, and the rate of false alarm per hour (FPR) is lower than 0.104. Compared with an existing method, the average early warning sensitivity is improved by more than 4%, it is indicated that the model can provide more effective epileptic seizure early warning for individual patients, and the method has important significance on clinical epileptic seizure early warning and intracranial single-channel nerve regulation and control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention proposes a single-channel epileptic seizure early warning method based on deep dual cross metric learning. Background Art

[0002] Epilepsy is a common neurological disorder in clinical practice, caused by excessive excitement of brain nerve cells. Studies have shown that the prevalence of epilepsy in my country is about 7%, with about 10 million current patients and about 400,000 new cases each year, half of which are children and adolescents. The suddenness and unpredictable nature of epileptic seizures seriously affect the quality of life of patients, and the risk of disability is extremely high. About one-third of patients eventually develop drug-resistant epilepsy, and may even die suddenly from unexplained causes, which brings a heavy burden to patients, families and society. If epileptic seizures can be accurately warned and intervened in time, it will not only help improve the success rate of treatment and reduce the risk of disease in patients, but also provide support for in-depth analysis of the pathogenesis of epilepsy and improvement of treatment methods, which is of great significance to improving the quality of life of patients and promoting the development of epilepsy treatment methods.

[0003] With the development of neuromodulation technology, deep brain stimulation of the anterior thalamic nucleus provides a potential means of control for epilepsy patients who are resistant to traditional treatment. The anterior thalamic nucleus has extensive connectivity in the central nervous system and plays a key role in the propagation pathway of epileptic activity. By performing deep brain stimulation on the anterior thalamic nucleus, the imbalance between excitation and inhibition in the epileptic network can be adjusted, thereby restoring normal neural activity. Therefore, collecting and analyzing intracranial EEG signals of the anterior thalamic nucleus has far-reaching significance for the early warning and regulation of epilepsy. In particular, in order to alleviate the pain of patients and reduce the complexity of electrode implantation surgery, designing an epileptic seizure early warning method based on single-channel iEEG while ensuring the accuracy of early warning is of great value for realizing individualized deep brain stimulation.

[0004] At present, most epileptic seizure warning methods rely on multi-channel EEG data, usually using graph convolutional networks or spatiotemporal graph attention networks to identify biomarkers based on the spatial distribution information of multi-channel signals. However, these methods are not suitable for single-channel iEEG data that lacks spatial information. The main reasons are as follows: First, in single-channel epileptic seizure warning methods, it is crucial to consider the time-frequency characteristics of EEG. For example, short-time Fourier transform and wavelet transform are usually integrated into convolutional neural networks to explore the individualized spectral responses of epileptic patients. However, these deep learning methods based on time-frequency analysis are more inclined to extract local coarse-grained features in a single time or spectrum domain, and fail to fully utilize the interdependence between time scales and spectral rhythms in single-channel iEEG. Second, the Transformer model based on the multi-head self-attention mechanism has advantages in capturing high-order neural activities in epileptic patients, but its global receptive field may lead to an increase in redundant information, which is not conducive to extracting useful interictal and preictal features. Third, in order to obtain effective interictal and preictal features, a reasonable representation learning strategy is crucial to adapt to the small sample data of single-channel iEEG.

[0005] The present invention proposes a single-channel epileptic seizure warning method based on deep double cross metric learning. The method establishes a graph dependency relationship between multi-scale and multi-rhythm representations by constructing a double cross graph attention network. At the same time, a routing Transformer network is designed to extract key potential features of epileptic seizures and remove redundant information in the epilepsy graph structure. In addition, a metric learning strategy based on hard triplet optimization is adopted to iteratively optimize the intra-class and inter-class distances of interictal and pre-ictal features, thereby improving the warning performance of the model in individual epilepsy patients. In one embodiment of the present invention, a single-channel intracranial EEG signal data set of 10 clinical epilepsy patients was collected for verification, with a total recording time of about 83 hours, including 34 epileptic seizures, and a total of 154,458 single-channel intracranial EEG signal samples. The verification results show that the average warning sensitivity (Sensitivity, Sn) of a single patient reaches 89.1%, and the false alarm rate (False Predicting Rate, FPR) per hour is less than 0.104. Compared with existing methods, the average Sn was improved by at least 4%, indicating that the model can provide more effective epileptic seizure warning for individual patients, which is of great significance for clinical epileptic seizure warning and intracranial single-channel neural regulation. Summary of the invention

[0006] The purpose of the present invention is to provide a single-channel epileptic seizure warning method based on deep double cross metric learning, focusing on the use of single-channel intracranial electroencephalography (iEEG) data for epileptic seizure warning, aiming to provide new technical support for clinical epileptic seizure warning, and belonging to the field of signal processing and pattern recognition technology. The method of the present invention was verified on single-channel iEEG data of the intracranial anterior nucleus of the thalamus of 10 patients with focal epilepsy collected clinically. The total recording time of the acquired iEEG signal is about 83 hours, including 34 epileptic seizures. Professional clinicians provided annotations for the interictal period, preictal period and ictal period. In the interictal, preictal and ictal warning tasks of a single patient, multiple evaluation indicators are better than the existing methods, showing that the model has good warning performance and generalization performance.

[0007] To achieve the above object, the present invention provides a single-channel epileptic seizure early warning method based on deep double cross metric learning, comprising the following steps:

[0008] Step 1: Preprocess the collected intracranial single-channel iEEG data. First, preprocess the collected signal data, mainly including: 1) using a notch filter to remove the power frequency interference in the signal; 2) resampling the signal to 256Hz; 3) using a sliding window to divide the signal data.

[0009] Step 2: Use the Pytorch deep learning framework to build a single-channel epileptic seizure warning model based on deep dual cross metric learning.

[0010] Step 3: Train the single-channel epilepsy seizure warning model of deep double cross metric learning based on the preprocessed intracranial single-channel iEEG data. Input the preprocessed data set in step 1 into the single-channel epilepsy seizure warning model of deep double cross metric learning constructed in step 2 to train the epilepsy seizure warning model. After waiting for the training to complete, save the model parameters.

[0011] Step 4: Post-processing of epileptic seizure warning. When the continuous iEEG signals in the test set are input into the trained model, the model will output the probability of the pre-seizure period. Next, a sliding average filter is applied to reduce the fluctuation of the warning and obtain the smoothed probability. When the smoothed probability exceeds a fixed threshold, the time warning device will issue an emergency warning of epileptic seizure to patients in the pre-seizure period. If the warning time is between 15 minutes before the actual seizure and 30 seconds after the onset of the seizure, it is judged as a correct warning; otherwise, it is judged as a wrong warning.

[0012] Step 5: Model performance testing and evaluation. Load the model parameters saved in step 3 to obtain the trained epilepsy attack warning model, then test the model performance and output the epilepsy attack warning results.

[0013] The main advantages of the single-channel epileptic seizure early warning method based on deep dual cross metric learning provided by the present invention include:

[0014] 1. Construct dual cross-graph attention and establish the time-frequency graph dependency between multi-scale time domain features and multi-rhythm spectrum features. This enables the model to effectively utilize the time-frequency correlation information in single-channel iEEG and enhance the difference between pre-ictal and interictal features.

[0015] 2. A routing Transformer network with a multi-head self-attention mechanism and an adaptive sparse multi-head attention matrix is ​​used to condense the high-order neural activity features most relevant to epileptic seizures, remove redundant information, and ensure that the model extracts global and local key features.

[0016] 3. Develop a hard triplet metric learning strategy to iteratively optimize the intra-class and inter-class distances of triplet samples (including anchor points, interictal and preictal representations) by calculating the distance metric matrix, so as to promote the effective fitting of the model to single-channel iEEG small sample data. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flow chart of a single-channel epileptic seizure warning method based on deep dual cross metric learning of the present invention;

[0018] Figure 2 It is a schematic diagram of the structure of the dual cross-graph attention module based on single-channel intracranial EEG iEEG;

[0019] Figure 3 Schematic diagram of the module structure of the routing Transformer network based on the multi-head self-attention mechanism;

[0020] Figure 4 AUC results of different components in the model compared in the ablation experiment;

[0021] Figure 5 This is a diagram comparing the ablation Sn results of different components in the ablation experiment model. DETAILED DESCRIPTION

[0022] The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings of the present invention.

[0023] In the present invention, as shown in Table 1, single-channel iEEG was collected clinically from 10 patients with focal epilepsy on deep intracranial electrodes implanted in the anterior nucleus of the thalamus (ANT), with a sampling frequency of 256 Hz. These patients with focal epilepsy included male and female individuals aged 16 to 31 years, and the total recording time of the acquired iEEG signals was approximately 83 hours, including 34 epileptic seizures. Professional clinicians provided annotations for the interictal period, preictal period, and ictal period. The preictal period is usually defined as 15 minutes before the onset of epileptic seizures, while the interictal period is defined as at least 2 hours before the onset and after the termination of the last seizure. The number of samples per patient ranged from 7784 to 48447. This study was approved by the Ethics Committee of Xuanwu Hospital, Capital Medical University, Beijing (approval number: LYS2018041), followed the ethical standards of the Declaration of Helsinki, and all patients signed informed consent.

[0024] Table 1: Detailed information of Xuanwu Hospital single-channel intracranial EEG dataset

[0025]

[0026] The overall process of the single-channel epilepsy attack warning method based on deep dual cross metric learning according to an embodiment of the present invention is as follows: Figure 1 As shown, it includes:

[0027] Step 1: Preprocess the collected intracranial single-channel iEEG data:

[0028] 1) Use notch filters to remove power frequency interference in the frequency bands of 60Hz, 120Hz, 180Hz, 240Hz, 300Hz, 360Hz, 420Hz, and 480Hz to further optimize signal quality;

[0029] 2) All signals were uniformly resampled to 256 Hz to ensure that the sampling rate of each patient's data was consistent, thereby ensuring the consistency of the length of the neural network input data, which facilitated the subsequent unified model training;

[0030] 3) The sliding window method was used to segment the original single-channel iEEG signal into segments of 5 seconds in length, and these segments were defined as iEEG samples to retain sufficient temporal information for feature extraction and classification.

[0031] Step 2: Construct a single-channel epileptic seizure warning model with deep dual-cross metric learning. The model includes a dual-cross graph attention module, a routing Transformer module, and a metric learning strategy based on hard triplet optimization. The details are as follows:

[0032] 1) Dual Cross-Graph Attention Module

[0033] Single-channel intracranial iEEG contains rich time-frequency characteristics. In order to capture the interactive relationship in time-frequency information, such as Figure 2 As shown, a dual cross-graph attention network is designed to establish the time-frequency graph dependency between scale and rhythm.

[0034] First, multi-scale dilated convolution and multi-rhythm power spectrum density (PSD) are used to extract the time-frequency features of single-channel iEEG from multiple time scales and frequency rhythms. The epileptic single-channel iEEG sample is represented as X ieeg ∈R 1×T (R a×b represents a real number vector with a rows and b columns), T represents the sampling point of the signal. When extracting time domain features, a multi-scale dilated convolution containing u parallel dilated convolution layers is used to capture multi-scale time domain features. The dilation rate of the kth (k=1,2,…,u) dilated convolution is determined by (u+1)-k. C and D S When extracting frequency domain features, we use polyrhythm PSD from X based on the five clinically recognized frequency sub-bands: δ (0-4 Hz), θ (4-8 Hz), α (8-12 Hz), β (12-30 Hz) and γ (30-50 Hz). ieeg ∈R 1×T The spectral features of five rhythms are extracted. The PSD of each rhythm is calculated by It is estimated that is obtained by short-time Fourier transform from X ieeg The derived frequency signal, Refers to The power spectral density value of E[·] represents the expected value calculation. Therefore, the spectral characteristics of polyrhythms It is obtained by combining the PSD estimates of the five subbands, where D R is the output dimension of the spectral feature map.

[0035] Then, we design a dual cross-graph attention to build a multi-scale temporal feature F S With the multi-rhythm spectrum feature F R In the cross attention, the global query Q is first calculated using the global extraction unit g and key K g .

[0036]

[0037] Among them, GSA(·) represents the global self-attention unit, LN(·) represents layer normalization, and Concat(·) represents the concatenation operation. belongs to the global weight matrix, d K is a hyperparameter, and [a,b] represents a matrix with one row and two columns consisting of a and b. In addition, a dual cross-attention module is designed, including a scale-cross attention unit and a paired rhythm-cross attention unit, to learn the interaction of global-local information and the relationship between paired rhythms, respectively. The local value V of the global-local scale-cross attention unit l and the rhythmic Q in paired rhythmic cross-attention units R ,K R ,V R It can be defined as follows:

[0038]

[0039] in, is the local weight matrix, is the rhythm weight matrix, d V represents the hyperparameter, and [a,b,c] represents a matrix of one row and three columns consisting of a, b, and c. Therefore, the output A of the scale-spanning attention unit S and paired rhythms across attention units A R The outputs of these two units are calculated as follows:

[0040]

[0041] in, and are the cross-attention scale features and rhythm features of the output, W S and W R It is a fully connected layer. Before performing graph convolution, randomly initialize an adjacency matrix M∈R C×C , used to learn the graph attention weighted module relationship. Then, the matrix is ​​sparsely encoded:

[0042]

[0043] in, is the vector obtained by rearranging the matrix M, R (C×C)×1 Represents a real vector with (C×C) rows and one column. denote the encoding matrices of the two fully connected layers. r denotes the reduction ratio, δ(·) and σ(·) denote the exponential linear unit (ELU) and the rectified linear unit (ReLU), respectively. Rearrange to R (C×C) , generate the encoding adjacency matrix M for graph attention weighting A ∈R (C×C) , where M A The (i,j)th element a in ijis learnable and represents the dependency between the i-th and j-th coupled components.

[0044] Afterwards, the scale feature map A is transformed using scale compression-excitation and point-by-point convolution blocks. S and rhythm characteristics diagram A R Operate to obtain the output time-frequency graph characteristics through the following equation

[0045] A′ S =ρ(σ(GAP(A S )W ex1 )W ex2 )⊙A S (7),

[0046]

[0047] G f =Con(G S +G R ) (10),

[0048] Among them, GAP(·) represents global average pooling, W ex1 ,W ex2 is the incentive operation F ex In addition, ρ(·) represents the Sigmoid activation function, ⊙ represents the element-wise multiplication, is a scale-weighted feature map. In addition, refers to The inverse matrix of is the degree matrix, is the weight matrix of the point-wise convolution kernel, Represent the hidden time graph features and spectrum graph features, corresponding to the output of the scale compression-excitation block and the point-by-point convolution block. S and G R After splicing, the aggregated time-frequency graph representation G is obtained f .

[0049] 2) Routing Transformer module

[0050] like Figure 3 As shown in Figure 1, a routing Transformer module is constructed to optimize the routing features with the greatest epileptic seizure potential during the interictal and preictal periods, while eliminating irrelevant redundant information in the epileptic graph structure. The module includes a QK-level routing head, a QV-level routing head, and a KV-level routing head. For the input of each routing head The query Q, key K and value V can be obtained as follows:

[0051] [Q,K,V]=G f[W Q ,W K ,W V ] (11),

[0052] in, Corresponding to For the first QK-level routing head, perform regional pre-average operation on Q and K to obtain the regional query and key vector v Q ,v K ∈R C×1 Then, we multiply v by matrix multiplication. Q With the transposed v K Multiply them together to get the regional affinity matrix A r ∈R C×C , the elements of each row in the matrix are used to measure the semantic relevance of the self-attention region. Therefore, in order to retain the top-k routing regions with the greatest epileptic seizure potential, the affinity matrix A is pruned r , generate routing index matrix I r ∈R C×k , mainly achieved through the following methods:

[0053] I r =topkIndex(A r ) (12),

[0054] Among them, topkIndex(·) represents the Top-k index operation in the row direction, I r The i-th row of consists of the indices of the k most relevant elements in the i-th attention region. Next, the QK routing feature Z is calculated QK , as follows:

[0055]

[0056] V r =gather(V,I r ) (14),

[0057]

[0058] Among them, gather(a,b) means to perform sparse operation on a according to index matrix b, so A QK Based on I r The routing attention matrix obtained by attention pruning aggregation is V r is the routing value aggregated by routing area index, W QK is the fully connected layer weight of the QK-level routing head. Similarly, the other two routing features Z are obtained from the QV-level routing head and the KV-level routing head respectively. QV and Z KV .

[0059] Finally, the routing features are fused by adding a multi-layer perceptron, and the formula is as follows:

[0060]

[0061] in, and represents two fully connected layers in the MLP, σ(·) refers to the ReLU activation function, and FM(·) represents a feedforward module consisting of two feedforward layers and an ELU activation function. Therefore, the fused routing features can be obtained during the interictal and preictal periods.

[0062] 3) Metric learning module based on hard triplet optimization

[0063] Considering that the model training process on small-sample iEEG data is prone to overfitting, a metric learning module based on hard triplet optimization is developed to learn the distance between interictal and preictal features.

[0064] This module uses a metric learning strategy to iteratively optimize the triplets (including anchor points, positive samples, and negative samples), specifically including: Assume that each batch has N iEEG subject samples, consisting of n interictal periods and m preictal periods, and the entire sample set can be defined as X ieeg ={(x i ,y i )|i=1,2,...,N}, where represents the i-th interictal period or preictal period, and the vector length is k×d K ,y i is x i Then, the distance metric matrix M is constructed by D :

[0065]

[0066] Where N = n + m, d ij =||x i ,x j || 2 represents the Euclidean distance between the i-th and j-th sample representations. Next, based on the metric matrix M D Each row of gets a hard triplet. For the i-th anchor point Select and anchor points separately Representation of hard positive samples with the same label and maximum distance And the representation with the smallest distance from it (hard negative sample) therefore, and A hard triplet is formed, which is then optimized using the following triplet loss function:

[0067]

[0068] Among them, M ar Refers to the predefined margin parameter that controls the embedding distance between positive and negative samples. By minimizing the triplet loss L tr , which can ensure the optimal representation distance, while moderately reducing the intra-class distance and widening the inter-class distance. Based on the above metric learning strategy, the module finally uses supervised learning to distinguish the two epileptic states of interictal and preictal. This process is achieved through the cross entropy loss function:

[0069]

[0070] Among them, p i is the output probability of epilepsy warning in the ith iEEG trial. Then, by combining supervised learning and metric learning strategies, the proposed model is jointly trained and optimized through the following hybrid loss function:

[0071] L=αL tr +(1-α)L ce (20),

[0072] Here, α is a hyperparameter, which is usually set to 0.5 based on existing research.

[0073] Step 3: Train the single-channel epilepsy seizure warning model based on deep double cross metric learning based on the preprocessed intracranial single-channel iEEG data

[0074] During the training process, the leave-one-out cross-validation method is used to divide the data set preprocessed in step 1 for model training. The number of iterations of the leave-one-out cross-validation is determined by the total number of epileptic seizures N of the i-th individual. i In each leave-one-out cross-validation iteration, the N i -1 epileptic seizure interictal and preictal iEEG trials were combined for training, and the rest were used for testing. It should be noted that during the model training phase, due to the difference in the length of interictal and preictal periods, interictal trials were randomly downsampled to match the number of preictal trials.

[0075] Four evaluation indicators were used to test the proposed method, including the area under the curve (AUC), sensitivity (S n ), false alarm rate (FPR / h) and p-value. AUC mainly indicates the accuracy of distinguishing between interictal and preictal states. nrepresents the proportion of correctly warned epileptic seizures, that is, the proportion of correctly warned epileptic seizures to the total number of epileptic seizures. FPR / h represents the number of false alarms per hour, and the p-value is used to measure the significance of the improvement compared to random warnings, which can statistically evaluate whether the epilepsy warning system is better than random warnings. Use the above-obtained data set to warn of epileptic seizures in a single patient. Train and save the model parameters in sequence.

[0076] Step 4: Post-Epileptic Seizure Warning

[0077] When the continuous iEEG signal is input into the trained model, the output is the probability p of the pre-ictal period. i Next, for p i Use a sliding average filter to reduce the fluctuation of the warning and obtain the smoothed probability p s Once p s Exceeding the fixed threshold ω=0.6, at τ ω Time alarm within time T i Emergency epileptic seizure warnings will be issued to patients in the pre-seizure stage.

[0078] Step 5: Model performance testing and evaluation

[0079] Load the model parameters saved in step 3, and perform post-processing of the seizure warning in step 4. By inputting the test data divided in step 4 into the loaded model, we obtain the model performance test and evaluation results. The final results are shown in Table 2. From the warning results on the intracranial single-channel EEG signals of 10 epilepsy patients, it can be seen that the model proposed in the present invention has high warning sensitivity, AUC and low false alarm rate. In addition, the statistical p-value results in epilepsy seizure warning are also ideal. Except for patients 3 and 9, the p-values ​​of other patients are less than 0.01, which proves that the proposed method has achieved significant improvement and robustness.

[0080] Table 2: Seizure warning results for a single patient

[0081]

[0082] In addition, ablation experiments are performed on each innovative module of the proposed method to verify its effectiveness. Figure 4 and Figure 5 The predicted average AUC and sensitivity S of the proposed model and the sub-model without one of the innovative modules are shown respectively. n Performance comparison. Figure 4 As can be seen from the figure, when the dual cross-graph attention module is incorporated into the model, the average AUC of the proposed method increases significantly from 0.843 to 0.914. The model without routing Transformer only produces an average AUC of 0.872 and an average S n (like Figure 5 In addition, the metric learning module also played an important role in improving the overall performance, increasing the prediction AUC from 0.862 to 0.914 and the prediction S n Therefore, the above ablation experiment results prove the innovation and effectiveness of the three modules of dual cross-graph attention, routing transformer and ternary optimization metric learning proposed in the present invention.

[0083] The present invention selects four latest models for epileptic seizure warning and compares their overall performance. Including DCNN-Bi-LSTM (Hisham Daoud, Magdy A. Bayoumi, Efficient Epileptic Seizure Prediction Based on Deep Learning, 2019), CE-stSENet (Yang Li, Yu Liu, Epileptic Seizure Detection in EEG Signals Using a Unified Temporal-Spectral Squeeze-and-Excitation Network, 2020), TS-MS-DCNN (Yikai Gao, Xun Chen, Pediatric Seizure Prediction in Scalp EEG Using a Multi-Scale Neural Network With Dilated Convolutions, 2022), CLEP-STSNet (Lianghui Guo, Tao Yu, CLEP: Contrastive Learning for Epileptic Seizure Prediction Using a Spatio-Temporal-Spectral Network, 2023). These methods were compared in single-channel warning experiments with the same benchmark in this study. The experimental steps are consistent with the method proposed in the present invention, and the comparison of the average results of epilepsy warning is listed in Table 3. It can be seen from the table that compared with other deep learning methods, the method of the present invention has better early warning performance, with an average AUC of 0.914, while the average AUCs of DCNN-Bi-LSTM, CE-stSENet, TS-MS-DCNN and CLEP-STSNet are 0.789, 0.821, 0.841 and 0.851 respectively. These results prove that the method of the present invention has ideal robustness in distinguishing the interictal and pre-ictal states of different patients. In addition, it can be observed from Table 3 that the average early warning S nThey are 18.8%, 13.0%, 6.9% and 4.4% higher than the other four models, respectively, indicating that our model can provide more effective epileptic seizure warning for individual patients. The FPR / h indicators of DCNN-Bi-LSTM, CE-stSENet, TS-MS-DCNN and CLEP-STSNet reached 0.839, 0.581, 0.293 and 0.355 respectively, while the method of the present invention achieved the lowest average FPR / h of 0.104, which is at least 64.5% higher than the other four benchmark methods. Therefore, these evaluation indicators verify the excellent performance of the method of the present invention in the single-channel iEEG epileptic seizure warning task.

[0084] Table 3: Comparison of average results of epilepsy warning by different methods

[0085]

[0086] The bold values ​​indicate the best average results.

[0087] The above is a detailed description of the single-channel epilepsy attack warning method based on deep dual cross metric learning provided by the present invention, but it is obvious that the scope of the present invention is not limited to this. Various changes to the above embodiments are within the scope of the present invention without departing from the scope of protection defined by the attached claims.

Claims

1. A modeling method for a single-channel epileptic seizure warning model based on deep double cross metric learning, characterized in that include: A) constructing a dual cross-graph attention module, which includes a dual cross-graph attention network for establishing the time-frequency graph dependency between scale and rhythm and / or capturing the interaction relationship in the time-frequency information, including: A1) First, multi-scale dilated convolution and multi-rhythm power spectral density (PSD) are used to extract the time-frequency features of single-channel iEEG from multiple time scales and frequency rhythms. Denote the epilepsy single-channel iEEG sample as X ieeg ∈R 1×T , where R a×b represents a real number vector with rows and columns a), T represents the sampling point of the signal, When extracting time domain features, a multi-scale dilated convolution containing u parallel dilated convolution layers is used to capture multi-scale time domain features. Where k = 1, 2, ..., u, the dilation rate of the kth dilated convolution is determined by (u+1)-k, C and D S are the dimensions of the time domain feature map, When extracting frequency domain features, polyrhythmic PSD is used to extract the frequency domain features from X based on five frequency sub-bands, namely (0-4 Hz δ, (4-8 Hz θ, (8-12 Hz α, (12-30 Hz β and (30-50 Hz γ). ieeg ∈R 1×T The spectrum features of five frequency sub-bands are extracted, where the PSD of each frequency sub-band is obtained by It is estimated that is obtained by short-time Fourier transform from X ieeg The derived frequency signal, Refers to The power spectral density value of E[·] represents the expected value calculation, so the spectral characteristics of polyrhythms Where D R is the output dimension of the spectral feature map, A2) Establish dual cross-graph attention and establish multi-scale temporal features F S With the multi-rhythm spectrum feature F R The time-frequency diagram dependencies between include: In criss-cross attention, the global query Q is first calculated using the global extraction unit g and key K g : Among them, GSA(·) represents the global self-attention unit, LN(·) represents layer normalization, and Concat(·) represents the concatenation operation. belongs to the global weight matrix, d K is a hyperparameter, [a,b] represents a matrix with one row and two columns consisting of a and b. A3) establishing a dual cross-attention module, comprising a scale-cross-attention unit for learning the interaction of global-local information and a paired rhythm-cross-attention unit for learning the relationship between paired rhythms, The local value V of the global-local scale cross attention unit l and the rhythmic Q in paired rhythmic cross-attention units R ,K R ,V R Characterized as: in, is the local weight matrix, is the rhythm weight matrix, d V represents hyperparameters, [a,b,c] represents a matrix with one row and three columns consisting of a, b, and c. Thus, the output A of the scale-spanning attention unit S and paired rhythms across attention units A R They are characterized as: in, and are the output cross-attention scale features and rhythm features, W S and W R is a fully connected layer, A4) Before performing graph convolution, randomly initialize an adjacency matrix M∈R C×C , used to learn graph attention weighted module relations, Then, the adjacency matrix is ​​sparsely encoded: in, is the vector obtained by rearranging the matrix M, R (C×C)×1 represents a real vector with (C×C) rows and one column, denote the encoding matrices of the two fully connected layers, r denotes the reduction ratio, δ(·) and σ(·) denote the exponential linear unit ELU and the rectified linear unit ReLU, respectively. Will Rearrange to R (C×C) , generate the encoding adjacency matrix M for graph attention weighting A ∈R (C×C) , where M A The (i,j)th element a in ij is learnable and represents the dependency between the i-th and j-th coupled components. A5) After that, we use scale compression-excitation and point-wise convolution blocks to perform cross-attention on the scale feature map A S and rhythm characteristics diagram A R Operate to obtain the output time-frequency graph characteristics through the following formula A′ S =ρ(σ(GAP(A S )W ex1 )W ex2 )⊙A S (7), G f =Con(G s +G R ) (10), Among them, GAP(·) represents global average pooling, W ex1 ,W ex2 is the incentive operation F ex In the two fully connected layers, ρ(·) represents the Sigmoid activation function, ⊙ represents the element-wise multiplication, is the scale-weighted feature map, refers to The inverse matrix of is the degree matrix, is the weight matrix of the point-wise convolution kernel, Represent the hidden time graph features and spectrum graph features, corresponding to the output of the scale compression-excitation block and the point-by-point convolution block. S and G R After splicing, the aggregated time-frequency graph representation G is obtained f , B) Constructing a routing Transformer module to optimize the routing features with the greatest potential for epileptic seizures during the interictal and preictal periods, while eliminating irrelevant redundant information in the epileptic graph structure. The routing Transformer module includes a QK-level routing head, a QV-level routing head, and a KV-level routing head, including: B1) Input for each of the QK-level routing head, QV-level routing head and KV-level routing head The query Q, key K and value V can be obtained as follows: [Q,K,V]=G f [W Q ,W K ,W V ] (11), in, Corresponding to The projection weight, For the first QK-level routing head, perform regional pre-average operation on Q and K to obtain the regional query and key vector v Q ,v K ∈R C×1 , B2) Then, through matrix multiplication, v Q With the transposed v K Multiply them together to get the regional affinity matrix The elements of each row in the matrix are used to measure the semantic relevance of the self-attention region. In order to retain the top-k routing regions with the greatest epileptic potential, the affinity matrix is ​​pruned Generate routing index matrix This is accomplished by: Among them, topkIndex(·) represents the Top-k index operation in the row direction. The i-th row of consists of the indices of the most relevant k elements in the i-th attention region, B3) Next, calculate the QK routing feature Z QK ,include: Where: gather(a,b) means to perform sparse operation on a according to index matrix b, so that A QK is based on The routing attention matrix obtained by attention pruning aggregation is is the routing value aggregated by routing area index, W QK is the fully connected layer weight of the QK-level routing head, Get routing characteristics from QV-level routing head Get routing characteristics from KV-level routing header B4) Finally, the routing features are fused by adding a multi-layer perceptron, and the formula is as follows: in, and represents two fully connected layers in the MLP, σ(·) refers to the ReLU activation function, and FM(·) represents a feedforward module consisting of two feedforward layers and an ELU activation function, thereby obtaining fused routing features during the interictal and preictal periods. C) Construct a metric learning module based on hard triplet optimization to learn the distance between interictal and preictal features to overcome the overfitting problem in the training process on small sample iEEG data, including: C1) Iteratively optimize the triples including anchor points, positive samples and negative samples using the metric learning strategy, including: Assume that each batch has N iEEG test samples, consisting of n interictal periods and m preictal periods. The entire sample set can be defined as X ieeg ={(x i ,y i )|i=1,2,...,N}, where represents the i-th interictal period or preictal period, and the vector length is k×d K ,y i is x i The category label of The distance metric matrix M is constructed by D : Where N = n + m, d ij =||x i ,x j ||2 represents the Euclidean distance between the i-th and j-th sample representations Next, based on the metric matrix M D Each row of gets a hard triplet, where for the i-th anchor point Select and anchor points separately Representation of hard positive samples with the same label and maximum distance And the hard negative sample representation with the smallest distance from it with different labels thereby and A hard triplet is formed, which is then optimized using the following triplet loss function: Among them, M ar refers to the predefined margin parameter used to control the embedding distance between positive and negative samples by minimizing the triplet loss L tr , ensuring the optimal representation distance, while moderately reducing the intra-class distance and widening the inter-class distance. C2) Based on the above metric learning strategy, supervised learning is used to distinguish the two epileptic states of interictal and preictal. This distinction operation is performed through the cross entropy loss function L ce accomplish: Among them, p i is the output probability of epilepsy warning in the ith iEEG trial. By optimizing the model parameters, L ce Gradually converges, so that p i The output probability of more accurately predicts and / or distinguishes the categories of interictal and preictal periods, C3) Then, by combining supervised learning and metric learning strategies, the proposed model is jointly trained and optimized via the following hybrid loss function: L=αL tr +(1-α)L ce (20), Among them, α is a hyperparameter, L is the final mixed total loss, and all parameters of the training model are continuously optimized by reducing the L value until the model converges to obtain the trained optimal model.

2. The modeling method of the single-channel epilepsy attack warning model according to claim 1, characterized in that: α is set to 0.

5.

3. A single-channel epileptic seizure warning method based on deep double cross metric learning, characterized in that include: Step 1: Preprocess the collected intracranial single-channel iEEG data; Step 2: Execute the modeling method of the single-channel epileptic seizure warning model according to claim 1 or 2; Step 3: training the constructed single-channel epileptic seizure warning model; Step 4: Post-process the single-channel epileptic seizure warning model.

4. The single-channel epilepsy attack warning method according to claim 3, characterized in that Further including: Step 5: Model performance testing and evaluation.

5. The single-channel epilepsy attack warning method according to claim 3, characterized in that The step 1 comprises: Use notch filters to remove power frequency noise in the frequency bands of 60Hz, 120Hz, 180Hz, 240Hz, 300Hz, 360Hz, 420Hz, and 480Hz; The intracranial single-channel iEEG data were resampled to ensure that the sampling rate of each patient's data was consistent; The sliding window is used to divide the data into segments and generate time series input samples to facilitate feature extraction and classification.

6. The single-channel epilepsy attack warning method according to claim 3, characterized in that The step 3 comprises: The preprocessed single-channel iEEG data were divided into training set and test set according to the single-subject leave-one-out cross-validation method. The Adam optimizer is used to optimize the model parameters, set the training batches, and adjust the model parameters according to the loss optimization after each round of training.

7. The single-channel epilepsy attack warning method according to claim 3, characterized in that The step 4 comprises: The continuous iEEG signals in the test set are input into the trained model, and the probability of the pre-seizure period of the warning is output. Then, a sliding average filter is used to reduce the fluctuation of the warning value to obtain a smoothed probability curve. When the probability exceeds the set fixed threshold, a time alarm is used to issue an emergency warning of epileptic seizure to patients in the pre-seizure period. If the warning time is between 15 minutes before the actual onset and 30 seconds after the onset of the onset, it is considered a correct warning; otherwise, it is considered a false warning.

Citation Information

Cited By

  • Three-dimensional brain network dynamic segmentation method based on deep learning

    CN120689619A