Double-branch electroencephalogram physiological artifact removal and epilepsy detection method
By employing a dual-branch EEG artifact removal and epilepsy detection method, we have solved the problems of artifact removal destroying epilepsy features and insufficient model robustness in existing technologies. This method achieves high accuracy and low false negative rate in epilepsy detection, adapts to various artifact interference scenarios, and improves training efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIV
- Filing Date
- 2026-01-14
- Publication Date
- 2026-04-21
AI Technical Summary
Existing epilepsy detection technologies are prone to destroying the integrity of epilepsy features when removing EEG artifacts. Single-branch models lack robustness, and the training dataset does not cover mixed scenarios with multiple artifacts. In practical applications, the models have low accuracy, insufficient feature extraction, and ambiguous classification boundaries.
A two-branch EEG artifact removal and epilepsy detection method is adopted. By signal segmentation, quality screening, complex artifact generation, multi-scale feature fusion and adaptive training, a two-branch detection system is constructed, which includes an encoder, decoder and feature extractor. Combining multiple loss functions and attention mechanisms, the artifact removal and epilepsy detection tasks are optimized.
It achieves high accuracy detection in complex artifact scenarios, with low false negative rate, small generalization error, stable training process, model adaptability to epilepsy signals with different interference intensities and types, improved robustness in artifact recognition and removal, and faster training speed.
Smart Images

Figure CN121890950A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electroencephalogram (EEG) signal processing technology, specifically to a method for removing two-branch EEG artifacts and detecting epilepsy. Background Technology
[0002] Electroencephalography (EEG), as a core tool for epilepsy diagnosis, can directly reflect the electrical activity state of neurons in the brain. However, its acquisition process is susceptible to interference from various physiological and environmental artifacts, such as electrooculography (EOG) artifacts, oculomotor (EOG) artifacts, electromyography (EMG) artifacts, power frequency interference, and electrode drift. These artifacts overlap with epileptic features (spikes, sharp waves, etc.) in both the time and frequency domains, leading to reduced accuracy in epilepsy detection and becoming a key bottleneck in clinical diagnosis.
[0003] Current epilepsy detection technologies suffer from the following core shortcomings: Traditional methods typically remove artifacts using algorithms such as wavelet transform and adaptive filtering before extracting and detecting epilepsy features. However, artifact removal can easily compromise the integrity of epilepsy features, leading to a higher false negative rate. Existing deep learning models often employ a single-branch structure, focusing solely on either artifact removal or epilepsy detection, failing to optimize the performance of both simultaneously and exhibiting insufficient robustness in complex artifact-mixed scenarios. Current training datasets primarily consist of single artifacts or simple epilepsy feature samples, failing to cover real-world scenarios with multiple artifacts and varying intensities of interference in clinical settings, resulting in a significant drop in model accuracy in practical applications. Existing models only consider reconstruction loss or classification loss, neglecting to fully utilize the correlation information between the two tasks, leading to insufficient feature extraction and blurred classification boundaries. In view of this, we propose a two-branch EEG artifact removal and epilepsy detection method. Summary of the Invention
[0004] The purpose of this invention is to provide a method for removing bibranch EEG artifacts and detecting epilepsy, so as to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for removing bibranch EEG artifacts and detecting epilepsy, comprising the following steps: S1. Data preprocessing and enhanced generation; S11. Collect EEG signals, perform signal segmentation processing on the EEG signals based on a sliding window, set the window length to 1 second, and map them into a pseudo-spatial information matrix. S12. Perform signal-to-noise ratio (SNR) threshold filtering on the segmented signals, remove low-quality signal segments with SNR below 15dB, and retain valid signals. S13. A complex artifact generator is used to generate a variety of mixed artifacts, including electrooculography artifacts, eye movement artifacts, electromyography artifacts, power frequency interference, electrode burst artifacts, electrode drift artifacts, and cheek movement artifacts. The artifact intensity is dynamically adjusted and the intensity level is divided into 1-3 levels to simulate different clinical interference scenarios. S14. Use a complex epilepsy feature generator to generate multiple combinations of epilepsy features, including spikes, sharp waves, slow waves, and spike-slow wave complexes, and simulate the distribution differences of epilepsy features in different brain regions to generate epilepsy feature samples associated with multiple brain regions. S15. Generate a weakly labeled dataset, which contains three types of samples: normal signals, signals with only artifacts, and signals with epilepsy and artifacts. Each sample randomly contains power frequency interference of different intensities, artifact mixing ratios, and different morphological epilepsy features. S2. Construct a dual-branch detection system; S21, Encoder: Contains multiple 3D convolutional layers, batch normalization layers and ReLU activation function. By learning the weight distribution of different channels of EEG signals, it enhances the extraction of effective feature regions and suppresses artifact interference regions, and is used to extract multidimensional deep features of EEG signals. S22, Bottleneck Layer: An adaptive feature compression algorithm is adopted to dynamically adjust the compression dimension according to the complexity of the input signal. The compression ratio ranges from 2:1 to 5:1, compressing the feature dimension while retaining key information. S23, Branch 1 Decoder: Employs transposed convolutional layers and residual connection structures, focusing on artifact removal and outputting clean EEG signals; S24, Branch 2 Decoder: Employs a multi-scale feature fusion structure, integrates feature maps from different levels of the encoder, focuses on preserving pathological features, and outputs pathological EEG signals; S25, Feature Extractor: Contains a global average pooling layer and a fully connected layer to extract high-order features of the output signals of the two branches for classification; S26. Differential Classifier: Based on a deep neural network, it takes the high-order features of branch 1 and branch 2 as inputs, and performs classification by calculating the feature difference. A branch attention mechanism module is added to weight and fuse the output signals of the two branches according to the weight coefficients to obtain the enhanced output signal. S27. Reconstruction Quality Evaluator: Employs a dual-index fusion evaluation of Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM) to quantify signal reconstruction quality; S3. Loss function design; S31, Branch Reconstruction Loss: The reconstruction loss of the two branches is calculated using mean square error (MSE) and L1 loss to measure the difference between the output signal and the true signal; S32, Branch Difference Loss: L1 distance loss is adopted to encourage moderate differentiation of branch outputs while maintaining general consistency; S33. Classification Loss: The cross-entropy loss function is used to optimize the classification of the three classes of samples. S34, Original Signal Preservation Loss: Calculate the L1 distance between each branch output and the original input to prevent excessive deviation from the original signal; S35. Attention Mechanism Regularization: Calculate the entropy of attention weights as a regularization term to encourage explicit weight allocation; S36, L2 regularization: Apply L2 regularization to the model parameters to prevent overfitting; S4, Training and Optimization; S41. Use a weighted random sampler to balance the three classes of samples, with the sampling weights distributed inversely proportional to the number of samples. S42. The training process is optimized by adjusting the adaptive learning rate. The AdamW optimizer is used, with the initial learning rate set to 1e-4. The learning rate is dynamically adjusted based on the loss ratio of the training set and the validation set. When the validation set loss does not decrease for three consecutive epochs, the learning rate is reduced to 1 / 10 of the original. S43. Use an early stopping strategy to prevent overfitting. Stop training when the accuracy of the validation set increases by less than 0.5% for five consecutive epochs. S5. Epilepsy detection; S51. Input the EEG signal to be detected and perform signal segmentation and quality screening processing in S1. S52. Input the processed signal into the trained dual-branch detection system and output the classification result; S53. Evaluate the confidence level of the classification results. When the confidence level is below 90%, automatically trigger a secondary detection and call the enhanced reasoning mode of the model to improve the accuracy of the judgment. S54. Output the final detection result: Normal, Artifacts Only, Epilepsy + Artifacts.
[0006] Optionally, the pseudo-spatial information matrix described in S1 is constructed by performing a three-dimensional mapping of the time dimension, channel dimension, and frequency dimension of the EEG signal.
[0007] Optionally, the workflow of the branch attention mechanism module described in S2 is as follows: global average pooling is performed on the features extracted from the two branches respectively, the pooled feature vectors are concatenated, the attention weights of the two branches are calculated through two fully connected layers, and then normalized by the Softmax function to obtain the weight coefficients of the two branches. Finally, the output signals of the two branches are weighted and fused according to the weight coefficients to obtain the enhanced output signal.
[0008] Optionally, S4 includes: S44. An adaptive regularization mechanism is introduced to dynamically adjust the L2 regularization coefficient based on the generalization error of the model during training. The coefficient range is 1e-5-1e-3. S45. Mixed precision training is used to accelerate model convergence, while gradient clipping strategy is combined to limit the gradient norm to within 5.0 to avoid gradient explosion.
[0009] Optionally, S3 includes: classification loss processing, calculating the classification result output by branch 1 and the classification result output by branch 2 and inputting them into the fusion classifier as the final classification result, utilizing the complementary information of the two branches.
[0010] Optionally, the formula for calculating the branch reconstruction loss described in S3 is as follows: ; Where N is the batch size. Let be the original input signal of the i-th sample. The sample labels are (0 = normal, 1 = artifact only, 2 = epilepsy + artifact). The output signal of branch k (k=1,2) For label-based weighting functions, This is the loss function type.
[0011] This invention also proposes a dual-branch EEG artifact removal and epilepsy detection system, comprising: Signal preprocessing module: used to perform EEG signal segmentation, quality screening, pseudo-spatial mapping, artifact generation, epilepsy feature generation, and weak label dataset construction; Dual-branch detection model module: includes encoder, bottleneck layer, branch 1 decoder, branch 2 decoder, feature extractor, differential classifier and reconstruction quality evaluator; Loss function calculation module: used to calculate the branch reconstruction loss, branch difference loss, classification loss, original signal preservation loss, attention mechanism regularization and L2 regularization described in S3; Model training optimization module: used to perform sampling, learning rate adjustment, early stopping, regularization and mixed precision training operations in S4; Signal detection module: Used to receive the EEG signal to be detected, call the dual-branch detection model module to output the classification result, and perform confidence assessment and secondary detection.
[0012] Compared with existing technologies, this invention provides a method for removing bibranch EEG artifacts and detecting epilepsy, which has the following beneficial effects: 1. This dual-branch EEG artifact removal and epilepsy detection method achieves accurate detection in complex artifact scenarios through signal segmentation and quality screening, attention mechanism, multi-scale feature fusion, and contrast loss technology, with an accuracy rate of over 97%. The robustness of the identification and removal of 2-4 mixed artifacts is improved by more than 10% compared with existing methods.
[0013] 2. This dual-branch EEG artifact removal and epilepsy detection method combines a dual-branch parallel design with a multi-scale feature fusion structure, allowing branch 1 to focus on artifact removal and branch 2 to focus on pathological feature preservation. This solves the feature loss problem caused by traditional step-by-step processing, reducing the false negative rate to below 2%. At the same time, through dynamic artifact intensity adjustment, multi-brain region epilepsy feature generation, and adaptive training guided by auxiliary labels, the model can be adapted to epilepsy signals with different interference intensities and seizure types in clinical practice, reducing the generalization error by 15%-20%.
[0014] 3. This dual-branch EEG artifact removal and epilepsy detection method improves the model training speed by 2-3 times through the fusion of multiple strategies such as mixed precision training, adaptive learning rate, adaptive regularization, and gradient clipping, while effectively suppressing overfitting and gradient explosion, and improving the stability of the training process by 40%. Attached Figure Description
[0015] Figure 1 This is a schematic diagram comparing artifact removal and epilepsy detection using the present invention and existing methods. Figure 2 This is a schematic diagram illustrating the results of mapping the information to a pseudo-spatial information matrix and adding epilepsy features according to the present invention. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] like Figure 1-2 As shown, the present invention provides a technical solution: a method for removing bibranch EEG artifacts and detecting epilepsy, comprising the following steps: S1. Data preprocessing and enhanced generation; S11. Collect EEG signals, perform signal segmentation processing on the EEG signals based on a sliding window, set the window length to 1 second, and map them into a pseudo-spatial information matrix. S12. Perform signal-to-noise ratio (SNR) threshold filtering on the segmented signals, remove low-quality signal segments with SNR below 15dB, and retain valid signals. S13. A complex artifact generator is used to generate a variety of mixed artifacts, including electrooculography artifacts, eye movement artifacts, electromyography artifacts, power frequency interference, electrode burst artifacts, electrode drift artifacts, and cheek movement artifacts. The artifact intensity is dynamically adjusted and the intensity level is divided into 1-3 levels to simulate different clinical interference scenarios. S14. Use a complex epilepsy feature generator to generate multiple combinations of epilepsy features, including spikes, sharp waves, slow waves, and spike-slow wave complexes, and simulate the distribution differences of epilepsy features in different brain regions to generate epilepsy feature samples associated with multiple brain regions. S15. Generate a weakly labeled dataset, which contains three types of samples: normal signals, signals with only artifacts, and signals with epilepsy and artifacts. Each sample randomly contains power frequency interference of different intensities, artifact mixing ratios, and different morphological epilepsy features. The pseudo-spatial information matrix is constructed by mapping the time dimension, channel dimension, and frequency dimension of the EEG signal in three dimensions, with a transformation window size of 5×5×125. S2. Construct a dual-branch detection system; S21, Encoder: Contains multiple 3D convolutional layers, batch normalization layers and ReLU activation function. By learning the weight distribution of different channels of EEG signals, it enhances the extraction of effective feature regions and suppresses artifact interference regions, and is used to extract multidimensional deep features of EEG signals. S22, Bottleneck Layer: An adaptive feature compression algorithm is adopted to dynamically adjust the compression dimension according to the complexity of the input signal. The compression ratio ranges from 2:1 to 5:1, compressing the feature dimension while retaining key information. S23, Branch 1 Decoder: Employs transposed convolutional layers and residual connection structures, focusing on artifact removal and outputting clean EEG signals; S24, Branch 2 Decoder: Employs a multi-scale feature fusion structure, integrates feature maps from different levels of the encoder, focuses on preserving pathological features, and outputs pathological EEG signals; S25, Feature Extractor: Contains a global average pooling layer and a fully connected layer to extract high-order features of the output signals of the two branches for classification; S26. Differential Classifier: Based on a deep neural network, it takes the high-order features of branch 1 and branch 2 as inputs, and performs classification by calculating the feature difference. A branch attention mechanism module is added to weight and fuse the output signals of the two branches according to the weight coefficients to obtain the enhanced output signal. S27. Reconstruction Quality Evaluator: Employs a dual-index fusion evaluation of Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM) to quantify signal reconstruction quality; The workflow of the branch attention mechanism module is as follows: global average pooling is performed on the features extracted from the two branches respectively, the pooled feature vectors are concatenated, the attention weights of the two branches are calculated through two fully connected layers, and then normalized by the Softmax function to obtain the weight coefficients of the two branches. Finally, the output signals of the two branches are weighted and fused according to the weight coefficients to obtain the enhanced output signal.
[0018] S3. Loss function design; S31, Branch Reconstruction Loss: The reconstruction loss of the two branches is calculated using mean square error (MSE) and L1 loss to measure the difference between the output signal and the true signal; S32, Branch Difference Loss: L1 distance loss is adopted to encourage moderate differentiation of branch outputs while maintaining general consistency; S33. Classification Loss: The cross-entropy loss function is used to optimize the classification of the three classes of samples. S34, Original Signal Preservation Loss: Calculate the L1 distance between each branch output and the original input to prevent excessive deviation from the original signal; S35. Attention Mechanism Regularization: Calculate the entropy of attention weights as a regularization term to encourage explicit weight allocation; S36, L2 regularization: Apply L2 regularization to the model parameters to prevent overfitting; The formula for calculating the branch reconstruction loss is as follows: ; Where N is the batch size. Let be the original input signal of the i-th sample. The sample labels are (0 = normal, 1 = artifact only, 2 = epilepsy + artifact). The output signal of branch k (k=1,2) For label-based weighting functions, This is the loss function type.
[0019] S4, Training and Optimization; S41. Use a weighted random sampler to balance the three classes of samples, with the sampling weights distributed inversely proportional to the number of samples. S42. The training process is optimized by adjusting the adaptive learning rate. The AdamW optimizer is used, with the initial learning rate set to 1e-4. The learning rate is dynamically adjusted based on the loss ratio of the training set and the validation set. When the validation set loss does not decrease for three consecutive epochs, the learning rate is reduced to 1 / 10 of the original. S43. Use an early stopping strategy to prevent overfitting. Stop training when the accuracy of the validation set increases by less than 0.5% for five consecutive epochs. S44. An adaptive regularization mechanism is introduced to dynamically adjust the L2 regularization coefficient based on the generalization error of the model during training. The coefficient range is 1e-5-1e-3. S45. Mixed precision training is used to accelerate model convergence, while gradient clipping strategy is combined to limit the gradient norm to within 5.0 to avoid gradient explosion.
[0020] S5. Epilepsy detection; S51. Input the EEG signal to be detected and perform signal segmentation and quality screening processing in S1. S52. Input the processed signal into the trained dual-branch detection system and output the classification result; S53. Evaluate the confidence level of the classification results. When the confidence level is below 90%, automatically trigger a secondary detection and call the enhanced reasoning mode of the model to improve the accuracy of the judgment. S54. Output the final detection result: Normal, Artifacts Only, Epilepsy + Artifacts.
[0021] A dual-branch EEG artifact removal and epilepsy detection system includes: a signal preprocessing module, a dual-branch detection model module, a loss function calculation module, a model training and optimization module, and a signal detection module.
[0022] It is worth noting that the signal preprocessing module is used to perform EEG signal segmentation, quality screening, pseudo-space mapping, artifact generation, epilepsy feature generation, and weak label dataset construction; the dual-branch detection model module includes an encoder, bottleneck layer, branch 1 decoder, branch 2 decoder, feature extractor, differential classifier, and reconstruction quality evaluator. The loss function calculation module is used to calculate the branch reconstruction loss, branch difference loss, classification loss, original signal preservation loss, attention mechanism regularization and L2 regularization mentioned in S3; the model training optimization module is used to perform sampling, learning rate adjustment, early stopping, regularization and mixed precision training operations in S4; the signal detection module is used to receive the EEG signal to be detected, call the dual-branch detection model module to output the classification result, and perform confidence assessment and secondary detection.
[0023] The present invention has been described in detail above. However, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, any modifications or improvements that do not depart from the spirit of the present invention are within the scope of protection of the present invention.
Claims
1. A method for removing bibranch EEG artifacts and detecting epilepsy, characterized in that, Includes the following steps: S1. Data preprocessing and enhanced generation; S11. Collect EEG signals, perform signal segmentation processing on the EEG signals based on a sliding window, set the window length to 1 second, and map them into a pseudo-spatial information matrix. S12. Perform signal-to-noise ratio (SNR) threshold filtering on the segmented signals, remove low-quality signal segments with SNR below 15dB, and retain valid signals. S13. A complex artifact generator is used to generate a variety of mixed artifacts, including electrooculography artifacts, eye movement artifacts, electromyography artifacts, power frequency interference, electrode burst artifacts, electrode drift artifacts, and cheek movement artifacts. The artifact intensity is dynamically adjusted and the intensity level is divided into 1-3 levels to simulate different clinical interference scenarios. S14. Use a complex epilepsy feature generator to generate multiple combinations of epilepsy features, including spikes, sharp waves, slow waves, and spike-slow wave complexes, and simulate the distribution differences of epilepsy features in different brain regions to generate epilepsy feature samples associated with multiple brain regions. S15. Generate a weakly labeled dataset, which contains three types of samples: normal signals, signals with only artifacts, and signals with epilepsy and artifacts. Each sample randomly contains power frequency interference of different intensities, artifact mixing ratios, and different morphological epilepsy features. S2. Construct a dual-branch detection system; S21, Encoder: Contains multiple 3D convolutional layers, batch normalization layers and ReLU activation function. By learning the weight distribution of different channels of EEG signals, it enhances the extraction of effective feature regions and suppresses artifact interference regions, and is used to extract multidimensional deep features of EEG signals. S22, Bottleneck Layer: An adaptive feature compression algorithm is adopted to dynamically adjust the compression dimension according to the complexity of the input signal. The compression ratio ranges from 2:1 to 5:1, compressing the feature dimension while retaining key information. S23, Branch 1 Decoder: Employs transposed convolutional layers and residual connection structures, focusing on artifact removal and outputting clean EEG signals; S24, Branch 2 Decoder: Employs a multi-scale feature fusion structure, integrates feature maps from different levels of the encoder, focuses on preserving pathological features, and outputs pathological EEG signals; S25, Feature Extractor: Contains a global average pooling layer and a fully connected layer to extract high-order features of the output signals of the two branches for classification; S26. Differential Classifier: Based on a deep neural network, it takes the high-order features of branch 1 and branch 2 as inputs, and performs classification by calculating the feature difference. A branch attention mechanism module is added to weight and fuse the output signals of the two branches according to the weight coefficients to obtain the enhanced output signal. S27. Reconstruction Quality Evaluator: Employs a dual-index fusion evaluation of Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM) to quantify signal reconstruction quality; S3. Loss function design; S31, Branch Reconstruction Loss: The reconstruction loss of the two branches is calculated using mean square error (MSE) and L1 loss to measure the difference between the output signal and the true signal; S32, Branch Difference Loss: L1 distance loss is adopted to encourage moderate differentiation of branch outputs while maintaining general consistency; S33. Classification Loss: The cross-entropy loss function is used to optimize the classification of the three classes of samples. S34, Original Signal Preservation Loss: Calculate the L1 distance between each branch output and the original input to prevent excessive deviation from the original signal; S35. Attention Mechanism Regularization: Calculate the entropy of attention weights as a regularization term to encourage explicit weight allocation; S36, L2 Regularization: Apply L2 regularization to the model parameters to prevent overfitting; S4, Training and Optimization; S41. Use a weighted random sampler to balance the three classes of samples, with the sampling weights distributed inversely proportional to the number of samples. S42. The training process is optimized by adjusting the adaptive learning rate. The AdamW optimizer is used, with the initial learning rate set to 1e-4. The learning rate is dynamically adjusted based on the loss ratio of the training set and the validation set. When the validation set loss does not decrease for three consecutive epochs, the learning rate is reduced to 1 / 10 of the original. S43. Use an early stopping strategy to prevent overfitting. Stop training when the accuracy of the validation set increases by less than 0.5% for five consecutive epochs. S5. Epilepsy detection; S51. Input the EEG signal to be detected and perform signal segmentation and quality screening processing in S1. S52. Input the processed signal into the trained dual-branch detection system and output the classification result; S53. Evaluate the confidence level of the classification results. When the confidence level is below 90%, automatically trigger a secondary detection and call the enhanced reasoning mode of the model to improve the accuracy of the judgment. S54. Output the final detection result: normal, artifacts only, epilepsy + artifacts.
2. The method for removing bibranch EEG artifacts and detecting epilepsy according to claim 1, characterized in that, The pseudo-spatial information matrix described in S1 is constructed by mapping the time dimension, channel dimension, and frequency dimension of the EEG signal in three dimensions.
3. The method for removing bibranch EEG artifacts and detecting epilepsy according to claim 1, characterized in that, The workflow of the branch attention mechanism module described in S2 is as follows: global average pooling is performed on the features extracted from the two branches respectively, the pooled feature vectors are concatenated, the attention weights of the two branches are calculated through two fully connected layers, and then normalized by the Softmax function to obtain the weight coefficients of the two branches. Finally, the output signals of the two branches are weighted and fused according to the weight coefficients to obtain the enhanced output signal.
4. The method for removing bibranch EEG artifacts and detecting epilepsy according to claim 1, characterized in that, S4 includes: S44. An adaptive regularization mechanism is introduced to dynamically adjust the L2 regularization coefficient based on the generalization error of the model during training. The coefficient range is 1e-5-1e-3. S45. Mixed precision training is used to accelerate model convergence, while gradient clipping strategy is combined to limit the gradient norm to within 5.0 to avoid gradient explosion.
5. The method for removing bibranch EEG artifacts and detecting epilepsy according to claim 1, characterized in that, The S3 includes: classification loss processing, calculating the classification results output by branch 1 and branch 2 and inputting them into the fusion classifier as the final classification result, utilizing the complementary information of the two branches.
6. The method for removing bibranch EEG artifacts and detecting epilepsy according to claim 5, characterized in that, The formula for calculating the branch reconstruction loss described in S3 is as follows: ; Where N is the batch size. Let be the original input signal of the i-th sample. The sample labels are (0 = normal, 1 = artifact only, 2 = epilepsy + artifact). The output signal of branch k (k=1,2) For label-based weighting functions, This is the loss function type.
7. A detection system for the dual-branch EEG artifact removal and epilepsy detection method as described in any one of claims 1-6, characterized in that, include: Signal preprocessing module: used to perform EEG signal segmentation, quality screening, pseudo-spatial mapping, artifact generation, epilepsy feature generation, and weak label dataset construction; Dual-branch detection model module: includes encoder, bottleneck layer, branch 1 decoder, branch 2 decoder, feature extractor, differential classifier and reconstruction quality evaluator; Loss function calculation module: used to calculate the branch reconstruction loss, branch difference loss, classification loss, original signal preservation loss, attention mechanism regularization and L2 regularization described in S3; Model training optimization module: used to perform sampling, learning rate adjustment, early stopping, regularization and mixed precision training operations in S4; Signal detection module: Used to receive the EEG signal to be detected, call the dual-branch detection model module to output the classification result, and perform confidence assessment and secondary detection.