Epilepsy detection model training method, epilepsy detection method and epilepsy detection system

The subnet is allocated to each domain through adaptive pruning, and the new domain-specific knowledge is learned in combination with specific domain parameters. At the same time, the shared parameters use the knowledge learned by previous domains to solve the problems of catastrophic forgetting and data privacy exposure in domain incremental learning, achieving high-accurate epilepsy detection and data privacy protection.

CN119903410AActive Publication Date: 2025-04-29HUAZHONG UNIV OF SCI & TECH

Patent Information

Application Number
CN202411978390.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-29
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

Existing domain incremental learning methods have catastrophic forgetting problems in epilepsy detection scenarios, resulting in low detection accuracy and the need to store raw data from previous domains to avoid forgetting, which poses a risk of data privacy exposure.

Method used

Subnetwork is allocated to each domain through adaptive pruning, learning new domain-specific knowledge in combination with specific domain parameters, and sharing parameters utilizes the knowledge learned by previous domains to achieve knowledge sharing and reduce inter-domain interference.

Benefits of technology

Effectively alleviates catastrophic forgetting, achieves accurate epilepsy detection, and eliminates the need to store data from previous domains, protecting patient data privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119903410A_ABST
    Figure CN119903410A_ABST
Patent Text Reader

Abstract

The invention discloses an epilepsy detection model training method, an epilepsy detection method and an epilepsy detection system, and belongs to the technical field of epilepsy detection. When a domain training subset S of a new patient is obtained, a new training batch is started, an epilepsy detection model is trained based on the domain training subset S under the current training batch, a sub-network is distributed for each domain through adaptive pruning, specific domain parameters are combined to learn specific knowledge of the new domain, and the epilepsy detection model is obtained. And meanwhile, the shared parameters effectively utilize knowledge learned in a previous domain. Self-adaptive pruning promotes knowledge sharing, reduces inter-domain interference to the greatest extent, effectively relieves disastrous forgetting, and can realize accurate epilepsy detection; meanwhile, data of a previous domain does not need to be stored, and data privacy is effectively protected; on the basis, on the premise that patient data privacy is protected, accurate epilepsy detection is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of epilepsy detection, and more specifically, relates to a training method for an epilepsy detection model, an epilepsy detection method and a system. Background Art

[0002] Epilepsy is a common neurological disorder that affects people of all ages. Seizures are caused by sudden interruptions in the brain's electrical activity, resulting in symptoms such as convulsions, loss of consciousness, and involuntary movements. In addition to the immediate physical effects, epilepsy often causes long-term cognitive, emotional, and social impairments.

[0003] Electroencephalogram (EEG) recordings of epileptic patients mainly show two types of activities: interictal and ictal, which provides an important basis for the diagnosis of epilepsy. However, due to the spontaneity of epileptic seizures, long-term continuous EEG monitoring is necessary, resulting in a large amount of EEG data. At the same time, the diagnosis of epilepsy usually requires experienced neurophysiologists to perform visual analysis of EEG recordings, which makes the diagnostic process costly, inefficient and time-consuming. Therefore, it is particularly important to develop automated methods for detecting epileptic seizures.

[0004] Traditional methods for seizure detection usually train classifiers with manually extracted EEG features, such as TrBoosting. In recent years, deep learning methods have been widely used for seizure detection because they can automatically learn rich feature representations from raw data. Both types of methods perform well in patient-specific settings, especially when the models are trained and used only on the same patient. However, significant individual differences make it challenging to deploy models across patients.

[0005] Domain Incremental Learning (DIL) addresses this challenge by training models to continuously integrate new data with different distributions while retaining previously learned knowledge. DIL is able to develop a single system that performs well across all patients. However, when domain incremental learning-related technologies are applied to epilepsy detection scenarios, due to the large differences in the distribution of EEG data of different patients, existing domain incremental learning methods often need to contribute model parameters in different domains at the same time when training different domains in batches. When the model is migrated to a new domain with different data distribution (such as different patients), the model has a catastrophic forgetting problem for the previous domain, and the detection accuracy is low. At the same time, due to the catastrophic forgetting problem of existing domain incremental learning methods, it is often necessary to store the original data of the previous domain and use this data in subsequent training for further training to circumvent this problem, which leads to the risk of data exposure and is not suitable for medical scenarios such as epilepsy detection where privacy protection is critical. Summary of the invention

[0006] In view of the above defects or improvement needs of the prior art, the present invention provides a training method for an epilepsy detection model, an epilepsy detection method and a system, the purpose of which is to achieve accurate epilepsy detection while protecting the privacy of patient data.

[0007] In order to achieve the above objectives, in a first aspect, the present invention provides a training method for an epilepsy detection model, comprising:

[0008] Each time a domain training subset S of a new patient is obtained, a new training batch is started, and the epilepsy detection model is trained based on the domain training subset S under the current training batch; wherein one patient corresponds to one domain, and one domain training subset includes multiple EEG signals from the corresponding patient; each EEG signal carries a label indicating whether it is epilepsy; the epilepsy detection model includes: a cascaded feature extraction module and a classifier; the feature extraction module includes: N cascaded encoders; N≥1; the i-th encoder is used to extract the features of the input data, and perform a dot multiplication of the extracted features with the i-th mask matrix under the domain where the input data is located, thereby obtaining the i-th mask feature; i=1,2,…,N; the classifier is used to use the N-th mask feature as a classification feature, and obtain the corresponding epilepsy detection result based on the classification feature;

[0009] The above-mentioned training of the epilepsy detection model based on the domain training subset S under the current training batch includes: performing the following first-stage training: including: performing the following first-stage training:

[0010] Set all mask matrices under the current domain to all-1 matrices;

[0011] The domain training subset S is input into the epilepsy detection model, and the non-frozen parameters in the epilepsy detection model and each mask matrix under the current domain are adjusted based on the first overall training goal; the first overall training goal includes: a first training goal and a second training goal; the first training goal includes: minimizing the difference loss between the epilepsy detection result of each EEG signal of the domain training subset S obtained in the current training stage and the corresponding label; the second training goal includes: minimizing the L1 regularization term of each mask matrix under the current domain; the frozen parameters are the parameters in the epilepsy detection model that have been adjusted in each training batch before the current training batch;

[0012] After the adjustment is completed, each mask matrix in the current domain is pruned and saved to complete the first stage of training; pruning includes: m The larger element is set to 1, and the other elements are set to 0; r is the preset ratio; N m is the number of elements in the mask matrix.

[0013] Further preferably, the training of the epilepsy detection model based on the domain training subset S in the current training batch further includes: after completing the first stage of training, performing the following second stage of training:

[0014] Set each mask matrix under the current domain to the corresponding mask matrix saved in the first stage;

[0015] The domain training subset S is input into the epilepsy detection model again, and the non-frozen parameters in the epilepsy detection model are adjusted based on a second overall training target including the first training target.

[0016] Further preferably, the first general training goal and the second general training goal further include: a third training goal;

[0017] The third training goal includes: minimizing the difference loss between the classification features of each pair of EEG signals in each similar EEG signal set in the current training stage; wherein the similar EEG signal set is a set composed of EEG signals with the same label in the domain training subset S input in the current training batch, which is obtained by dividing the domain training subset S according to the label.

[0018] Further preferably, the encoder comprises: a cascaded multi-head self-attention module, a mask module and a forward propagation module;

[0019] The multi-head self-attention module is used to extract features of the data input to the encoder, and then the mask module is used to perform dot multiplication of the extracted features with the corresponding mask matrix in the domain where the input data is located, and then the corresponding mask features are obtained after passing through the forward propagation module.

[0020] Further preferably, the above classifier is a nearest neighbor classifier.

[0021] Further preferably, the above-mentioned domain training subset is a pre-processed domain training subset;

[0022] The above preprocessing includes: performing Euclidean alignment on each EEG signal in the domain training subset so as to align the marginal probability distributions of each EEG signal in the domain training subset.

[0023] In a second aspect, the present invention provides an epilepsy detection method, comprising:

[0024] Obtain each mask matrix under the corresponding domain of the patient to be detected, and input it into the epilepsy detection model together with the EEG signal of the patient to be detected to obtain the epilepsy detection result of the patient;

[0025] The epilepsy detection model is trained by the training method for the epilepsy detection model provided in the first aspect of the present invention; the above-mentioned mask matrices are the mask matrices under the corresponding domains saved in the training method for the epilepsy detection model provided in the first aspect of the present invention.

[0026] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor executes the method provided in the first aspect or the second aspect of the present invention when executing the computer program.

[0027] In a fourth aspect, the present invention further provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method provided in the first aspect or the second aspect of the present invention.

[0028] In a fifth aspect, the invention further provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the method provided in the first aspect or the second aspect of the invention.

[0029] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:

[0030] 1. The present invention provides a training method for an epilepsy detection model. Each time a domain training subset S of a new patient is obtained, a new training batch is started, and the epilepsy detection model is trained based on the domain training subset S under the current training batch; a subnetwork is allocated to each domain through adaptive pruning, and new domain-specific knowledge is learned in combination with specific domain parameters, while shared parameters effectively utilize the knowledge learned in the previous domain. While promoting knowledge sharing, adaptive pruning minimizes inter-domain interference, effectively alleviates catastrophic forgetting, and can achieve accurate epilepsy detection; at the same time, the present invention does not need to store data from previous domains, effectively protecting data privacy; based on this, the present invention achieves accurate epilepsy detection under the premise of protecting patient data privacy.

[0031] 2. Furthermore, the training method of the epilepsy detection model provided by the present invention, in each training batch, after completing the first stage of training, also performs the second stage of training to reduce the risk of model performance degradation that may be caused by the pruning operation in the first stage, thereby further improving the accuracy of epilepsy detection.

[0032] 3. Furthermore, in the training method of the epilepsy detection model provided by the present invention, the first general training goal and the second general training goal also include a third training goal; the third training goal aims to minimize the difference loss between the classification features of pairwise EEG signals in each set of similar EEG signals in the current training stage, which can bring the feature representations of samples of the same category closer and at the same time pull apart the feature representations of samples of different categories, thereby enhancing the discriminability between categories and further improving the accuracy of epilepsy detection.

[0033] 4. Furthermore, in the training method of the epilepsy detection model provided by the present invention, the domain training subset is the domain training subset after Euclidean alignment. The marginal probability distribution of each EEG signal in the domain training subset is aligned through Euclidean alignment, which reduces the distribution deviation between domains, avoids the problem of individual differences in EEG signals, and further improves the accuracy of epilepsy detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A flow chart of a training method for an epilepsy detection model provided by an embodiment of the present invention;

[0035] Figure 2 A schematic diagram of changes in performance indicators when the number of domains provided by an embodiment of the present invention increases. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0037] In order to achieve the above objectives, in a first aspect, the present invention provides a training method for an epilepsy detection model, comprising:

[0038] Each time a domain training subset S of a new patient is obtained, a new training batch is started, and the epilepsy detection model is trained based on the domain training subset S under the current training batch; wherein one patient corresponds to one domain, and one domain training subset includes multiple EEG signals from the corresponding patient; each EEG signal carries a label indicating whether it is epilepsy; the epilepsy detection model includes: a cascaded feature extraction module and a classifier; the feature extraction module includes: N cascaded encoders; N≥1; the i-th encoder is used to extract the features of the input data, and perform a dot multiplication of the extracted features with the i-th mask matrix under the domain where the input data is located, thereby obtaining the i-th mask feature; i=1,2,…,N; the classifier is used to use the N-th mask feature as a classification feature, and obtain the corresponding epilepsy detection result based on the classification feature;

[0039] The above-mentioned training of the epilepsy detection model based on the domain training subset S under the current training batch includes: performing the following first stage training:

[0040] Set all mask matrices under the current domain to all-1 matrices;

[0041] The domain training subset S is input into the epilepsy detection model, and the non-frozen parameters in the epilepsy detection model and each mask matrix under the current domain are adjusted based on the first overall training goal; the first overall training goal includes: a first training goal and a second training goal; the first training goal includes: minimizing the difference loss between the epilepsy detection result of each EEG signal of the domain training subset S obtained in the current training stage and the corresponding label; the second training goal includes: minimizing the L1 regularization term of each mask matrix under the current domain; the frozen parameters are the parameters in the epilepsy detection model that have been adjusted in each training batch before the current training batch;

[0042] After the adjustment is completed, each mask matrix in the current domain is pruned and saved to complete the first stage of training; pruning includes: m The larger element is set to 1, and the other elements are set to 0; r is the preset ratio; N m is the number of elements in the mask matrix. In an optional implementation manner, the preset ratio r is set to 0.1.

[0043] Through the above operations, when training each new domain, the mask matrix is ​​initially set to an all-1 matrix to fully utilize the entire model. On this basis, in order to avoid interfering with the knowledge learned in the previous domain, constraints are added during the back-propagation process, and only the non-frozen parameters in the epilepsy detection model and the mask matrices under the current domain are adjusted to ensure that the sub-network parameters corresponding to the previous domain in the model remain unchanged. In this way, the new domain can retain and utilize the previously acquired knowledge while fully learning new knowledge.

[0044] The first phase of training ensures that each domain uses its own sub-network, but some parameters are shared with the previous domain, allowing the sub-network to utilize both domain-specific parameters and shared parameters, thereby providing flexibility for new domains while retaining previously learned knowledge. To prevent catastrophic forgetting caused by the update of shared parameters, only specific parameters related to the current domain are updated.

[0045] It should be noted that the difference loss in the above-mentioned first training objective can be measured by cross entropy loss function, L2 loss function, cosine similarity loss, hinge loss, etc., which is not limited here.

[0046] In an optional implementation, in order to reduce the risk of model performance degradation that may be caused by the first-stage pruning operation, the sub-network parameters in the selected model are trained in the second stage. Specifically, the above-mentioned training of the epilepsy detection model based on the domain training subset S under the current training batch also includes: after completing the first-stage training, performing the following second-stage training:

[0047] Set each mask matrix under the current domain to the corresponding mask matrix saved in the first stage;

[0048] The domain training subset S is input into the epilepsy detection model again, and the non-frozen parameters in the epilepsy detection model are adjusted based on a second overall training target including the first training target.

[0049] In an optional implementation manner, the first general training goal and the second general training goal further include: a third training goal;

[0050] The third training goal includes: minimizing the difference loss between the classification features of each pair of EEG signals in each similar EEG signal set in the current training stage; wherein the similar EEG signal set is a set composed of EEG signals with the same label in the domain training subset S input in the current training batch, which is obtained by dividing the domain training subset S according to the label.

[0051] Based on the third training objective, the feature representations of samples in the same category can be brought closer, while the feature representations of samples in different categories can be pulled apart.

[0052] It should be noted that the difference loss in the above-mentioned first training objective can be measured by L2 loss function, Euclidean distance, cosine similarity, consistency loss, contrast loss, KL divergence, etc., which is not limited here.

[0053] It should be noted that in the above encoder, feature extraction units such as CNN, fully connected layer, recursive time network, etc. can be used to extract features of input data, and there is no limitation here.

[0054] Preferably, in an optional implementation, the encoder comprises: a cascaded multi-head self-attention module, a mask module and a forward propagation module;

[0055] The multi-head self-attention module is used to extract features of the data input to the encoder, and then the mask module is used to perform dot multiplication of the extracted features with the corresponding mask matrix in the domain where the input data is located, and then the corresponding mask features are obtained after passing through the forward propagation module.

[0056] It should be noted that the above-mentioned classifier can be a softmax layer, a nearest neighbor classifier, an SVM classifier, etc., which is not limited here. In an optional implementation, the classifier can directly map the classification features of the input EEG signal to the probability values ​​of the presence of epilepsy in the input EEG signal and the absence of epilepsy in the input EEG signal. When the presence of epilepsy in the input EEG signal is relatively large, the epilepsy detection result of the input EEG signal is the presence of epilepsy; otherwise, the epilepsy detection result of the input EEG signal is the absence of epilepsy. In another optional implementation, the classifier can pre-average the classification features of each EEG signal in the domain training subset S according to the label type to obtain the average classification features of the EEG signal with epilepsy and the average classification features of the EEG signal without epilepsy; then compare the classification features of the input EEG signal with the average classification features of the EEG signal with epilepsy and the average classification features of the EEG signal without epilepsy. When the classification features of the input EEG signal are closer to the average classification features of the EEG signal with epilepsy, the epilepsy detection result of the input EEG signal is the presence of epilepsy; otherwise, the epilepsy detection result of the input EEG signal is the absence of epilepsy.

[0057] Preferably, the above classifier is a nearest neighbor classifier.

[0058] It should be noted that due to differences in brain activity and external factors between individuals, EEG signal data from different patients usually show significant differences. This will affect the generalization ability of the model between different patients. Training on new data that is significantly different from the previous domain may lead to a decrease in overall performance, and there is a problem of individual differences in EEG signals. In order to solve this problem, preferably, in an optional implementation, the above-mentioned domain training subset is a preprocessed domain training subset;

[0059] The above preprocessing includes: performing Euclidean alignment on each EEG signal in the domain training subset so as to align the marginal probability distributions of each EEG signal in the domain training subset.

[0060] In order to further illustrate the training method of the epilepsy detection model provided by the present invention, a specific embodiment is described in detail below:

[0061] Scenario: Consider the privacy-preserving domain incremental learning for epilepsy detection. Assume that there are T patients, and each patient is regarded as an independent domain. For domain t, there are n t Labeled data represents the EEG signal of the patient corresponding to domain t, is the corresponding label indicating whether it is epilepsy. To simplify the expression, the superscript t of the domain will be omitted in the subsequent introduction because the operation of each domain is the same. The model is trained on all domains in turn. During the training process of each domain, the model can only access the data of the current domain and the model parameters learned in the previous domain. The goal is to develop a model that can perform well in all learned domains. In this embodiment, taking the CHB-MIT dataset as an example, T is 11; the number of labeled data for each patient is 1000-3000.

[0062] like Figure 1 As shown, the specific technical solution is:

[0063] 1) Data preprocessing to align data in each domain

[0064] In order to reduce the distribution bias between domains and promote knowledge sharing between domains, the Euclidean alignment method (EA) is used to process the data of the current domain in the data preprocessing stage. For the data of each domain, the reference matrix is ​​first calculated, which is defined as the arithmetic mean of all n covariance matrices.

[0065]

[0066] Next, each sample is aligned with the reference matrix:

[0067]

[0068] in, is the aligned data. Through Euclidean alignment, the average covariance matrix of the data in each domain is converted to the identity matrix. As a result, samples from different domains become more consistent, thereby improving the model's ability to effectively share knowledge between domains.

[0069] 2) Adaptive pruning method to allocate subnetworks to each domain

[0070] The epilepsy detection model includes: a cascaded feature extraction module and a classifier; the feature extraction module includes: N cascaded encoders; N≥1; the i-th encoder is used to extract the features of the input data, and perform dot multiplication of the extracted features with the i-th mask matrix under the domain where the input data is located, thereby obtaining the i-th mask feature; i=1,2,…,N; the classifier is used to use the N-th mask feature as a classification feature, and obtain the corresponding epilepsy detection result based on the classification feature;

[0071] In this embodiment, N is 12. The encoder includes: a cascaded multi-head self-attention module (MHSA), a mask module and a forward propagation module; the multi-head self-attention module is used to extract features of the data input to the encoder, and then the mask module is used to perform a dot multiplication of the extracted features with the corresponding mask matrix under the domain where the input data is located, and then the corresponding mask features are obtained after passing through the forward propagation module. In this embodiment, the forward propagation module is a fully connected layer (MLP).

[0072] The multi-head self-attention layer (MHSA) and fully connected layer (MLP) in the model are adaptively pruned to assign corresponding sub-networks to different domains. The core goal of this pruning process is to retain the most important feature components while compressing redundant or less informative features. To this end, a set of trainable masks are introduced and applied to the output features of the MHSA and MLP layers. The role of these masks is to identify and retain the most representative key features in each domain.

[0073] For the input feature matrix The masked feature output F masked for:

[0074] F masked =Mask☉F

[0075] Where Mask∈{0,1} d is a trainable mask, ⊙ represents dot product, i.e. element-wise multiplication. Each element in the mask represents the importance of the corresponding component in F.

[0076] In order to improve the sparsity of the mask, an L1 regularization term λ||Mask|| is added to the training loss, where λ is a sparsity hyperparameter. After training, the elements in the mask are sorted, and the specified proportion of elements are retained according to the preset retention rate, and their values ​​are set to 1, and the values ​​of the remaining elements are set to 0.

[0077] During model training, the cross entropy loss L is used. CE (corresponding to the first training objective) for classification. In order to enhance feature aggregation, a supervised consistency regularization term L is introduced into the loss function SCL(corresponding to the third training objective), which aims to bring the feature representations of samples of the same category closer, while pulling the feature representations of samples of different categories apart. The supervised consistency regularization term uses label information to define positive (same category) and negative (different category) sample pairs, thereby constraining the feature representation of each pair of samples. As a result, the final training loss function can be expressed as:

[0078] L=L CE +L SCL +λ||Mask||

[0079] When training each new domain, the mask is initially set to all 1s, which allows full utilization of the entire model. To avoid interfering with knowledge learned in previous domains, we add constraints during backpropagation to ensure that the subnets corresponding to previous domains remain unchanged. This allows the new domain to retain and utilize previously acquired knowledge while fully learning new knowledge.

[0080] Mask previous represents the part of the network related to the previous domain. The following update rule ensures that the gradients of these domain-related parts are not affected:

[0081]

[0082] Where W represents the parameter of the pruning layer; 1 d Representation and Mask previous All-1 matrices of the same dimension; Mask previous The matrix is ​​the result of element-by-element OR operation of the pruned mask matrices obtained in the training batches before the current training batch.

[0083] 3) Sub-network retraining method

[0084] Finally, the selected subnetworks are retrained to mitigate the performance degradation that may be caused by pruning. Although each domain uses its own subnetwork during training and inference, some parameters are shared with the previous domain. This design enables the subnetwork to utilize both domain-specific parameters and shared parameters, thereby providing flexibility for new domains while retaining previously learned knowledge. To prevent the update of shared parameters from causing catastrophic forgetting, only specific parameters related to the current domain are updated. Let Mask cur Represents the network part related to the current domain. The update rule of the current domain pruning layer parameters is:

[0085]

[0086] Among them, Mask cur Subtract Mask from the pruned mask matrix of the current training batch p The matrix after Mask pThe mask matrix and Mask after pruning for the current training batch previous Matrix after element-wise AND operation.

[0087] The training method of the epilepsy detection model and the epilepsy detection method provided by the present invention can be applied to the epilepsy prediction system, and a good performance on all patients is achieved by constructing a single model and training it on the data of each patient in turn. The method does not need to save samples of previous patients, thereby effectively protecting data privacy.

[0088] The specific steps are as follows:

[0089] Operation S1: Enter the current domain serial number t and data Input learning rates α, β, γ; input loss function L; input mask Mask with all 1s, dimension d; input sub-network retention ratio ratio;

[0090] Operation S2: If t=1, randomly initialize the parameters of model f to Otherwise, the model parameters learned in the previous domain are used for initialization Input the mask learned from the previous domain previous ;

[0091] Operation S3: Calculate the loss L, if t = 1, update the model with this loss Otherwise, proceed to operation S4;

[0092] Operation S4: Use Update model with update rule

[0093] Operation S5: Repeat operations S3-S4 until the loss function converges and obtain the current model parameters and mask Mask′;

[0094] Operation S6: Sort the elements in Mask′, set the first ratio*d elements to 1, and the rest to 0, to obtain the mask matrix after pruning the current training batch; use the mask matrix after pruning the current training batch to subtract Mask p The matrix after that gets Mask cur ; Mask p The mask matrix and Mask after pruning for the current training batch previous The matrix after element-by-element AND operation;

[0095] Operation S7: Calculate the loss L cur =L CE +L SCL ,use Update rules to update the model

[0096] Operation S8: Repeat operation S7 until the loss function converges to obtain the model learned in the current domain

[0097] Operation S9: Enter the test phase, make judgments on all test data from domain 1 to domain t, output the results, and end the operation.

[0098] The present invention considers the domain increment scenario in epilepsy detection and proposes a sparse knowledge sharing method without sample replay. The method allocates a subnetwork to each domain through adaptive pruning, learns new domain-specific knowledge in combination with specific domain parameters, and effectively utilizes the knowledge learned in the previous domain by sharing parameters. While promoting knowledge sharing, adaptive pruning minimizes inter-domain interference to alleviate catastrophic forgetting. In addition, Euclidean alignment is used to reduce the distribution deviation between domains, and supervised consistency regularization enhances the discriminability between classes, further improving the classification performance.

[0099] Tables 1 and 2 show the experimental results of epilepsy detection on two public datasets, CHB-MIT and CHSZ, respectively, using the training method of the epilepsy detection model provided by the present invention (denoted as SKS) and other existing model training methods. As can be seen from the table, the present invention achieves the best BCA, ACC, F1 and BWT values ​​on both datasets, not only performing well on new domains, but also performing well in reducing forgetting of previous domains. It is worth noting that the present invention does not need to store previous domain samples, thereby effectively protecting patient privacy and minimizing memory usage.

[0100] Table 1 Experimental results of epilepsy detection on CHB-MIT using SKS and other existing model training methods

[0101]

[0102] Table 2 Experimental results of epilepsy detection on CHSZ using SKS and other existing model training methods

[0103]

[0104] Figure 2 The figure is a schematic diagram of the change of performance indicators when the number of domains increases; the left column is a schematic diagram of the change of performance indicators when the number of domains increases on the CHB-MIT dataset, and the right column is a schematic diagram of the change of performance indicators when the number of domains increases on the CHSZ dataset. It can be seen from the figure that regardless of the number of domains, the present invention is stable in all metrics and effectively balances plasticity and stability.

[0105] In the above experiments, the domain arrival order is arranged in ascending order of the patient's serial number, which may affect the experimental results. In order to more systematically study the impact of the domain order, the domain order in the two datasets was changed and the experiment was repeated. Table 3 shows the corresponding results. The experiment shows that the present invention always achieves the best performance, proving its robustness to the domain order.

[0106] Table 3 Experimental results on CHB-MIT and CHSZ after shuffling the task order

[0107]

[0108] In summary, the present invention provides a sparse knowledge sharing algorithm that prevents catastrophic forgetting due to parameter changes by freezing the parameters related to the previous domain. At the same time, by sharing the useful knowledge in the previous domain and using domain-specific parameters to learn the unique knowledge of the current domain, effective learning of the new domain is achieved, compressing the model while accommodating more domains. In addition, the present invention does not need to store the data of the previous domain, effectively protecting data privacy.

[0109] In a second aspect, the present invention provides an epilepsy detection method, comprising:

[0110] Obtain each mask matrix under the corresponding domain of the patient to be detected, and input it into the epilepsy detection model together with the EEG signal of the patient to be detected to obtain the epilepsy detection result of the patient;

[0111] The epilepsy detection model is obtained by training the epilepsy detection model training method provided by the first aspect of the present invention; the above-mentioned mask matrices are the mask matrices under the corresponding domains saved in the epilepsy detection model training method provided by the first aspect of the present invention;

[0112] It should be noted that the patient to be detected is one of the objects of collecting the domain training subset used in the training method of the epilepsy detection model provided in the first aspect of the present invention.

[0113] The related technical solution is the same as the training method of the epilepsy detection model provided in the first aspect of the present invention, and will not be described in detail here.

[0114] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor executes the method provided in the first aspect or the second aspect of the present invention when executing the computer program.

[0115] The related technical solutions are the same as the training method of the epilepsy detection model provided by the first aspect of the present invention and the epilepsy detection method provided by the second aspect of the present invention, and will not be described in detail here.

[0116] In a fourth aspect, the present invention further provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method provided in the first aspect or the second aspect of the present invention.

[0117] The related technical solutions are the same as the training method of the epilepsy detection model provided by the first aspect of the present invention and the epilepsy detection method provided by the second aspect of the present invention, and will not be described in detail here.

[0118] In a fifth aspect, the invention further provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the method provided in the first aspect or the second aspect of the invention.

[0119] The related technical solutions are the same as the training method of the epilepsy detection model provided by the first aspect of the present invention and the epilepsy detection method provided by the second aspect of the present invention, and will not be described in detail here.

[0120] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A training method for an epilepsy detection model, characterized in that: include: Each time a domain training subset S of a new patient is obtained, a new training batch is started, and the epilepsy detection model is trained based on the domain training subset S under the current training batch; wherein one patient corresponds to one domain, and one domain training subset includes multiple EEG signals from the corresponding patient; each EEG signal carries a label indicating whether it is epilepsy; the epilepsy detection model includes: a cascaded feature extraction module and a classifier; the feature extraction module includes: N cascaded encoders; N≥1; the i-th encoder is used to extract the features of the input data, and perform a dot multiplication of the extracted features with the i-th mask matrix under the domain where the input data is located, thereby obtaining the i-th mask feature; i=1,2,…,N; the classifier is used to use the N-th mask feature as a classification feature, and obtain the corresponding epilepsy detection result based on the classification feature; The training of the epilepsy detection model based on the domain training subset S under the current training batch includes: performing the following first stage training: Set all mask matrices under the current domain to all-1 matrices; The domain training subset S is input into the epilepsy detection model, and the non-frozen parameters in the epilepsy detection model and each mask matrix under the current domain are adjusted based on the first overall training goal; the first overall training goal includes: a first training goal and a second training goal; the first training goal includes: minimizing the difference loss between the epilepsy detection result of each EEG signal of the domain training subset S obtained in the current training stage and the corresponding label; the second training goal includes: minimizing the L1 regularization term of each mask matrix under the current domain; the frozen parameters are the parameters in the epilepsy detection model that have been adjusted in each training batch before the current training batch; After the adjustment is completed, each mask matrix in the current domain is pruned and saved to complete the first stage of training; pruning includes: m The larger element is set to 1, and the other elements are set to 0; r is the preset ratio; N m is the number of elements in the mask matrix.

2. The training method for epilepsy detection model according to claim 1, characterized in that: The training of the epilepsy detection model based on the domain training subset S under the current training batch further includes: after completing the first stage of training, performing the following second stage of training: Set each mask matrix under the current domain to the corresponding mask matrix saved in the first stage; The domain training subset S is input into the epilepsy detection model again, and the non-frozen parameters in the epilepsy detection model are adjusted based on a second overall training target including the first training target.

3. The training method for epilepsy detection model according to claim 2, characterized in that: The first overall training goal and the second overall training goal also include: a third training goal; The third training goal includes: minimizing the difference loss between the classification features of each pair of EEG signals in each similar EEG signal set in the current training stage; wherein the similar EEG signal set is a set composed of EEG signals with the same label in the domain training subset S input in the current training batch, which is obtained by dividing the domain training subset S according to the label.

4. The method for training an epilepsy detection model according to any one of claims 1 to 3, characterized in that: The encoder comprises: a cascaded multi-head self-attention module, a mask module and a forward propagation module; The multi-head self-attention module is used to extract features of the data input to the encoder, and then the mask module is used to perform dot multiplication of the extracted features with the corresponding mask matrix in the domain where the input data is located, and then the corresponding mask features are obtained after passing through the forward propagation module.

5. The method for training an epilepsy detection model according to any one of claims 1 to 3, characterized in that: The classifier is a nearest neighbor classifier.

6. The training method for an epilepsy detection model according to any one of claims 1 to 3, characterized in that: The domain training subset is a preprocessed domain training subset; The preprocessing includes: performing Euclidean alignment on each EEG signal in the domain training subset so as to align the marginal probability distributions of each EEG signal in the domain training subset.

7. A method for detecting epilepsy, characterized in that: include: Obtain each mask matrix under the corresponding domain of the patient to be detected, and input it into the epilepsy detection model together with the EEG signal of the patient to be detected to obtain the epilepsy detection result of the patient; The epilepsy detection model is obtained by training the epilepsy detection model training method according to any one of claims 1 to 6; and each mask matrix is ​​a mask matrix under a corresponding domain saved in the epilepsy detection model training method according to any one of claims 1 to 6.

8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor executes the method according to any one of claims 1 to 7 when executing the computer program.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that The method comprises a computer program / instruction, which implements the method according to any one of claims 1 to 7 when executed by a processor.

Citation Information

Patent Citations

  • Image classification continuous learning method based on information bottleneck

    CN118313438A

  • Electrocardiosignal classification method, electrocardiosignal classification model training method and electronic equipment

    CN118648906A

  • Training method, prediction method, training device and prediction device of graph classification model

    CN118982700A

  • A computer-implemented model for predicting occurrence of a seizure and training method thereof

    WO2022122996A1

Cited By

  • Target detection method and device based on domain increment, equipment, medium and product

    CN122156804A