A system and method for simultaneous detection of seizures and discrimination of seizure types
By integrating multi-scale spatiotemporal-frequency feature fusion and cross-task attention interaction modules, combined with multi-task learning optimization modules, a unified model framework is constructed. This solves the problem of independent modeling of epileptic seizure detection and type classification, achieving efficient and accurate epileptic seizure identification and type discrimination, and adapting to imbalanced data scenarios.
Patent Information
- Application Number
- CN202610742314.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-27
- Publication Date
- 2026-08-25
AI Technical Summary
In existing technologies, epileptic seizure detection and seizure type classification are usually processed using independent models, resulting in low system computational efficiency, insufficient feature utilization, limited generalization ability in cross-subject and multi-center data scenarios, and difficulty in achieving cross-task information sharing.
A unified model framework is constructed by employing a multi-scale spatiotemporal-frequency feature fusion module, a cross-task attention interaction module, and a multi-task learning optimization module to achieve collaborative modeling of epileptic seizure detection and seizure type classification. By sharing feature representations and cross-task information interaction, the recognition accuracy and robustness are improved.
This approach achieves synergistic optimization of epileptic seizure detection and seizure type classification within a single model framework, reducing system computational complexity, improving model generalization ability, enhancing recognition accuracy and stability, adapting to imbalanced data conditions, and reducing computational overhead.
Smart Images

Figure CN122624010A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of intelligent analysis and pattern recognition of electroencephalogram (EEG) signals, and in particular to a system and method for simultaneously detecting and classifying epileptic seizures. Background Technology
[0002] Epilepsy is a chronic neurological disorder caused by abnormal synchronous discharges of neurons in the brain, affecting tens of millions of people worldwide. Epileptic seizures are characterized by their sudden onset, complex manifestations, and significant differences in seizure types. Different seizure types exhibit marked differences in underlying pathological mechanisms, abnormal brain network dynamics, and treatment strategies. Therefore, in clinical practice, accurately identifying the timing of epileptic seizures and further differentiating their types is crucial for assisting in epilepsy diagnosis, developing individualized treatment plans, and conducting long-term disease management. Currently, the clinical diagnosis of epilepsy primarily relies on neurologists manually interpreting long-term electroencephalogram (EEG) recordings. However, continuous EEG monitoring typically generates large amounts of data, and manual segment-by-segment analysis is not only inefficient but also susceptible to variations in physician experience and subjective factors, failing to meet the demands of large-scale long-term monitoring and intelligent healthcare. Therefore, automated epileptic seizure analysis technology based on EEG signals is gradually becoming an important research direction in the fields of neuroengineering and intelligent healthcare.
[0003] During an epileptic seizure, the abnormal synchronization and propagation of neural activity in different brain regions leads to significant changes in the time-domain waveform, spectral characteristics, and spatial network structure of the electroencephalogram (EEG). Utilizing these differences, current research primarily focuses on two types of tasks: seizure detection (SD), used to identify whether an epileptic seizure event occurs in the EEG signal; and seizure type classification (SC), used to further determine the type of an epileptic seizure that has already occurred. Existing techniques typically construct separate models for these two tasks, for example, using convolutional neural networks, multi-scale feature extraction, or sequence modeling methods for seizure detection, or using spectral features and time-frequency structure analysis for seizure type classification.
[0004] However, modeling seizure detection and seizure type classification as independent tasks still has certain limitations. First, seizure type classification often relies on the seizure onset, phase changes, and dynamic features of brain networks revealed by seizure detection, while existing independent models struggle to achieve cross-task information sharing. Second, while standalone seizure detection models can identify seizure events, they cannot provide seizure subtype information, making it difficult to directly support clinical diagnosis and treatment decisions. Furthermore, running multiple models separately in practical system deployments increases system complexity and computational overhead, and may lead to inconsistencies between detection and classification results. On the other hand, epilepsy EEG data often exhibits significant class imbalance in practical applications, meaning there are large differences in the number of samples for different seizure types. This data distribution characteristic easily affects model training stability and recognition performance, especially in scenarios involving multiple subjects and multi-center data.
[0005] Therefore, how to achieve collaborative modeling of epileptic seizure detection and seizure type classification within a unified framework, while improving the model's adaptability to imbalanced data and reducing system deployment complexity and computational overhead, has become a pressing technical problem in the field of EEG intelligent analysis. Summary of the Invention
[0006] To address the shortcomings of existing technologies that typically employ independent models for epileptic seizure detection and seizure type classification, leading to low computational efficiency, insufficient feature utilization, and limited generalization capabilities in scenarios involving multiple subjects and multi-center data, this invention proposes a system and method for simultaneous detection and type differentiation of epileptic seizures. This method achieves collaborative modeling of epileptic seizure detection and seizure type classification within a unified model framework. By sharing feature representations and engaging in cross-task information interaction, it improves the accuracy, robustness, and clinical application value of epileptic seizure identification while maintaining computational efficiency.
[0007] The present invention is implemented using the following technical solution: A system for synchronously detecting and classifying epileptic seizures, the system comprising an EEG signal processing module, a multi-scale spatiotemporal-frequency feature EEG fusion module, an epileptic seizure detection task branch, a cross-task attention interaction module, an epileptic seizure type classification branch, and a multi-task learning optimization module; The EEG signal processing module performs data preprocessing on the raw EEG signals to ensure the consistency and comparability of EEG data from different sources; The multi-scale time-space-frequency feature EEG fusion module is used to jointly model EEG signals at different time scales, spatial channels and spectral dimensions, and extract high-order feature representations that characterize the dynamic changes of epileptic seizures. The epileptic seizure detection task branch is used to determine whether an epileptic seizure event exists in the current EEG signal segment; The cross-task attention interaction module establishes a feature-level information interaction mechanism to achieve bidirectional feature sharing between task branches, enabling the epilepsy seizure detection task to improve detection accuracy by utilizing fine-grained structural information related to seizure type, while enabling the seizure type classification task to utilize the seizure time location and context information provided by the detection task. The epileptic seizure type classification branch is used to identify the seizure type when an epileptic seizure is detected; The multi-task learning optimization module performs collaborative training on the seizure detection task and the seizure type task through a multi-task optimization objective function, and combines an adaptive category weighting strategy to train the system's stability and classification ability.
[0008] Furthermore, the multi-scale spatiotemporal-frequency feature EEG fusion module includes an EEG temporal domain multi-scale feature extraction unit, an EEG spatial domain brain region connectivity unit, an EEG multi-level frequency domain feature unit, and an EEG multi-dimensional feature fusion unit. The EEG time-domain multi-scale feature extraction unit inputs multiple one-dimensional convolutional layers with different kernel sizes into EEG signal segments in parallel, and splices time features of different degrees to obtain EEG time-domain multi-scale features. The EEG spatial domain brain region connectivity unit establishes spatial dependencies between brain regions based on EEG convolution operations to obtain spatial features that reflect the collaborative activity patterns between different brain regions. The EEG multi-level frequency domain feature unit converts the time-domain EEG signal into a time-frequency representation through short-time Fourier transform, and then uses a two-dimensional convolutional network to extract and fuse the frequency domain features of the time-frequency representation to obtain the EEG frequency domain feature representation. The EEG multi-dimensional feature fusion unit fuses time-domain features, spatial-domain features, and frequency-domain features to obtain shared features.
[0009] Furthermore, the cross-task attention interaction module includes a first task feature projection layer, a second task feature projection layer, a first cross-task attention interaction unit, a second cross-task attention interaction unit, a first cross-task feature update unit, and a second cross-task feature update unit. The first task feature layer combines the shared features with the relevant weight matrix and bias terms of the epilepsy seizure detection task branch to generate detection task features; The second task feature projection layer combines the shared features with the relevant weight matrix and bias terms of the epilepsy seizure type classification branch to generate classification task features; The first task attention interaction unit uses classification task features as query vectors and detection task features as keys and values to perform task attention interaction to obtain the fusion classification task information and the resulting epidemiological detection features. The second task attention interaction unit uses the detection task features as the query vector and the classification task features as the key and value to perform attention interaction to obtain the type classification features after fusing the detection task information; The first cross-task feature update unit combines the detection task features with the epidural detection features after fusing classification task information to obtain collaborative detection task features; The second cross-task feature update unit combines the classification task features with the type classification features obtained after fusing detection task information to obtain collaborative classification task features.
[0010] Furthermore, the multi-task learning optimization module performs joint training on the epileptic seizure detection task and the seizure type classification task, including: the epileptic seizure detection task is trained under supervision over all time windows, while the seizure type classification task is trained only on EEG signal segments labeled as epileptic seizures.
[0011] Furthermore, the multi-task optimization objective function is composed of a loss function for the seizure detection task and a loss function for the seizure type classification task, wherein: The loss function for the seizure detection task performs a binary classification judgment on each time window according to the following formula in the seizure detection task, which is used to identify whether the time window belongs to the epileptic seizure period. Where: T is the total number of time windows; The loss function for the seizure type classification task is trained in a supervised manner on the time window labeled as an epileptic seizure according to the following formula for the seizure type classification task. in: This is a set of epileptic seizure windows.
[0012] The present invention can also adopt the following technical solution: a method for simultaneous detection and type discrimination of epileptic seizures, comprising: Step 1: Acquire raw EEG signals and perform data preprocessing to obtain EEG signal fragments; Step 2: Input the EEG signal fragment into the multi-scale spatiotemporal-frequency feature fusion module to extract the shared features of the multi-dimensional feature representation of the EEG signal; Step 3: Input the shared features into the seizure detection branch and the seizure type classification branch, and realize the feature information exchange between the two task branches through the cross-task attention interaction module; including: 3.1 Shared features The input is fed into two task feature projection layers to generate feature representations for the seizure detection task and the seizure type classification task, respectively: in: and This represents the task-specific projection weight matrix. and For bias terms, and For feature projection vectors of different tasks; 3.2 Classification task characteristics by seizure type Characteristics of the seizure detection task Guided by using classification task features as query vectors and detection task features as keys and values, cross-task attention computation is constructed: in: , and The learnable parameter matrix; 3.3 Calculate the cross-task attention weights and update the detection task features according to the following formula: in, The dimension of the vector is represented by the attention interaction described above, which allows us to obtain the seizure detection features after fusing information from the classification task. ; 3.4 Detecting Task Features As a query vector, and features of the classification task As keys and values, this allows the detection task to guide the features of the classification task: 3.5 Calculate the attention weights and update the classification task features according to the following formula: in, , and Given the learnable parameter matrix for this path, the type classification features after fusing detection task information can be obtained through the above calculations. ; The features obtained from cross-task interactions are used as the updated features for the two task branches and then input into the subsequent prediction layer. Step 4: Use the multi-task learning optimization module to jointly train the two tasks and output the epileptic seizure detection results and the corresponding seizure type classification results.
[0013] Beneficial effects This invention constructs a multi-scale spatiotemporal-frequency feature fusion network to jointly model the dynamic changes of EEG signals in the temporal, spatial, and spectral dimensions, thereby capturing the complex evolutionary features of EEG signals during epileptic seizures. Building upon shared feature encoding, this invention further introduces a cross-task attention interaction mechanism. While maintaining the respective discrimination objectives of the seizure detection and seizure type classification tasks, it achieves selective information sharing and collaborative optimization between tasks, thereby improving the model's comprehensive ability to identify epileptic seizure events and their subtypes. Specifically, this invention first preprocesses the input EEG signal segments and constructs multi-scale feature representations. High-level semantic features are extracted through a shared spatiotemporal-frequency encoder to characterize the comprehensive properties of EEG signals at different time scales, brain region spatial distribution, and spectral structure. Subsequently, these shared features are input to two task branches for epileptic seizure detection and epileptic seizure type classification, respectively. The seizure detection branch determines whether an epileptic seizure event exists in the current EEG signal segment; the seizure subtype classification branch further identifies the specific seizure type if a seizure is detected.
[0014] To fully utilize the complementary information between the two tasks, this invention designs a cross-task attention interaction module between the two task branches, enabling bidirectional information exchange between different task branches in the feature space. Through this mechanism, the seizure detection task can utilize fine-grained structural information related to seizure type to improve detection accuracy, while the seizure type classification task can utilize the seizure time localization and contextual information provided by the detection task to enhance classification and discrimination capabilities. Furthermore, addressing the common problem of uneven class distribution in clinical EEG data, this invention introduces multi-task learning optimization during training, assigning differentiated weights to samples of different classes, thereby mitigating the adverse effects of sample imbalance on model training and further improving the model's recognition performance on seizure types in small sample sizes.
[0015] The method of this invention mainly includes the following core modules: (1) Multi-scale spatiotemporal-frequency feature fusion module This technology is used to jointly model EEG signals across different time scales, spatial channels, and spectral dimensions, and extract high-order feature representations that can characterize the dynamic changes of epileptic seizures.
[0016] (2) Cross-task attention interaction module This mechanism is used to establish a feature-level information exchange mechanism between epilepsy seizure detection and seizure subtype classification tasks, enabling selective information sharing between tasks and thus improving overall recognition performance.
[0017] (3) Multi-task learning optimization module By using a joint loss function to co-train the seizure detection task and the seizure type classification task, and combining an adaptive class weighting strategy, the training stability and classification ability of the model under uneven data conditions are improved.
[0018] With the synergistic effect of the above modules, the present invention can achieve synergistic optimization of epileptic seizure detection and seizure subtype classification within a single model framework, reduce system computational complexity and improve model generalization ability, thereby providing an efficient and reliable intelligent analysis method for continuous EEG monitoring and clinical auxiliary diagnosis.
[0019] Experimental results show that the method of the present invention is superior to existing methods in terms of seizure detection performance, seizure subtype identification accuracy and computational efficiency, and significantly reduces model parameter size and inference latency while maintaining high identification accuracy. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of an epileptic seizure detection and type classification system based on a multi-task neural network according to an embodiment of the present invention. It mainly includes a multi-scale spatiotemporal-frequency feature fusion module, a cross-task attention interaction module, and a multi-task learning optimization module.
[0021] Figure 2 This is a schematic diagram of the cross-task attention interaction module in an embodiment of the present invention, illustrating the bidirectional attention information interaction mechanism between the seizure detection task and the seizure type classification task.
[0022] Figure 3 This is a confusion matrix of the classification results of the epileptic seizure detection task on four EEG datasets in the embodiment of the present invention, used to demonstrate the model's ability to identify the seizure phase and the interictal phase.
[0023] Figure 4 This is a visualization of the two-dimensional t-SNE features of the epileptic seizure type classification task on four EEG datasets in the embodiment of the present invention, used to show the distribution of features of different seizure types in low-dimensional space. Detailed Implementation
[0024] like Figure 1 As shown, this embodiment provides a seizure detection and seizure type classification system based on a multi-task neural network. This method collaboratively implements two tasks—seizure detection (SD) and seizure type classification (SC)—within a unified model architecture. Through shared feature representations and inter-task information interaction, it achieves collaborative learning of the neurodynamic features related to seizures.
[0025] Specifically, the input to the seizure detection and seizure type classification system is a segment of acquired electroencephalogram (EEG) signals. First, a data preprocessing step is performed to obtain a standardized input signal. Then, the preprocessed EEG signal is input to a multi-scale spatiotemporal-frequency feature fusion module to extract multi-dimensional EEG data feature representations reflecting epileptic activity in terms of time dimension, spatial channel distribution, and spectral structure. The shared EEG feature representation output by the multi-scale spatiotemporal-frequency feature fusion module is split into two task branches, used for the seizure detection task (SD) and the seizure type classification task (SC), respectively. The seizure detection task branch (SD) is used to determine whether an epileptic seizure event exists in the current EEG signal segment; the seizure type classification branch (SC) is used to further identify the specific seizure type if a seizure is detected.
[0026] To fully utilize the complementary information between the two tasks, a cross-task attention interaction module is established between the two task branches. This module enables bidirectional feature sharing between task branches by establishing a feature-level information exchange mechanism. This allows the epilepsy seizure detection task to improve detection accuracy using fine-grained structural information related to seizure type, while simultaneously enabling the seizure type classification task to enhance classification ability by utilizing the seizure time localization and contextual information provided by the detection task. The specific structure of the cross-task attention interaction module is as follows: Figure 2 As shown.
[0027] During the model training phase, a multi-task learning optimization module was used to jointly train the epileptic seizure detection task and the seizure type classification task. The epileptic seizure detection task underwent supervised learning across all time windows, while the seizure type classification task was trained only on EEG signal segments labeled as epileptic seizures. Furthermore, to address the uneven class distribution problem commonly found in clinical EEG data, an adaptive class weighting strategy was introduced during training, assigning differentiated weights to samples of different classes to improve the model's ability to identify seizure types with limited sample counts.
[0028] Through the synergistic effect of the above modules, this invention enables joint modeling and collaborative optimization of epileptic seizure detection and seizure type classification within a single model framework, thereby improving recognition accuracy and model generalization ability while ensuring computational efficiency. Ultimately, the system output includes epileptic seizure detection results and corresponding seizure type classification results.
[0029] In this embodiment, the overall processing flow of the method mainly includes the following steps: Step 1: Acquire raw EEG signals and perform data preprocessing to obtain standardized EEG signal fragments.
[0030] Step 2: Input the EEG signal fragment into the multi-scale spatiotemporal-frequency feature fusion module to extract the multidimensional feature representation of the EEG signal.
[0031] Step 3: Input the extracted shared features into the epileptic seizure detection branch and the epileptic seizure type classification branch, and realize the feature information interaction between the two task branches through the cross-task attention interaction module.
[0032] Step 4: Use the multi-task learning optimization module to jointly train the two tasks and output the epileptic seizure detection results and the corresponding seizure type classification results.
[0033] 1. Data Preprocessing In this embodiment, to ensure the consistency and comparability of EEG data from different sources, the acquired raw EEG signals are first preprocessed. The data preprocessing process mainly includes steps such as channel standardization, signal resampling, signal filtering, and sample construction.
[0034] First, to unify the spatial channel configuration of multi-center EEG data, a reference electrode configuration based on the international 10-20 electrode positioning system was selected. This channel selection ensures channel uniformity across different EEG data recordings. Next, the EEG signals were resampled, uniformly resampled to 200 Hz from the original EEG signals with different sampling rates to ensure temporal scale consistency in subsequent feature extraction. Then, the resampled EEG signals were filtered. First, a bandpass filter from 0.5 Hz to 100 Hz was used to filter the signal to remove low-frequency baseline drift and high-frequency noise interference. Simultaneously, a 50 Hz or 60 Hz notch filter was further used to suppress power line interference, depending on the power frequency of the actual acquisition environment. After signal filtering, samples were constructed from the continuous EEG recordings. Specifically, the continuous EEG signals were segmented according to fixed time windows. In this embodiment, a non-overlapping time window of 4 seconds was used to segment the EEG signals, thereby obtaining multiple EEG signal segment samples.
[0035] Regarding sample label construction, for the epileptic seizure detection task, each EEG signal segment is binary-classified and labeled as either ictal or interictal based on the overlap between the EEG signal segments and the time intervals of epileptic seizures annotated by experts. For the epileptic seizure type classification task, only EEG signal segments labeled as ictal are assigned the corresponding seizure type label, while interictal EEG signal segments are not included in the loss calculation during the training process of the classification task. Furthermore, to evaluate the model's generalization ability across different patients, a cross-subject data partitioning strategy is adopted during data splitting. The training set, validation set, and test set are divided according to the patient dimension, ensuring that subjects in different datasets do not overlap, thus avoiding data leakage problems caused by subject-specific EEG characteristics.
[0036] 2. Multi-scale spatiotemporal-frequency fusion module After completing the data preprocessing in step 1, the obtained EEG signal fragments are input into a multi-scale spatiotemporal-frequency fusion module to extract multi-dimensional feature representations that can characterize the dynamic changes of epileptic seizures. In this embodiment, the module obtains a comprehensive representation reflecting the characteristics of epileptic neural activity by jointly modeling the EEG signals in the time, spatial, and spectral dimensions.
[0037] (1) Temporal multi-scale feature extraction The preprocessed EEG signal fragments are represented as follows Where C represents the number of EEG channels and T represents the number of time sampling points. To capture dynamic EEG patterns at different time scales, this embodiment employs a multi-scale temporal convolutional structure to encode the signal. Specifically, multiple one-dimensional convolutional layers with different kernel sizes are constructed and applied in parallel to the input signal segment: in: This represents a one-dimensional convolution operation with a kernel size of k. This represents the extracted EEG temporal features at the corresponding time scale. Through parallel convolutional layers with multiple receptive fields of different sizes, both short-term transient patterns and long-term temporal dependencies in the EEG signal can be extracted simultaneously. Finally, the temporal features from different scales are concatenated to obtain the temporal domain feature representation. (2) Spatial domain brain region connectivity modeling In the spatial dimension, multichannel EEG signals reflect the coordinated activity relationships between different brain regions. To model the spatial dependence between electrode channels, this invention represents EEG signals as a graph structure. Where V represents the set of electrode nodes and E represents the connection relationship between electrodes. Based on this, spatial dependencies between brain regions are modeled using graph convolution operations: Where: A is the adjacency matrix. This is the corresponding degree matrix. As a learnable parameter matrix, spatial feature representations reflecting the collaborative activity patterns between different brain regions can be obtained through the above graph convolution operation.
[0038] (3) Multi-level frequency domain feature extraction In the spectral dimension, epileptic seizures are typically accompanied by changes in energy distribution across specific frequency bands. To extract the frequency domain features of the EEG signal, the time-domain EEG signal is first converted into a time-frequency representation using a short-time Fourier transform: Subsequently, based on the frequency band division of the EEG signal, the spectrum was decomposed into multiple sub-bands. For the time-frequency representation of each sub-band, a two-dimensional convolutional network was used to extract its frequency domain features. Finally, by fusing the features of each sub-band, a frequency domain feature representation is obtained: (4) Multi-dimensional feature fusion In obtaining time domain features Spatial domain characteristics and frequency domain characteristics Then, the three multi-scale features are fused to form a unified shared representation: Where: (·) represents the fully connected projection function, used to map the fused features to a unified feature space. The final shared feature representation is obtained. It serves as input for subsequent task branches, used for joint modeling of the epileptic seizure detection task and the seizure type classification task.
[0039] 3. Cross-task attention interaction module To fully leverage the complementary relationship between the epileptic seizure detection task and the epileptic seizure type classification task, this embodiment introduces a cross-task attention interaction module between the two task branches, such as... Figure 2 As shown.
[0040] (1) Projection of different task characteristics First, the fusion features The input is fed into two task-specific projection layers to generate feature representations for the seizure detection task and the seizure type classification task, respectively: in: and This represents the task-specific projection weight matrix. and For bias terms, and These are the feature projection vectors for different tasks.
[0041] (2) SC-to-SD cross-task attention interaction In the information exchange path from SC to SD task, the characteristics of the seizure type classification task are utilized. Characteristics of the seizure detection task This is guided to enhance the detection task's ability to perceive the details of the episodic structure. Specifically, classification task features are used as query vectors, and detection task features are used as keys and values to construct cross-task attention computation: in: , and The learnable parameter matrix is then used to calculate cross-task attention weights and update the detection task features: in, The dimension of the vector is represented by the attention interaction described above, which allows us to obtain the seizure detection features after fusing information from the classification task. .
[0042] (3) SD-to-SC cross-task attention interaction To achieve bidirectional task information collaboration, this embodiment further constructs an information interaction path from the seizure detection task to the seizure type classification task. In this path, detection task features... As a query vector, and features of the classification task As keys and values, this allows the detection task to guide the features of the classification task: Then, attention weights are calculated and classification task features are updated: in, , and Given the learnable parameter matrix for this path, the type classification features after fusing detection task information can be obtained through the above calculations. .
[0043] (4) Cross-task feature update Finally, the features obtained from cross-task interactions are used as the updated features for the two task branches and input into the subsequent prediction layer: Through the aforementioned bidirectional cross-task attention interaction mechanism, the seizure detection task can utilize the structural information related to seizure type to improve the ability to identify epileptic seizure patterns, while the seizure type classification task can utilize the seizure localization information and temporal context features provided by the detection task, thereby achieving information complementarity and collaborative optimization between the two tasks and improving the overall model's recognition performance.
[0044] 4. Multi-task learning optimization module After completing the cross-task attention interaction in step 3, the updated seizure detection features are obtained. and seizure type classification characteristics Based on this, a multi-task learning optimization module is used to jointly train the epileptic seizure detection task and the epileptic seizure type classification task, thereby achieving synergistic optimization of the two tasks, and finally using a classifier for prediction output.
[0045] In this embodiment, the SD task and the SC task share the multi-scale spatiotemporal-frequency feature encoder parameters in step 2, and are trained through a unified multi-task optimization objective function.
[0046] (1) Definition of adaptive category-weighted loss Because of the significant imbalance in the distribution of different classes of samples in clinical EEG data, this embodiment introduces an adaptive class-weighted loss function into the multi-task learning framework to mitigate the dominant influence of the majority class on the model training process. The loss function is defined as follows: in, K represents the predicted probability that a sample belongs to the true class, and K represents the number of classes. This is the category-specific weighting coefficient, which is set according to the proportion of samples from each category in the training data. This is a category-related focusing parameter used to reduce the contribution of easily classified samples to the overall loss function. y represents the true label. This represents the model's predicted probability. The adaptive class-weighted loss function described above can enhance the model's ability to identify minority seizure types.
[0047] (2) Multi-task learning optimization loss In the seizure detection task, the model performs binary classification for each time window to identify whether the time window belongs to the epileptic seizure period. Let the total number of time windows be T, then the SD task loss function... Defined as: For the seizure type classification task, supervised training is performed only on time windows labeled as epileptic seizures. Let the set of epileptic seizure windows be... Then the SC task loss function Defined as: To achieve joint optimization of the epileptic seizure detection and seizure type classification tasks, the loss functions of the two tasks are weighted and combined to construct an overall multi-task optimization objective function: in: This represents the overall multi-task loss function. The task balancing coefficient is used to adjust the weight contributions of the seizure detection task and the seizure type classification task during model training. By minimizing the above multi-task loss function, the two tasks can be co-optimized, enabling the model to maintain high seizure detection accuracy while improving its ability to identify different seizure types. Finally, the multi-task neural network model trained can jointly analyze the input EEG signals and output seizure detection results and corresponding seizure type prediction results.
[0048] 5. Implementation Example Verification To verify the effectiveness of the proposed multi-task neural network-based method for epileptic seizure detection and seizure type classification, experiments were conducted on multiple clinical EEG datasets from different sources. These datasets consisted of scalp EEG signals collected in real clinical settings and included epileptic seizure events and their seizure types annotated by professional physicians.
[0049] (1) Dataset This embodiment selects multiple publicly available clinical EEG databases for experimental evaluation to verify the generalization ability of the method of the present invention under different data sources and acquisition environments. The datasets used include: 1) CPGH dataset The CPGH dataset contains continuous scalp electroencephalogram (EEG) monitoring records from multiple epilepsy patients. EEG signals were acquired using the international 10-20 electrode placement system, and auxiliary physiological signals such as electrocardiograms (ECG) and electromyograms (EMG) were recorded simultaneously. This dataset includes long-term continuous EEG recordings, with epileptic seizure events and their types annotated by clinical neurologists.
[0050] 2) SeizeIT1 dataset The SeizeIT1 dataset is derived from long-term video EEG monitoring records of patients with treatment-resistant epilepsy. EEG signals were acquired using the international 10-20 electrode system, with auxiliary electrodes added in certain regions. All epileptic seizure events were reviewed and annotated by epilepsy specialists in conjunction with the video EEG records.
[0051] 3) TUSZ dataset The TUSZ dataset is one of the largest publicly available clinical EEG seizure databases, containing numerous patients' scalp EEG recordings and epileptic seizure annotations. This embodiment selects patient data containing epileptic seizure events for experiments and organizes the seizure types according to the International League Against Epilepsy seizure classification criteria.
[0052] 4) Siena Scalp EEG dataset The Siena Scalp EEG dataset is a scalp EEG database based on video EEG monitoring systems. Electrode placement follows the international 10-20 system standard and includes clinically confirmed epileptic seizure events and their seizure types.
[0053] (2) Experimental setup In this embodiment, all datasets are processed uniformly according to the data preprocessing method described in step 1, including channel normalization, signal resampling, filtering, and time window segmentation. Subsequently, the preprocessed EEG signal segments are input into the multi-task neural network model proposed in this invention for training. The model structure includes: a multi-scale spatiotemporal-frequency feature fusion module, a cross-task attention interaction module, and a multi-task learning optimization module.
[0054] During training, the seizure detection task was defined as a binary classification problem at the time window level, and supervised training was performed on all EEG time windows. The seizure type classification task was defined as a multi-class classification problem, and supervised training was performed only on time windows labeled as epileptic seizures. The adaptive class-weighted loss function described in step 4 was used during model training, and the model parameters were updated through multi-task joint optimization of the objective function to achieve collaborative learning between the seizure detection and seizure type classification tasks.
[0055] (3) Experimental results Experimental results show that the proposed multi-task neural network-based method for epileptic seizure detection and seizure type classification achieves good performance on multiple EEG datasets. For example... Figure 3 As shown, in the epileptic seizure detection task, the classification confusion matrix of the method of this invention on different datasets indicates that the model can effectively distinguish between EEG signals during and outside of seizures, demonstrating high detection accuracy and stability. Figure 4 As shown, in the epileptic seizure type classification task, by performing two-dimensional t-SNE visualization on the features learned by the model, it can be observed that different seizure types form a relatively clear cluster distribution in the feature space, indicating that the proposed multi-task neural network model can effectively extract EEG feature representations with discriminative capabilities.
[0056] The comprehensive experimental results show that the method of the present invention effectively reduces the computational complexity and deployment cost of traditional multi-model systems while ensuring high recognition accuracy. It also demonstrates good stability and generalization ability on EEG data from different sources, and has good potential for clinical application.
Claims
1. A system for simultaneously detecting and classifying epileptic seizures, characterized in that: The system includes an EEG signal processing module, a multi-scale spatiotemporal-frequency feature EEG fusion module, an epileptic seizure detection task branch, a cross-task attention interaction module, an epileptic seizure type classification branch, and a multi-task learning optimization module; wherein: The EEG signal processing module performs data preprocessing on the raw EEG signals to ensure the consistency and comparability of EEG data from different sources; The multi-scale time-space-frequency feature EEG fusion module is used to jointly model EEG signals at different time scales, spatial channels and spectral dimensions, and extract high-order feature representations that characterize the dynamic changes of epileptic seizures. The epileptic seizure detection task branch is used to determine whether an epileptic seizure event exists in the current EEG signal segment; The cross-task attention interaction module establishes a feature-level information interaction mechanism to achieve bidirectional feature sharing between task branches, enabling the epilepsy seizure detection task to improve detection accuracy by utilizing fine-grained structural information related to seizure type, while enabling the seizure type classification task to utilize the seizure time location and context information provided by the detection task. The epileptic seizure type classification branch is used to identify the seizure type when an epileptic seizure is detected; The multi-task learning optimization module performs collaborative training on the seizure detection task and the seizure type task through a multi-task optimization objective function, and combines an adaptive category weighting strategy to train the system's stability and classification ability.
2. The system according to claim 1, characterized in that: The multi-scale time-space-frequency feature EEG fusion module includes an EEG time domain multi-scale feature extraction unit, an EEG spatial domain brain region connectivity unit, an EEG multi-level frequency domain feature unit, and an EEG multi-dimensional feature fusion unit. The EEG time-domain multi-scale feature extraction unit inputs multiple one-dimensional convolutional layers with different kernel sizes into EEG signal segments in parallel, and splices time features of different degrees to obtain EEG time-domain multi-scale features. The EEG spatial domain brain region connectivity unit establishes spatial dependencies between brain regions based on EEG convolution operations to obtain spatial features that reflect the collaborative activity patterns between different brain regions. The EEG multi-level frequency domain feature unit converts the time-domain EEG signal into a time-frequency representation through short-time Fourier transform, and then uses a two-dimensional convolutional network to extract and fuse the frequency domain features of the time-frequency representation to obtain the EEG frequency domain feature representation. The EEG multi-dimensional feature fusion unit fuses time-domain features, spatial-domain features, and frequency-domain features to obtain shared features.
3. The system according to claim 1, characterized in that: The cross-task attention interaction module includes a first task feature projection layer, a second task feature projection layer, a first cross-task attention interaction unit, a second cross-task attention interaction unit, a first cross-task feature update unit, and a second cross-task feature update unit. The first task feature layer combines the shared features with the relevant weight matrix and bias terms of the epilepsy seizure detection task branch to generate detection task features; The second task feature projection layer combines the shared features with the relevant weight matrix and bias terms of the epilepsy seizure type classification branch to generate classification task features; The first task attention interaction unit uses classification task features as query vectors and detection task features as keys and values to perform task attention interaction to obtain the fusion classification task information and the resulting epidemiological detection features. The second task attention interaction unit uses the detection task features as the query vector and the classification task features as the key and value to perform attention interaction to obtain the type classification features after fusing the detection task information; The first cross-task feature update unit combines the detection task features with the epidural detection features after fusing classification task information to obtain collaborative detection task features; The second cross-task feature update unit combines the classification task features with the type classification features obtained after fusing detection task information to obtain collaborative classification task features.
4. The system according to claim 1, characterized in that: The multi-task learning optimization module performs joint training on the epileptic seizure detection task and the seizure type classification task, including: the epileptic seizure detection task is trained under supervision over all time windows, while the seizure type classification task is trained only on EEG signal segments labeled as epileptic seizures.
5. The system according to claim 1, characterized in that: The multi-task optimization objective function is composed of a loss function for the seizure detection task and a loss function for the seizure type classification task, wherein: The loss function for the seizure detection task performs a binary classification judgment on each time window according to the following formula in the seizure detection task, which is used to identify whether the time window belongs to the epileptic seizure period. Where: T is the total number of time windows; The loss function for the seizure type classification task is trained in a supervised manner on the time window labeled as an epileptic seizure according to the following formula for the seizure type classification task. in: This is a set of epileptic seizure windows.
6. A method for simultaneously detecting and classifying epileptic seizures, characterized in that: The method is implemented based on the system described in any one of claims 1-5, and includes: Step 1: Acquire raw EEG signals and perform data preprocessing to obtain EEG signal fragments; Step 2: Input the EEG signal fragment into the multi-scale spatiotemporal-frequency feature fusion module to extract the shared features of the multi-dimensional feature representation of the EEG signal; Step 3: Input the shared features into the seizure detection branch and the seizure type classification branch, and realize the interaction of feature information between the two task branches through the cross-task attention interaction module; including: 3.1 Shared features The input is fed into two task feature projection layers to generate feature representations for the seizure detection task and the seizure type classification task, respectively: in: and This represents the task-specific projection weight matrix. and For bias terms, and For feature projection vectors of different tasks; 3.2 Classification task characteristics by seizure type Characteristics of the seizure detection task Guided by using classification task features as query vectors and detection task features as keys and values, cross-task attention computation is constructed: in: , and The learnable parameter matrix; 3.3 Calculate the cross-task attention weights and update the detection task features according to the following formula: in, The dimension of the vector is represented by the attention interaction described above, which allows us to obtain the seizure detection features after fusing information from the classification task. ; 3.4 Detecting Task Features As a query vector, and features of the classification task As keys and values, this allows the detection task to guide the features of the classification task: 3.5 Calculate the attention weights and update the classification task features according to the following formula: in, , and Given the learnable parameter matrix for this path, the type classification features after fusing detection task information can be obtained through the above calculations. ; The features obtained from cross-task interactions are used as the updated features for the two task branches and then input into the subsequent prediction layer. Step 4: Use the multi-task learning optimization module to jointly train the two tasks and output the epileptic seizure detection results and the corresponding seizure type classification results.
