A training method for an epilepsy detection model, an epilepsy detection method and a system
Through adaptive pruning and Euclidean alignment techniques, a subnetwork is assigned to each patient, and parameters are shared to learn new domain-specific knowledge, which solves the catastrophic forgetting problem of epilepsy detection models in cross-patient deployment and achieves accurate epilepsy detection and privacy protection.
Patent Information
- Application Number
- CN202411978390.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Existing epilepsy detection models suffer from catastrophic forgetting when deployed across patients and have difficulty effectively utilizing patient data in medical scenarios where privacy protection is crucial.
A cascaded feature extraction module and classifier is used, combined with adaptive pruning and Euclidean alignment techniques. A subnetwork is assigned to each patient through adaptive pruning, parameters are shared and new domain-specific knowledge is learned. At the same time, consistency regularization is introduced during training to reduce inter-domain interference and distribution bias.
Accurate epilepsy detection is achieved while protecting patient data privacy, catastrophic forgetting is reduced, the detection accuracy and stability of the model are improved, and the need to store previous domain data is avoided.
Smart Images

Figure CN119903410B_ABST
Abstract
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 sudden disruptions of the brain's electrical activity, leading to symptoms such as convulsions, loss of consciousness, and involuntary movements. Beyond its 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 activity: interictal and ictal activity. This feature 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, the development of automated epileptic seizure detection methods is particularly important.
[0004] Traditional seizure detection methods, such as TrBoosting, typically train classifiers using manually extracted EEG features. In recent years, deep learning methods have been widely used for seizure detection due to their ability to automatically learn rich feature representations from raw data. Both approaches perform well in patient-specific settings, especially when the models are trained and used on the same patient. However, significant individual variability makes cross-patient deployment challenging.
[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 can 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 between different patients, existing domain incremental learning methods often need to contribute model parameters from different domains simultaneously when training different domains in batches. When the model is migrated to a new domain with a different data distribution (such as different patients), the model suffers from catastrophic forgetting of the previous domain, resulting in low detection accuracy. 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 for further training in subsequent training to circumvent this problem. This leads to the risk of data exposure and is not suitable for medical scenarios such as epilepsy detection where privacy protection is crucial. Summary of the Invention
[0006] In response to the above-mentioned deficiencies 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] To achieve the above objectives, in a first aspect, the present invention provides a method for training an epilepsy detection model, comprising:
[0008] Whenever 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 features of the input data, and perform a dot product 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 in the current training batch includes: 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 in 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 and the corresponding label of each EEG signal of the domain training subset S obtained in the current training stage; the second training goal includes: minimizing the L1 regularization term of each mask matrix in 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 elements are 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 objective including the first training objective.
[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 from 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 under 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 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 a method for detecting epilepsy, comprising:
[0024] Obtain each mask matrix under the corresponding domain of the patient to be tested, and input it into the epilepsy detection model together with the EEG signal of the patient to be tested to obtain the patient's epilepsy detection result;
[0025] The epilepsy detection model is trained by 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.
[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 or 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 method for training an epilepsy detection model. Each time a domain training subset S is acquired for a new patient, a new training batch is started, and the epilepsy detection model is trained based on the domain training subset S within the current training batch. Adaptive pruning is used to assign a subnetwork to each domain, and domain-specific knowledge is learned by combining domain-specific parameters. Sharing parameters effectively leverages knowledge learned in previous domains. While promoting knowledge sharing, adaptive pruning minimizes inter-domain interference, effectively mitigates catastrophic forgetting, and enables accurate epilepsy detection. Furthermore, the present invention eliminates the need to store data from previous domains, effectively protecting data privacy. Consequently, the present invention achieves accurate epilepsy detection while protecting patient data privacy.
[0031] 2. Furthermore, the epilepsy detection model training method provided by the present invention performs a second stage of training in each training batch after completing the first stage of training, thereby reducing the risk of model performance degradation that may be caused by the pruning operation in the first stage, and 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 overall training goal and the second overall training goal also include a third training goal; the third training goal aims to minimize the difference loss between the classification features of each pair of 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 separate the feature representations of samples of different categories, thereby enhancing the discriminability between classes 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. Through Euclidean alignment, the marginal probability distribution of each EEG signal in the domain training subset is aligned, 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 This is a schematic diagram of how performance indicators change when the number of domains increases according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for the purpose of explaining 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 may be combined with each other as long as they do not conflict with each other.
[0037] To achieve the above objectives, in a first aspect, the present invention provides a method for training an epilepsy detection model, comprising:
[0038] Whenever 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 features of the input data, and perform a dot product 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 in 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 in 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 and the corresponding label of each EEG signal of the domain training subset S obtained in the current training stage; the second training goal includes: minimizing the L1 regularization term of each mask matrix in 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 elements are 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 all ones to fully utilize the entire model. Furthermore, to avoid interfering with knowledge learned in previous domains, constraints are added during backpropagation. Only the non-frozen parameters in the epilepsy detection model and the mask matrices for the current domain are adjusted, ensuring that the sub-network parameters corresponding to the previous domain in the model remain unchanged. This allows the new domain to fully learn new knowledge while retaining and leveraging previously acquired knowledge.
[0044] The first phase of training ensures that each domain uses its own sub-network, but some parameters are shared with previous domains. This allows the sub-network to utilize both domain-specific and shared parameters, thereby retaining previously learned knowledge while providing flexibility for new domains. To prevent catastrophic forgetting caused by updating shared parameters, only parameters specific 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 using cross entropy loss function, L2 loss function, cosine similarity loss, hinge loss, etc., which is not limited here.
[0046] In an optional embodiment, in order to reduce the risk of model performance degradation caused by the first-stage pruning operation, the sub-network parameters in the selected model are trained in a second stage. Specifically, the above-mentioned 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 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 objective including the first training objective.
[0049] In an optional embodiment, 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 of the same category can be brought closer, while the feature representations of samples of 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 using 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 embodiment, 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 from 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 under 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 embodiment, 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 greater, 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 embodiment, 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 individual differences in brain activity and external factors, EEG signal data from different patients often 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 decline in overall performance and the problem of individual differences in EEG signals. To address this problem, preferably, in an optional embodiment, the above-mentioned domain training subset is a pre-processed 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] To further illustrate the training method of the epilepsy detection model provided by the present invention, a specific embodiment is described below in detail:
[0061] Scenario: Consider privacy-preserving domain incremental learning for epilepsy detection, assuming that there are T patients, each of whom is considered 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 operations are the same for each domain. The model is trained on all domains in sequence. 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] To reduce inter-domain distribution bias and promote knowledge sharing across domains, the Euclidean alignment (EA) method is used to process the data of the current domain during the data preprocessing stage. For each domain's data, a 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 mean covariance matrix of the data in each domain is converted to the identity matrix. This makes samples from different domains more consistent, 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 features of input data and perform a dot product of the extracted features with the i-th mask matrix under the domain of the input data to obtain 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 a corresponding epilepsy detection result based on the classification feature;
[0071] In this embodiment, N is set to 12. The encoder comprises a cascaded multi-head self-attention module (MHSA), a mask module, and a forward propagation module. The multi-head self-attention module extracts features from the input encoder data. The mask module then performs a dot product of the extracted features with the corresponding mask matrix in the domain of the input data. The mask matrix is then passed through the forward propagation module to obtain the corresponding mask features. In this embodiment, the forward propagation module is a fully connected layer (MLP).
[0072] The multi-head self-attention (MHSA) and fully connected (MLP) layers in the model are adaptively pruned to allocate appropriate subnetworks for 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. These masks are used to identify and retain the most representative key features of each domain.
[0073] For the input feature matrix Feature output F after masking masked for:
[0074] F masked =Mask☉F
[0075] Where Mask∈{0,1} d is a trainable mask, ⊙ represents the dot product, i.e., element-wise multiplication. Each element in the mask represents the importance of the corresponding component in F.
[0076] 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 a specified proportion of elements are retained according to a preset retention rate, with their values set to 1 and the remaining elements 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 together while simultaneously pulling the feature representations of samples of different categories further apart. The supervised consistency regularization term uses label information to define pairs of positive (same category) and negative (different category) samples, thereby constraining the feature representation of each pair of samples. Thus, 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 ones, fully utilizing the entire model. To avoid perturbing knowledge learned in previous domains, we add constraints during backpropagation to ensure that the subnetwork corresponding to the previous domain remains unchanged. This allows the new domain to fully learn new knowledge while retaining and leveraging previously acquired knowledge.
[0080] Let Mask previous represents the part of the network that is 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 Indicates that the 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 sub-network is retrained to mitigate the performance degradation that may be caused by pruning. Although each domain uses its own sub-network during training and inference, some parameters are shared with the previous domain. This design enables 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. Let Mask cur Represents the network part related to the current domain. The update rule of the pruning layer parameters of the current domain 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 after pruning for the current training batch and Mask previous The matrix after element-wise AND operation.
[0087] The epilepsy detection model training method and epilepsy detection method provided by this invention can be applied to epilepsy prediction systems. By constructing a single model and training it sequentially on the data of each patient, good performance is achieved across all patients. This method eliminates the need to save samples from previous patients, effectively protecting data privacy.
[0088] The specific steps are as follows:
[0089] Operation S1: Enter the current domain 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 above, if t = 1, update the model with this loss Otherwise, proceed to operation S4;
[0092] Operation S4: Use Update model based on update rules
[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 the Mask cur ; Mask p The mask matrix after pruning for the current training batch and Mask previous The matrix after element-by-element AND operation;
[0095] Operation S7: Calculate the loss L cur =L CE +L SCL ,use Update rule update 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, perform judgment on all test data from domain 1 to domain t, output the results, and end the operation.
[0098] This paper considers the domain increment scenario in epilepsy detection and proposes a sparse knowledge sharing method that does not require sample replay. This method uses adaptive pruning to assign a subnetwork to each domain. Domain-specific knowledge is learned by combining domain-specific parameters, while shared parameters effectively leverage knowledge learned from previous domains. Adaptive pruning promotes knowledge sharing while minimizing inter-domain interference to mitigate catastrophic forgetting. Furthermore, Euclidean alignment is used to reduce distribution bias between domains, and supervised consistency regularization enhances inter-class discrimination, further improving classification performance.
[0099] Tables 1 and 2 show the epilepsy detection experimental results of the epilepsy detection model training method provided by the present invention (denoted as SKS) and other existing model training methods on two public datasets, CHB-MIT and CHSZ. As can be seen from the tables, the present invention achieves the best BCA, ACC, F1, and BWT values on both datasets, excelling not only in new domains but also in reducing forgetting of previous domains. Notably, the present invention eliminates the need to store samples from previous domains, 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 Figure 1 shows how performance metrics change as the number of domains increases. The left column shows how performance metrics change on the CHB-MIT dataset, while the right column shows how performance metrics change on the CHSZ dataset. As can be seen from the figure, regardless of the number of domains, the proposed method maintains stability across all metrics, effectively balancing flexibility and stability.
[0105] In the above experiments, the domain arrival order was arranged in ascending order according to the patient's serial number, which may have affected the experimental results. To more systematically study the impact of domain order, we changed the domain order in the two datasets and repeated the experiments. Table 3 shows the corresponding results. The experiments show that the proposed method consistently achieves optimal performance, demonstrating its robustness to domain order.
[0106] Table 3 Experimental results on CHB-MIT and CHSZ after shuffling the task order
[0107]
[0108] In summary, this paper provides a sparse knowledge sharing algorithm that prevents catastrophic forgetting due to parameter changes by freezing parameters related to previous domains. Furthermore, by sharing beneficial knowledge from previous domains and using domain-specific parameters to learn knowledge unique to the current domain, this algorithm enables efficient learning of new domains, compressing the model while accommodating more domains. Furthermore, this paper eliminates the need to store data from previous domains, effectively protecting data privacy.
[0109] In a second aspect, the present invention provides a method for detecting epilepsy, comprising:
[0110] Obtain each mask matrix under the corresponding domain of the patient to be tested, and input it into the epilepsy detection model together with the EEG signal of the patient to be tested to obtain the patient's epilepsy detection result;
[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 solutions are 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 are not 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 or 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 are not 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 or 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 are not described in detail here.
[0120] It will be easily understood by those skilled in the art that the above description is merely 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 scope of protection of the present invention.
Claims
1. A training method for an epilepsy detection model, characterized in that: include: Whenever 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 features of the input data, and perform a dot product 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 epilepsy detection model is trained based on the domain training subset S in the current training batch, including: performing the following first stage training: Set all mask matrices under the current domain to all-1 matrices; Input the domain training subset S into the epilepsy detection model, and adjust the non-frozen parameters in the epilepsy detection model and each mask matrix in the current domain 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 and the corresponding label of each EEG signal in the domain training subset S obtained in the current training stage; the second training goal includes: minimizing the L1 regularization term of each mask matrix in 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 elements are 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 epilepsy detection model training method according to claim 1, characterized in that: 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: 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 objective including the first training objective.
3. The epilepsy detection model training method 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 epilepsy detection model training method according to any one of claims 1 to 3, characterized in that: The encoder includes 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 under 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 epilepsy detection model training method according to any one of claims 1 to 3, characterized in that: The classifier is a nearest neighbor classifier.
6. The epilepsy detection model training method according to any one of claims 1 to 3, characterized in that: The domain training subset is a pre-processed 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 patient's epilepsy detection result; The epilepsy detection model is obtained by training the epilepsy detection model training method according to any one of claims 1 to 6; and the mask matrices are the mask matrices under the corresponding domains 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