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

By combining the unsupervised domain alignment mechanism of Euclidean alignment and second-order Wasserstein distance with an improved Softmax classification loss, a lightweight neural network is optimized to solve the problems of low accuracy and high deployment cost in cross-patient prediction of epileptic EEG signals, and achieve efficient epileptic seizure prediction on resource-constrained devices.

CN120678385AActive Publication Date: 2025-09-23TIANJIN UNIV
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202510758811.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-09
Publication Date
2025-09-23
Estimated Expiration
2045-06-09

AI Technical Summary

Technical Problem

Existing cross-patient prediction of epileptic EEG signals suffers from problems such as low prediction accuracy under conditions of a small number of samples, poor model generalization, and high deployment cost. In particular, it is difficult to achieve real-time online epileptic seizure prediction on resource-constrained embedded devices.

Method used

A cross-patient epileptic seizure prediction method based on joint domain adaptation is adopted. Through the unsupervised domain alignment mechanism of Euclidean alignment and second-order Wasserstein distance, combined with the improved Softmax classification loss, a lightweight neural network model is optimized to achieve effective migration and feature alignment between the source domain and the target domain.

Benefits of technology

Under the condition of a small number of EEG signal samples, the cross-patient adaptability and predictive performance of the neural network model are significantly improved, the acquisition and annotation costs of customized neural network models for new patients are reduced, and it is adapted to lightweight deployment and suitable for resource-constrained embedded terminals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120678385A_ABST
    Figure CN120678385A_ABST
Patent Text Reader

Abstract

The invention provides a cross-patient epileptic seizure prediction method and system based on joint domain adaptation and a medium. The method comprises the following steps: preprocessing electroencephalogram signals of a source domain and a target domain; respectively calculating respective average covariance matrixes for the preprocessed electroencephalogram signals of the source domain and the target domain, and carrying out Euclidean alignment processing on the electroencephalogram signals of the corresponding domain based on the corresponding average covariance matrixes; inputting the electroencephalogram signals subjected to Euclidean alignment processing into a neural network for feature extraction; in the high-dimensional feature space, calculating a second-order Warisstein distance between a source domain and a target domain, and defining the second-order Warisstein distance as unsupervised domain alignment loss Ld; an improved Softmax classification loss Lc is introduced, and nonlinear boundary adjustment is applied to the original score of the electroencephalogram signal sample on the real category of the electroencephalogram signal sample; and taking L as an overall loss function, L = Lc + lambda * Ld, executing back propagation by using an AdamW optimizer, and updating parameters of the neural network. According to the method, the cross-patient adaptability and prediction performance of the neural network model can be improved.
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 a method, system and medium for cross-patient epileptic seizure prediction based on joint domain adaptation. Background Art

[0002] Epilepsy is a neurological disease characterized by transient brain dysfunction caused by abnormal discharges of brain neurons. Monitoring and analysis of electroencephalogram (EEG) signals is an important means of diagnosing epileptic seizures. Traditional methods for detecting epilepsy EEG signals usually train specific models for each patient (patient-specific models), but the performance of such methods decreases significantly when applied to new patients and they cannot be effectively generalized. The main reason is that epilepsy EEG signals are non-stationary and that EEG signal patterns vary greatly between patients. To improve the versatility and clinical applicability of epilepsy EEG signal prediction models, transfer learning technology has been introduced into epilepsy EEG signal analysis. Transfer learning uses the EEG data of existing patients (source domain) to help analyze the EEG data of new target patients (target domain), effectively solving the problem of feature differences in EEG signals across patients and improving the model's prediction performance on target patients.

[0003] However, current transfer learning techniques still face several challenges. Existing methods typically require extensive training data from one or more source domains, and most cross-patient domain adaptation methods require abundant labeled samples from both the source and target domains. In actual clinical applications, obtaining sufficient labeled epileptic EEG signal samples for new patients is often difficult. Furthermore, in epilepsy detection tasks, the number of positive samples (EEG signals during epileptic seizures) is far lower than the number of negative samples (EEG signals during non-seizures), which can easily lead to majority class bias during alignment or pseudo-labeling, resulting in decreased seizure detection accuracy. Simply aligning the feature distributions of the source and target domains can lead to confusion between features of different categories, lacking clear constraints on seizure classification, and resulting in insufficient model prediction performance. Furthermore, deep domain adaptation networks typically have a large number of parameters and high computational complexity, resulting in high deployment overhead and difficulty running in real time on resource-constrained embedded devices. These issues can lead to insufficient model training under the small number of clinical samples, resulting in decreased classification accuracy and difficulty in effectively supporting the demand for real-time online epileptic seizure prediction. Summary of the Invention

[0004] The present invention aims to solve the problems of low prediction accuracy, poor model generalization, and high deployment cost in the existing cross-patient prediction of epileptic EEG signals under the conditions of a small number of samples. It provides a cross-patient epileptic seizure prediction method, system and medium based on joint domain adaptation, which realizes the effective migration of source domain and target domain under the condition of the participation of a small number of EEG signal samples, thereby improving the cross-patient adaptability and prediction performance of the neural network model.

[0005] To achieve the above objectives, the present invention proposes the following technical solutions:

[0006] One aspect of the present application proposes a cross-patient epileptic seizure prediction method based on joint domain adaptation, comprising the following steps:

[0007] Step 1: Preprocess the EEG signals of the source domain and the target domain;

[0008] Step 2: Calculate the mean covariance matrices of the source and target domain EEG signals after processing in step 1, perform Euclidean alignment on the source domain EEG signals based on the mean covariance matrix of the source domain, and perform Euclidean alignment on the target domain EEG signals based on the mean covariance matrix of the target domain, and normalize the mean covariance matrices of the source and target domain EEG signals to unit matrices.

[0009] Step 3: Input the EEG signal after Euclidean alignment into the neural network for feature extraction to obtain high-dimensional feature representation for subsequent analysis;

[0010] Step 4: In the high-dimensional feature space, calculate the second-order Wasserstein distance between the source domain and the target domain to measure the distribution difference between the source domain and the target domain, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L d , achieving unsupervised alignment of high-dimensional features by minimizing domain alignment loss;

[0011] Step 5: Introduce the improved Softmax classification loss L c , by applying nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved;

[0012] Step 6: Use L as the overall loss function, L = L c +λ·L d ,λ is used to balance the classification loss L c With domain alignment loss L d The hyperparameters of the neural network are updated by performing backpropagation using the AdamW optimizer.

[0013] In some embodiments, in step 1, the preprocessing includes bandpass filtering, power frequency notching, normalization, and category balancing processing; the category balancing processing refers to undersampling the EEG signals between epileptic seizures to achieve a quantitative balance with the EEG signals before the epileptic seizure.

[0014] In some embodiments, in step 2, the source domain and target domain EEG signals are respectively calculated using formula (1) to calculate their respective average covariance matrices:

[0015]

[0016] Among them, X i is the i-th EEG signal sample matrix, For X i The transposed matrix of , N is the total number of EEG signal samples;

[0017] For the source domain EEG signal sample matrix X s Applying Euclidean alignment, we get X′ s :

[0018] X′ s =R s -1 / 2 X s (2)

[0019] For the target domain EEG signal sample matrix X t Applying Euclidean alignment, we get X′ t :

[0020] X′ t =R t -1 / 2 X t (3)

[0021] Among them, the source domain EEG signal sample matrix X s And the target domain EEG signal sample matrix X t are all known quantities, R s represents the mean covariance matrix of the source domain EEG signal, R t represents the average covariance matrix of the target domain EEG signal, R s -1 / 2 and R t -1 / 2 is the square root inverse matrix of the corresponding matrix.

[0022] In some embodiments, in step 3, EEGNet or ConvNet is selected as the neural network model for feature extraction.

[0023] In some embodiments, in step 4, the second-order Wasserstein distance domain alignment loss L d The formula is as follows:

[0024]

[0025] Among them, μ s 、μ t are the means of the source domain and target domain features, respectively, ||μ s -μ t || 2 represents the square of the Euclidean distance between the feature means of the source domain and the target domain, ∑ s ,∑ tare the covariance matrices of the source domain and target domain features, Tr(·) represents the trace operation of the matrix, (·) 1 / 2 Represents the principal square root of a symmetric positive definite matrix.

[0026] In some embodiments, in step 5, the nonlinear boundary adjustment includes: when the original score is positive, scaling the original score and subtracting the boundary parameter; when the original score is non-positive, weighting and amplifying the original score and also subtracting the boundary parameter.

[0027] In some embodiments, define F i (c)* represents the score of the ith EEG signal sample after applying boundary adjustment to its true category c, F i (c)* for:

[0028]

[0029] The improved Softmax classification loss function L c for:

[0030]

[0031] Among them, F i (c) and They represent the original scores of the i-th EEG signal sample in its true category c and other categories j, respectively. m ≥ 1 and k ≥ 0 are boundary control hyperparameters, and N is the total number of EEG signal samples.

[0032] In some embodiments, in step 6, during the parameter optimization process, the AdamW optimizer is used to perform back propagation update on the neural network parameters θ, and the model parameters updated by back propagation are:

[0033]

[0034] Among them, α represents the learning rate, G θ represents a neural network with θ as a parameter, L(G θ ) is the overall loss of the neural network with θ as a parameter, is the gradient operator, which means that the partial derivatives of all components of the parameter θ are obtained separately, and the obtained gradient vector is used for back propagation and update of the parameters.

[0035] Another aspect of the present application proposes a cross-patient epileptic seizure prediction system based on joint domain adaptation constructed based on the above method, comprising:

[0036] A preprocessing module is used to preprocess the EEG signals of the source domain and the target domain, wherein the preprocessing includes bandpass filtering, power frequency notching, normalization, and class balancing processing; the class balancing processing refers to undersampling the EEG signals between epileptic seizures to achieve a balance in number with the EEG signals before the epileptic seizure;

[0037] A Euclidean alignment module is used to calculate the mean covariance matrix of the source domain and target domain EEG signals after being processed by the preprocessing module, and perform Euclidean alignment processing on the source domain EEG signals based on the mean covariance matrix of the source domain, and perform Euclidean alignment processing on the target domain EEG signals based on the mean covariance matrix of the target domain, and normalize the mean covariance matrices of the source domain and target domain EEG signals to unit matrices;

[0038] an EEG feature extraction module, configured to input the EEG signal processed by the Euclidean alignment module into a neural network for feature extraction, so as to obtain a high-dimensional feature representation for subsequent analysis;

[0039] The feature alignment module is used to calculate the second-order Wasserstein distance between the source domain and the target domain in the high-dimensional feature space to measure the distribution difference between the source domain and the target domain, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L d , by minimizing the domain alignment loss L d Achieve unsupervised alignment of high-dimensional features;

[0040] Discriminative learning module, used to introduce improved Softmax classification loss L c , by applying nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved;

[0041] The overall loss optimization and update module is used to use L as the overall loss function, L = L c +λ·L d ,λ is used to balance the classification loss L c With domain alignment loss L d The hyperparameters of the neural network are updated by performing backpropagation using the AdamW optimizer.

[0042] The present application also proposes a computer-readable storage medium storing computer program instructions, which, when executed by a processor, execute the steps of the above-mentioned cross-patient epileptic seizure prediction method based on joint domain adaptation.

[0043] The cross-patient epileptic seizure prediction method, system and medium involved in this application based on joint domain adaptation can achieve the following

[0044] Beneficial effects:

[0045] (1) Improving cross-patient prediction capabilities: This application constructs a universal and extensible cross-patient epileptic seizure prediction framework based on joint domain adaptation, which combines the unsupervised domain alignment mechanism of Euclidean alignment and second-order Wasserstein distance to effectively alleviate the feature distribution differences between the source domain and the target domain, and cooperates with the improved Softmax classification loss to enhance the inter-class discrimination and intra-class aggregation of features. Under the condition that both the source domain and the target domain contain only a small number of labeled EEG signal samples, it can still achieve efficient prediction of epileptic EEG signals, significantly improving the generalization ability and robustness of the neural network model.

[0046] (2) Reduce the acquisition and labeling costs of customized neural network models for new patients: Through the joint optimization strategy of domain alignment loss and Softmax classification loss proposed in this application, only a small number of labeled EEG signal samples from the source domain and the target domain are needed to complete the training of the neural network model. This fully meets the practical difficulties in the medical environment where labeled EEG signals are difficult to obtain in large quantities, significantly reduces the burden of patient data acquisition and manual labeling, reduces the manpower and time costs required for personalized customization of neural network models, and enhances the operability of the above method in clinical applications.

[0047] (3) Adaptable to lightweight deployment and good practicality: This application is designed as a general structure that can flexibly carry a variety of lightweight neural networks (such as EEGNet, ConvNet, etc.), with good modularity and compatibility. It can not only ensure the effectiveness of feature extraction, but also significantly reduce the number of parameters and computing overhead. It is suitable for resource-constrained embedded terminals and real-time epilepsy monitoring equipment, and has excellent engineering adaptability and promotion and application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A flowchart of a cross-patient epileptic seizure prediction method based on joint domain adaptation provided in an embodiment of the present invention.

[0049] Figure 2 A comparison chart of classification performance evaluation indicators for each patient under different neural network models provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to more clearly illustrate the purpose, technical solutions and advantages of the present invention, the present invention is described in detail below in conjunction with specific embodiments and drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the scope of protection of the present invention.

[0051] In cross-patient EEG analysis, there are often large differences in the EEG signal distribution (especially the covariance structure) of different subjects, which will reduce the generalization ability of the general neural network model. Therefore, it is necessary to improve the generalization ability of the neural network model through the cross-patient epileptic seizure prediction method based on joint domain adaptation involved in this application.

[0052] like Figure 1 As shown, the cross-patient epileptic seizure prediction method based on joint domain adaptation involved in this application includes the following steps:

[0053] Step 1: Preprocess the EEG signals of the source domain and the target domain.

[0054] The preprocessing includes bandpass filtering (0.5-70 Hz), power frequency notching, normalization, and class balancing, etc. The class balancing refers to undersampling the EEG signals between epileptic seizures to achieve a balance in number with the EEG signals before the onset of epileptic seizures.

[0055] In order to alleviate the imbalance problem of positive and negative sample ratio in epileptic EEG signal samples, this application performs undersampling of EEG signal samples between epileptic attacks to make their number equal to the number of EEG signal samples before epileptic attacks. Specifically, first count the number of EEG signal samples before epileptic attacks in the EEG signal data of the target patient, N. preictal , and then randomly extract the same number of EEG signal samples N from the EEG signal samples between epileptic seizures interictal , N interictal =N preictal, This forms a class-balanced dataset.

[0056] Step 2: Calculate the mean covariance matrices of the source and target domain EEG signals after processing in step 1, and perform Euclidean alignment on the source domain EEG signals based on the mean covariance matrix of the source domain, and perform Euclidean alignment on the target domain EEG signals based on the mean covariance matrix of the target domain, and normalize the mean covariance matrices of the source and target domain EEG signals to unit matrices.

[0057] Euclidean alignment is used to process the EEG signals of the source and target domains to unify the covariance structures of the two domains. Specifically, the mean covariance matrix of the EEG signals of the source and target domains is calculated using formula (1):

[0058]

[0059] Among them, X i is the i-th EEG signal sample matrix, For X i The transposed matrix of , N is the total number of EEG signal samples.

[0060] Then the source domain EEG signal sample matrix X s Apply Euclidean alignment (matrix whitening) to obtain X′ s :

[0061] X′ s =R s -1 / 2 X s (2)

[0062] For the target domain EEG signal sample matrix X t Applying Euclidean alignment, we get X′ t :

[0063] X′ t =R t -1 / 2 X t (3)

[0064] Among them, the source domain EEG signal sample matrix X s And the target domain EEG signal sample matrix X t are all known quantities, R s represents the mean covariance matrix of the source domain EEG signal, R t represents the average covariance matrix of the target domain EEG signal, R s -1 / 2 and R t -1 / 2 is the square root inverse matrix of the corresponding matrix.

[0065] Step 3: Input the EEG signal after Euclidean alignment processing into the neural network G for feature extraction to obtain a high-dimensional feature representation for subsequent analysis.

[0066] Specifically, the EEG signal feature extraction strategy proposed in this application has good versatility and can be flexibly integrated into a variety of neural network structures including deep convolutional networks. In order to take into account both the extraction effect and the lightweight model, this embodiment uses EEGNet and ConvNet as neural network models for feature extraction. Among them, EEGNet adopts a deep separable convolution design, which can efficiently extract the time domain and spatial domain features of EEG signals; ConvNet is composed of modules such as convolutional layers, pooling layers and fully connected layers, which is suitable for step-by-step extraction and classification of multi-level features. The above-mentioned neural network model has a compact structure, a small number of parameters, and is easy to deploy in embedded devices. The EEG signal after Euclidean alignment is input into the neural network model G to extract high-dimensional features for subsequent classification.

[0067] Step 4: In the high-dimensional feature space, calculate the second-order Wasserstein distance between the source domain and the target domain to measure the distribution difference between the source domain and the target domain, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L d, by minimizing the domain alignment loss L d It achieves unsupervised alignment of high-dimensional features to guide the network to learn domain-invariant features.

[0068] Specifically, the present application further utilizes the second-order Wasserstein distance to achieve alignment of high-dimensional feature distributions between the source domain and the target domain. This distance metric acts on the intermediate feature representation extracted by the lightweight feature extraction network (neural network), and completes cross-domain feature alignment under unsupervised conditions by measuring the differences between the source domain and the target domain in second-order statistics such as mean and covariance. The second-order Wasserstein distance is based on optimal transmission theory and has a clear physical interpretation - that is, the energy required to migrate from the source domain feature distribution to the target domain distribution at the "least cost", so it is more complete and detailed in characterizing distribution differences than indicators based only on mean and variance. The above-mentioned measurement method also belongs to the unsupervised feature alignment strategy, does not rely on the target domain label, and can achieve more refined and effective domain alignment in the intermediate feature space. The present application minimizes it as a domain alignment loss to guide the neural network model to learn EEG signal feature representations with domain invariance.

[0069] The formula of the second-order Wasserstein distance domain alignment loss is as follows:

[0070]

[0071] Among them, μ s 、μ t are the means of the source domain and target domain features, respectively, ||μ s -μ t || 2 represents the square of the Euclidean distance between the feature means of the source domain and the target domain, ∑ s ,∑ t are the covariance matrices of the source domain and target domain features, Tr(·) represents the trace operation of the matrix, (·) 1 / 2 represents the principal square root of a symmetric positive definite matrix. By minimizing L d , prompting the network to learn consistent feature representations across patients.

[0072] Step 5: Introduce the improved Softmax classification loss L c By applying nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved, thereby enhancing the discriminability between categories and improving the feature aggregation within categories, thereby improving the discrimination ability of the neural network model in cross-domain scenarios.

[0073] Specifically, the adjusted score is transformed using different scaling factors and boundary parameters depending on whether the original score is positive or negative. The nonlinear boundary adjustment involves scaling the original score and subtracting the boundary parameter when the original score is positive, further widening the decision boundary distance between different categories. When the original score is negative, the original score is weighted and amplified, and the boundary parameter is also subtracted to enhance the ability to distinguish boundaries. This strategy effectively enhances the separability of inter-class features and compresses the distribution of intra-class features, enabling neural network models to possess stronger discriminative performance in cross-domain applications such as transfer learning.

[0074] In multi-classification tasks, the traditional Softmax loss function represents the predicted scores of each category in a probabilistic way. However, when faced with similar inter-class distributions or large inter-domain differences, its inter-class discrimination is insufficient and intra-class aggregation is not strong, which can easily cause feature confusion, especially in transfer learning scenarios. To this end, this application introduces an improved Softmax classification loss function with boundary adjustment capability. This loss function is an extended form designed based on the traditional Softmax. Its optimization target is still the cross-entropy loss, but by applying nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, an adaptive boundary mechanism is introduced to improve feature discriminability.

[0075] Specifically, let the feature vector output by the neural network be:

[0076] F i =G(X i ;θ) (5)

[0077] Among them, G is the neural network, θ is the neural network parameter, X i is the i-th EEG signal sample matrix, F i represents the feature vector of the ith EEG signal sample output by the neural network, F i (c) and They represent the original scores of the i-th EEG signal sample in its true category c and other categories j respectively. The above original scores are the linear outputs used for normalization calculation in the traditional Softmax loss and have not yet been normalized or adjusted by probability. i (c)* represents the score of the i-th EEG signal sample after applying boundary constraints on its true category c, F i (c)* for:

[0078]

[0079] Among them, m≥1 and k≥0 are boundary control hyperparameters. When m=1 and k=0, it degenerates into the original Softmax function.

[0080] When F i (c) When F is greater than 0, the neural network scales the original score and subtracts the boundary parameter. The neural network needs stronger discrimination ability to correctly classify, thereby widening the decision boundary between categories and strengthening the separation of different categories. i (c) When ≤0, the original score is weighted and amplified, and the boundary parameter is also subtracted to enhance its gradient response, so as to push it closer to the center of the class and improve the compactness within the class.

[0081] The improved Softmax classification loss function L c for:

[0082]

[0083] Where N is the total number of EEG signal samples.

[0084] Step 6: Use L as the overall loss function, L = L c +λ·L d ,λ is used to balance the classification loss L c With domain alignment loss L d The hyperparameters of θ are used, and backpropagation is performed using the AdamW optimizer to update the parameters θ of the neural network.

[0085] Finally, this application combines the aforementioned second-order Wasserstein distance domain alignment loss L d And the improved Softmax classification loss L c Perform joint optimization and define the overall loss function as:

[0086] L=L c +λ·L d (8)

[0087] Among them, λ is used to balance the classification loss L c With domain alignment loss L d hyperparameters.

[0088] During the parameter optimization process, this application uses the AdamW optimizer to back-propagate the neural network model parameters θ. The model parameters updated by back-propagation are:

[0089]

[0090] Among them, α represents the learning rate, G θ Represents a neural network with 0 as parameter, L(G θ ) is the overall loss of the neural network with θ as a parameter, is a gradient operator, representing the partial derivative of all components of parameter θ. The resulting gradient vector is used for parameter backpropagation and update. Through this approach, while minimizing the overall loss, the parameters of the neural network with θ as the parameter are continuously optimized, ultimately converging to a parameter state that exhibits both good discriminative power and strong cross-domain generalization capabilities, making it suitable for epileptic EEG signal prediction tasks in the target domain.

[0091] To verify the effectiveness of the cross-patient epileptic seizure prediction method based on joint domain adaptation proposed in this application, the example selected the public CHB-MIT epilepsy EEG dataset for cross-patient classification experiments. Specifically, this example selected the data of 13 patients (chb01, chb02, chb03, chb05, chb09, chb10, chb13, chb14, chb18, chb19, chb20, chb21, chb23) in the dataset as the target domain, and selected the data of one patient (chb11) as the source domain.

[0092] The EEG signals within 30 minutes before an epileptic seizure are defined as pre-ictal EEG signals, and the EEG signals between 1 hour after the end of an epileptic seizure and 1 hour before the start of the next epileptic seizure are defined as interictal EEG signals. All EEG signals are first band-pass filtered (0.5-70 Hz), power frequency interference removed, and normalized preprocessed; then, a sliding window is used to divide the signal into non-overlapping segments of 5 seconds in length. The class balancing processing method proposed in this application is used to obtain a balanced data set, and then the balanced data set is randomly downsampled to obtain 10% of the data samples.

[0093] During the neural network model training process, the source domain (chb11) is used as the training reference domain, and the target domain only selects a small amount of labeled EEG signals of the current patient each time for joint domain adaptation training. Accuracy, sensitivity, and specificity are used as evaluation indicators of the neural network model and tested on the remaining target domain data. The experiment is repeated five times and the average is taken. The experimental results of the embodiment are shown in Table 1. Figure 2 A comparison chart of the classification performance evaluation indicators of each patient under different neural network models provided in the embodiments of this application.

[0094] See Table 1 and Figure 2It can be seen that on the EEGNet model, the joint domain adaptation strategy introduced in this application significantly improves the classification performance. Compared with the original EEGNet model, under the premise of the same number of parameters (only 4,600), the accuracy is improved by 8.80%, the sensitivity is improved by 13.83%, and the specificity is improved by 3.73%. On the ConvNet model, after the introduction of joint domain adaptation in this application, the accuracy is improved by 6.44%, the sensitivity is improved by 6.25%, and the specificity is improved by 6.30%, showing the same obvious performance gain.

[0095] Table 1 Comparison of classification performance evaluation indicators for each patient under different neural network models

[0096]

[0097] The above results show that the joint domain adaptation mechanism proposed in this application shows significant performance improvement on different neural network structures, and has the ability to significantly enhance the neural network model's ability to recognize epileptic seizure signals, taking into account both classification accuracy and model lightweight, and has good prospects for promotion and application.

[0098] The cross-patient epileptic seizure prediction system based on joint domain adaptation provided in the embodiments of the present application includes:

[0099] A preprocessing module is used to preprocess the EEG signals in the source and target domains. The preprocessing includes bandpass filtering (0.5-70 Hz), power frequency notching, normalization, and class balancing. Class balancing refers to undersampling the EEG signals between epileptic seizures to achieve a balance in number with the EEG signals before the onset of an epileptic seizure.

[0100] The Euclidean alignment module is used to calculate the respective average covariance matrices of the source domain and target domain EEG signals after being processed by the preprocessing module, and perform Euclidean alignment processing on the source domain EEG signals based on the average covariance matrix of the source domain, and perform Euclidean alignment processing on the target domain EEG signals based on the average covariance matrix of the target domain, and normalize the average covariance matrices of the source domain and target domain EEG signals into unit matrices.

[0101] The EEG feature extraction module is used to input the EEG signal processed by the Euclidean alignment module into the neural network G for feature extraction to obtain a high-dimensional feature representation for subsequent analysis.

[0102] The feature alignment module is used to calculate the second-order Wasserstein distance between the source domain and the target domain in the high-dimensional feature space to measure the distribution difference between the source domain and the target domain, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L d , by minimizing the domain alignment loss L dIt achieves unsupervised alignment of high-dimensional features to guide the network to learn domain-invariant features.

[0103] Discriminative learning module, used to introduce improved Softmax classification loss L c By applying nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved, thereby enhancing the discriminability between categories and improving the feature aggregation within categories, thereby improving the discrimination ability of the neural network model.

[0104] The overall loss optimization and update module is used to use L as the overall loss function, L = L c +λ·L d ,λ is used to balance the classification loss L c With domain alignment loss L d The hyperparameters of the neural network are updated using the AdamW optimizer to perform backpropagation and obtain a neural network model for EEG classification with stronger generalization ability.

[0105] In addition, the present application also provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, any or all steps in the above-mentioned cross-patient epileptic seizure prediction method based on joint domain adaptation are executed.

[0106] Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0107] It should be understood that the above specific embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. For those skilled in the art, various equivalent replacements and modifications can be made to the technical solutions of the present invention without departing from the spirit and essence of the present invention, and these equivalent forms should all fall within the scope of protection of the present invention.

Claims

1. A cross-patient epileptic seizure prediction method based on joint domain adaptation, characterized by: The following steps are involved: Step 1: Preprocess the EEG signals of the source domain and the target domain; Step 2: Calculate the mean covariance matrices of the source and target domain EEG signals after processing in step 1, perform Euclidean alignment on the source domain EEG signals based on the mean covariance matrix of the source domain, and perform Euclidean alignment on the target domain EEG signals based on the mean covariance matrix of the target domain, and normalize the mean covariance matrices of the source and target domain EEG signals to unit matrices. Step 3: Input the EEG signal after Euclidean alignment into the neural network for feature extraction to obtain high-dimensional feature representation for subsequent analysis; Step 4: In the high-dimensional feature space, calculate the second-order Wasserstein distance between the source domain and the target domain to measure the distribution difference between the source domain and the target domain, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L d , achieving unsupervised alignment of high-dimensional features by minimizing domain alignment loss; Step 5: Introduce the improved Softmax classification loss L c , by applying nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved; Step 6: Use L as the overall loss function, L = L c +λ·L d ,λ is used to balance the classification loss L c With the domain alignment loss L d The hyperparameters of the neural network are updated by performing backpropagation using the AdamW optimizer.

2. The method according to claim 1, wherein: In step 1, the preprocessing includes bandpass filtering, power frequency notching, normalization and category balancing processing; the category balancing processing refers to undersampling the EEG signals between epileptic seizures to achieve a quantitative balance with the EEG signals before the epileptic seizure.

3. The method according to claim 1, wherein: In step 2, the source domain and target domain EEG signals are respectively calculated using formula (1) for their respective average covariance matrices: Among them, X i is the i-th EEG signal sample matrix, For X i The transposed matrix of , N is the total number of EEG signal samples; For the source domain EEG signal sample matrix X s Applying Euclidean alignment, we get X s : X′ s =R s -1 / 2 X s (2) For the target domain EEG signal sample matrix X t Applying Euclidean alignment, we get X′ t : X′ t =R t -1 / 2 X t (3) Among them, the source domain EEG signal sample matrix X s And the target domain EEG signal sample matrix X t are all known quantities, R s represents the mean covariance matrix of the source domain EEG signal, R t represents the average covariance matrix of the target domain EEG signal, R s -1 / 2 and R t -1 / 2 is the square root inverse matrix of the corresponding matrix.

4. The method according to claim 1, wherein: In step 3, EEGNet or ConvNet is selected as the neural network model for feature extraction.

5. The method according to claim 1, wherein: In step 4, the second-order Wasserstein distance domain alignment loss L d The formula is as follows: Among them, μ s 、μ t are the means of the source domain and target domain features, respectively, ||μ s -μ t || 2 represents the square of the Euclidean distance between the feature means of the source domain and the target domain, ∑ s ,∑ t are the covariance matrices of the source domain and target domain features, Tr(·) represents the trace operation of the matrix, (·) 1 / 2 Represents the principal square root of a symmetric positive definite matrix.

6. The method according to claim 1, wherein: In step 5, the nonlinear boundary adjustment includes: when the original score is positive, scaling the original score and subtracting the boundary parameter; when the original score is non-positive, weighting and amplifying the original score and also subtracting the boundary parameter.

7. The method according to claim 6, characterized in that: Define F i (c)* represents the score of the ith EEG signal sample after applying boundary adjustment to its true category c, F i (c)* for: The improved Softmax classification loss function L c for: Among them, F i (c) and F i (j) They represent the original scores of the i-th EEG signal sample in its true category c and other categories j, respectively. m ≥ 1 and k ≥ 0 are boundary control hyperparameters, and N is the total number of EEG signal samples.

8. The method according to claim 1, wherein: In step 6, during the parameter optimization process, the AdamW optimizer is used to perform back propagation update on the neural network parameters θ. The model parameters updated by back propagation are: Among them, α represents the learning rate, G θ represents a neural network with θ as a parameter, L(G θ ) is the overall loss of the neural network with θ as a parameter, is the gradient operator, which means that the partial derivatives of all components of the parameter θ are obtained separately, and the obtained gradient vector is used for back propagation and update of the parameters.

9. A cross-patient epileptic seizure prediction system based on joint domain adaptation constructed based on the method according to any one of claims 1 to 8, characterized in that: include: A preprocessing module is used to preprocess the EEG signals of the source domain and the target domain, wherein the preprocessing includes bandpass filtering, power frequency notching, normalization, and class balancing processing; the class balancing processing refers to undersampling the EEG signals between epileptic seizures to achieve a balance in number with the EEG signals before the epileptic seizure; A Euclidean alignment module is used to calculate the mean covariance matrix of the source domain and target domain EEG signals after being processed by the preprocessing module, and perform Euclidean alignment processing on the source domain EEG signals based on the mean covariance matrix of the source domain, and perform Euclidean alignment processing on the target domain EEG signals based on the mean covariance matrix of the target domain, and normalize the mean covariance matrices of the source domain and target domain EEG signals to unit matrices; an EEG feature extraction module, configured to input the EEG signal processed by the Euclidean alignment module into a neural network for feature extraction, so as to obtain a high-dimensional feature representation for subsequent analysis; The feature alignment module is used to calculate the second-order Wasserstein distance between the source domain and the target domain in the high-dimensional feature space to measure the distribution difference between the source domain and the target domain, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L d , by minimizing the domain alignment loss L d Achieve unsupervised alignment of high-dimensional features; Discriminative learning module, used to introduce improved Softmax classification loss L c , by applying nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved; The overall loss optimization and update module is used to use L as the overall loss function, L = L c +λ·L d ,λ is used to balance the classification loss L c With the domain alignment loss L d The hyperparameters of the neural network are updated by performing backpropagation using the AdamW optimizer.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, execute the steps of the cross-patient epileptic seizure prediction method based on joint domain adaptation according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Epileptic seizure prediction device, terminal device and computer readable storage medium

    CN110477910A

  • Time-varying electroencephalogram feature extraction method based on domain self-adaption

    CN112426161A

  • Method and system for identifying epileptic waves in brain waves

    CN114081509A

  • Home-based interactive intelligent monitoring system and method for epileptic seizure

    CN114145755A

  • Epileptic seizure detection system based on EEG feature distribution adaptive transfer learning

    CN114334139A