Electroencephalogram signal classification system and method oriented to class imbalance tasks

By constructing time-frequency embedding, bidirectional temporal Mamba, and time dynamic graph modules, the problem of class imbalance in EEG signal classification is solved, achieving effective identification of minority classes and stable classification across individuals, thus improving the accuracy and robustness of EEG signal classification.

CN121370187AActive Publication Date: 2026-01-23TIANJIN UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511380424.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2026-01-23
Estimated Expiration
2045-09-25

AI Technical Summary

Technical Problem

Existing EEG signal classification methods suffer from several drawbacks when facing class imbalance problems. These include strong dependence on feature extraction, insufficient ability to model long sequences, inadequate adaptation to class imbalance, and insufficient ability to model time-frequency features. As a result, these methods tend to overfit the majority class during training, have difficulty identifying the minority class, and exhibit declining performance in cross-individual experiments, thus limiting their availability in clinical applications.

Method used

We employ a time-frequency embedding module for parallel time-domain and frequency-domain feature extraction, combined with EEG bidirectional temporal Mamba units and a time dynamic graph construction module. Through a category-aware attention mechanism and an adaptive loss function, we enhance the representation ability of minority class samples, achieve long-range dependency modeling and dynamic spatial feature extraction, and mitigate the impact of class imbalance.

Benefits of technology

It significantly improves the accuracy and robustness of EEG signal classification, especially in tasks such as epileptic seizure type identification and sleep staging, with a significant improvement in the ability to identify minority classes, thereby enhancing the model's generalization ability and clinical applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121370187A_ABST
    Figure CN121370187A_ABST
Patent Text Reader

Abstract

The invention discloses an electroencephalogram signal classification system for class imbalance tasks. The system comprises a data preprocessing module, a time-frequency embedding module, an electroencephalogram signal enhancement module, a time dynamic graph construction module and an electroencephalogram classification module. The time-frequency embedding module is composed of a time domain feature extraction unit, a frequency domain feature extraction unit and a time-frequency feature fusion unit; the electroencephalogram signal enhancement module is composed of an electroencephalogram bidirectional time sequence Mamba unit and an electroencephalogram balanced perception category attention unit; under the synergistic effect of the modules, the time, frequency and space characteristics of the electroencephalogram signals can be fully utilized, the unbalanced optimization strategy is combined, training deviation caused by non-uniform category distribution is reduced, and therefore better classification performance and higher generalization ability are achieved in various clinical application scenes.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of unbalanced electroencephalogram signal classification, and particularly relates to an electroencephalogram signal classification system and method for a class unbalanced task. BACKGROUND

[0002] Electroencephalogram (EEG) is a neurophysiological signal for non-invasive recording of brain electrical activity, which is widely used in the fields of neurologic disease auxiliary diagnosis, sleep research, brain-computer interface and cognitive science. Since EEG signal can directly reflect the neural dynamic activity of the brain, it has important value in clinical and scientific research tasks such as seizure detection, sleep staging, and mental illness recognition. However, EEG signal generally has characteristics such as non-stationarity and significant individual differences, which still poses great challenges to its automated analysis. In the electroencephalogram classification task, the class imbalance problem is particularly prominent. The so-called class imbalance refers to the significant uneven distribution of different class samples in the dataset. On the one hand, the number of majority class samples is relatively large, and the model is prone to bias and overfitting to the majority class during the training process; on the other hand, the number of minority class samples is scarce, and the model is difficult to fully learn the feature patterns thereof, thereby leading to decreased classification performance and insufficient robustness. This problem is widespread in actual clinical EEG application scenarios.

[0003] Taking seizure type recognition as an example, epilepsy is a common neurological disease characterized by transient brain dysfunction caused by abnormal synchronous discharge of brain neurons. Epilepsy has complex and diverse types, which are divided into focal seizures (such as focal non-specific seizures, simple partial seizures, and complex partial seizures) and generalized seizures (such as generalized non-specific seizures, tonic-clonic seizures, tonic seizures, absence seizures, and myoclonic seizures) by the International League Against Epilepsy. However, in actual clinical databases (such as TUSZ), the data distribution of different types of seizures is extremely uneven. For example, the number of records of focal non-specific seizures is relatively large, while the number of samples of types such as absence seizures and myoclonic seizures is extremely limited. This uneven distribution directly leads to the excessive dependence of traditional classification models on the majority class during training, making it difficult to effectively recognize the scarce types, thereby limiting its application value in clinical auxiliary diagnosis.

[0004] For example, in the sleep staging task, EEG signals are usually divided into five stages: wakefulness (W), light sleep stages N1 and N2, deep sleep stage N3, and rapid eye movement stage (REM). This staging process is of great significance for sleep disorder diagnosis, mental illness assessment, and long-term health monitoring. However, the natural distribution of sleep stages is also highly uneven. In typical public EEG sleep databases (such as Sleep-EDFX), the number of samples of wakefulness W and light sleep stage N2 accounts for a significant proportion, while the proportion of samples of deep sleep stage N3 is low. Since the model is often dominated by the majority class samples during training, its recognition ability for minority stages is significantly insufficient, resulting in a decrease in overall classification accuracy and weakening the fine-grained recognition effect of sleep microstructure.

[0005] However, existing methods have many shortcomings in dealing with unbalanced EEG classification tasks. First, the feature extraction is highly dependent. Traditional methods are mostly based on manual features (such as spectral energy, waveform indicators), which are difficult to effectively describe complex cross-time dependencies. Although deep learning methods can automatically extract features, convolutional neural networks (CNN) and recurrent neural networks (RNN) have limitations in long sequence modeling, making it difficult to balance efficiency and long-range dependency modeling ability. Second, the class imbalance is not well adapted. Most studies use oversampling or undersampling to alleviate the imbalance problem, but these methods often destroy the original data distribution or introduce noise, making it difficult to effectively model the scarce class from both feature and optimization levels. At the same time, existing methods have insufficient time-frequency feature modeling ability. The time and frequency domain characteristics of EEG signals are closely coupled. Single time or frequency domain feature modeling easily ignores cross-scale dynamic patterns, which is not conducive to capturing the suddenness of seizures or the gradualness of sleep stages. In cross-subject experiments, due to individual differences and data distribution differences, the model's performance on the test set is significantly reduced, limiting its usability in actual clinical practice. Based on the above shortcomings, a new method that can simultaneously consider long sequence modeling, time-frequency feature extraction, and unbalanced perception optimization is needed to improve the model's performance and generalization ability in complex EEG classification tasks. SUMMARY

[0006] The present application proposes a EEG signal classification system and method for class imbalance tasks to improve the accuracy, robustness and clinical practicability of classification while ensuring computational efficiency, in order to solve the problems of existing unbalanced EEG signal classification methods in generalization ability, high computational cost and poor recognition performance of minority classes.

[0007] To solve the problems of the prior art, the present application adopts the following technical solutions

[0008] The application discloses a brain electrical signal classification system for a class imbalance task, and belongs to the technical field of brain electrical signal classification.

[0009] The time-frequency embedding module is used for performing parallel time domain and frequency domain feature extraction on input brain electrical signals, and fusing the time domain and frequency domain feature extraction to obtain time-frequency embedded brain electrical data.

[0010] The brain electrical balanced perception class attention unit processes the class features of the time-frequency embedded brain electrical data through a class perception attention mechanism and an adaptive loss function to obtain first reinforced brain electrical data.

[0011] The brain electrical bidirectional time sequence Mamba unit enhances the sequence forward and backward association of the first reinforced brain electrical data through a selective state space mechanism to obtain second reinforced brain electrical data.

[0012] The time dynamic graph construction module enhances the data interaction of key brain region data in the second reinforced brain electrical data through a physiological priori and a data-driven optimization mechanism to obtain third reinforced brain electrical data.

[0013] The brain electrical classification module identifies brain electrical classes through the third reinforced brain electrical data and outputs brain electrical diagnosis results.

[0014] Further, the time-frequency embedding module is used for performing parallel time domain and frequency domain feature extraction on brain electrical signals, and fusing the time domain and frequency domain feature extraction to obtain a time-frequency embedded brain electrical data process, which comprises the following steps.

[0015] The time domain feature extraction unit adopts a lightweight one-dimensional convolutional neural network combined with a learning position embedding strategy to obtain a time domain embedding representation of each channel of the brain electrical signal according to the following formula.

[0016] ;

[0017] wherein the time domain embedding representation is , is a time domain embedding dimension, is a learnable position encoding matrix.

[0018] The frequency domain feature extraction unit performs Fourier transform on the input brain electrical signal to extract frequency spectrum information, and obtains a frequency domain embedding representation of each channel of the brain electrical signal according to the following formula.

[0019] ;

[0020] wherein the frequency domain embedding is represented as , denotes the frequency domain embedding dimension, , is a learnable weighting coefficient.

[0021] The time-frequency feature fusion unit splices the time domain embedding and the frequency domain embedding along the channel dimension, linearly maps through a fully connected layer and adopts a ReLU activation function to obtain time-frequency embedded electroencephalogram data:

[0022] ;

[0023] wherein the time-frequency embedding , d is a hidden dimension.

[0024] Further, the electroencephalogram balanced perception class attention unit processes the class features of the time-frequency embedded electroencephalogram data through a class perception attention mechanism and an adaptive loss function to obtain the first reinforced electroencephalogram data, including:

[0025] According to the time-frequency embedded electroencephalogram data, the class perception electroencephalogram signal is obtained according to the following formula:

[0026] ;

[0027] wherein, denotes the attention weight at time ; is the attention weight representation:

[0028] ;

[0029] wherein, is the total number of classes, denotes the query vector of the th class; is a scaling factor.

[0030] The class balanced perception electroencephalogram signal is obtained by processing the class perception electroencephalogram signal according to the following formula:

[0031] ;

[0032] wherein, is an exponentially decaying class balance factor, i.e.

[0033] ;

[0034] wherein, denotes the number of samples of the class in the training set, to control the sensitivity of the super parameter of the rare class;

[0035] fusing all modulated class-balanced EEG signals to output first reinforced EEG data:

[0036] Further, the EEG bidirectional time series Mamba unit enhances the sequence forward and backward association of the first reinforced EEG data to obtain second reinforced EEG data through a selective state space mechanism;

[0037] normalizing the first reinforced EEG data sequence features Operation to obtain first EEG data normalized features ,

[0038] linearly mapping the first EEG normalized EEG data features to state EEG features and gated EEG features ; wherein:

[0039] Based on the forward branch, the state EEG features are sequentially passed through a forward causal convolution and a forward state space to extract forward patterns under temporal causal constraints

[0040] Based on the backward branch, the gated EEG features are passed through a reverse causal convolution and a reverse state space module to extract reverse temporal dependencies, generating backward patterns

[0041] The forward and backward modeling results and the gating vector are weighted and fused through a learnable gating mechanism, and the second EEG normalized features are obtained through linear transformation:

[0042] ;

[0043] wherein, is a trainable scaling parameter;

[0044] The second EEG normalized features are output through a residual connection to obtain second reinforced EEG data:

[0045] ;

[0046] Further, the time dynamic graph construction module enhances the data interaction of key brain regions in the second reinforced EEG data to obtain a third reinforced EEG data process through a physiological priori and data-driven optimization mechanism; including:

[0047] The second reinforced EEG data is constructed through a priori graph to obtain a dynamic correlation adjacency matrix within a time window ;

[0048] Time windows in the second enhanced EEG data were constructed using attention mapping. Inner attention matrix ;

[0049] The dynamic correlation adjacency matrix is ​​analyzed using the following formula. The first optimized driving EEG data was obtained through calculation:

[0050] ;

[0051] Among them, augmented adjacency matrix ( (It is the identity matrix) It is its corresponding degree matrix

[0052] The attention matrix is ​​analyzed using the following formula. The second optimized driver EEG data was obtained through calculation:

[0053] ;

[0054] Among them, hyperparameters This is used to control the fusion ratio between the prior graph structure and the attention graph structure;

[0055] Third enhanced EEG data is output by capturing the spatial dependence features of EEG within each time window of the second normalized EEG matrix using a dynamic graph convolutional network.

[0056] ;

[0057] in, for The output of the layer, For learnable parameter matrix, It is a non-linear activation function. Attached Figure Description

[0058] Figure 1 The imbalanced EEG signal classification system combining time-frequency embedding and state space model described in this embodiment of the invention mainly includes a time-frequency embedding module, a bidirectional temporal Mamba module, a time dynamic graph construction module, and an imbalanced perception category attention module.

[0059] Figure 2 This is a structural framework diagram of the time-frequency embedding module described in an embodiment of the present invention.

[0060] Figure 3 This is a structural framework diagram of the bidirectional timing Mamba unit described in an embodiment of the present invention.

[0061] Figure 4This is a structural framework diagram of the unbalanced perception category attention unit according to an embodiment of the present invention.

[0062] Figure 5 This is a structural framework diagram of the time dynamic graph construction module described in an embodiment of the present invention. Detailed Implementation

[0063] like Figure 1 As shown, this invention proposes an imbalanced EEG signal classification network system combining time-frequency embedding and a state-space model. The system includes a data preprocessing module, a time-frequency embedding module, an EEG signal enhancement module, a time dynamic map construction module, and an EEG classification module. The time-frequency embedding module consists of a time-domain feature extraction unit, a frequency-domain feature extraction unit, and a time-frequency feature fusion unit. The EEG signal enhancement module comprises a bidirectional temporal Mamba unit and an EEG balanced perception category attention unit. Wherein:

[0064] The time-frequency embedding module is used to extract time-domain and frequency-domain features in parallel from the input EEG signal and fuse the two to obtain time-frequency embedded EEG data.

[0065] The EEG equalization perception category attention unit processes the class features of time-frequency embedded EEG data through a category-aware attention mechanism and an adaptive loss function to obtain the first enhanced EEG data;

[0066] The bidirectional temporal Mamba unit of EEG obtains second enhanced EEG data by enhancing the forward and backward correlation of the first enhanced EEG data through a selective state-space mechanism;

[0067] The time-dynamic graph construction module enhances the interaction of key brain regions in the second enhanced EEG data to obtain the third enhanced EEG data through physiological priors and data-driven optimization mechanisms.

[0068] The EEG classification module identifies the EEG category based on the third enhanced EEG data and outputs the EEG diagnostic result.

[0069] The framework mainly includes four core modules: time-frequency embedding module, bidirectional time series Mamba module, time dynamic graph construction module and unbalanced perception class attention module. The system can comprehensively model from three dimensions of time, frequency and space from the dynamic characteristics of the electroencephalogram signal. By using the global sequence modeling capability of the bidirectional time series Mamba module and the structural modeling advantage of the dynamic graph module, the present application can realize the joint representation of context-dependent information and local space-time relationship, thereby effectively improving the feature expression capability and pattern recognition precision of the electroencephalogram signal. At the same time, the present application introduces an adaptive class imbalance learning mechanism to enhance the representation capability of the minority class samples at two levels of feature modeling and target optimization, thereby significantly alleviating the negative impact of class imbalance on model training. The method of the present application mainly includes the following core modules:

[0070] 1. Time-frequency embedding module: jointly model the EEG signal to extract both transient burst patterns in the time domain and periodic activity features in the frequency domain, thereby obtaining a multi-scale time-frequency joint representation.

[0071] 2. Bidirectional time series Mamba module: based on the selective state space mechanism, the forward and backward contexts are simultaneously modeled under the premise of maintaining linear computational complexity, thereby effectively enhancing the model's ability to capture long-range dependence relationships, dynamic evolution patterns and sharp wave events.

[0072] 3. Time dynamic graph construction module: a dynamic graph structure is established by calculating the correlation between EEG channels, and a data-driven graph representation is formed in combination with an attention mechanism, thereby further generating an attention-guided Laplacian matrix to realize the extraction of dynamic spatial dependence features.

[0073] 4. Unbalanced perception class attention module: based on the class prior information and sample statistical results, the attention weight is allocated, so that the model can focus more on the minority class features during the training process. At the same time, a class balance dynamic temperature focusing loss function is designed, and through dynamic temperature adjustment and difficult sample weighting mechanism, the gradient deviation caused by class imbalance is alleviated at the target function level.

[0074] Under the synergistic effect of the above modules, the present application can fully utilize the time, frequency and spatial features of the EEG signal, and combine the imbalance optimization strategy to reduce the training bias caused by uneven class distribution, thereby realizing better classification performance and stronger generalization ability in various clinical application scenarios. To verify the effectiveness of the present application, experiments are carried out in two typical imbalance task scenarios. Specifically:

[0075] 1. Time-frequency embedding module

[0076] As Figure 2As shown, the time-frequency embedding module is used for parallel time domain and frequency domain feature extraction of the electroencephalogram signal, and the two are fused to form a time-frequency joint representation, thereby improving the feature expression ability.

[0077] (1) Input data representation

[0078] The original EEG input representation is:

[0079]

[0080] Where T represents the sequence length, and C represents the number of channels.

[0081] (2) Time domain feature extraction

[0082] For time domain features, a lightweight one-dimensional convolutional neural network (convolution kernel size of 3, step size of 1) is used, combined with a learnable position embedding strategy, to independently encode the EEG sequence of each channel:

[0083]

[0084] Where the time domain embedding is represented as , is the time domain embedding dimension, is a learnable position encoding matrix. This position encoding can enhance the model's perception of time order, thereby better capturing features such as seizure onset point and duration.

[0085] (3) Frequency domain feature extraction

[0086] For frequency domain features, a Fast Fourier Transform (FFT) is performed on each channel to extract spectral information in the 0.5-100Hz range, and divided into (0.5-4Hz), (4-8Hz), (8-13Hz), (13-30Hz), and (30-100Hz) five typical frequency bands, each reflecting different brain function states. Subsequently, the features of each frequency band are embedded and encoded, and fused through learnable weighting coefficients:

[0087]

[0088] Where the frequency domain embedding is represented as , is the frequency domain embedding dimension, , is a learnable weighting coefficient.

[0089] (4) Time-frequency feature fusion

[0090] Temporal embedding and frequency embedding Concatenate along the channel dimension, linearly map through a fully connected layer with a ReLU activation function, and obtain a time-frequency fusion representation:

[0091]

[0092] where the time-frequency embedding , d is the hidden dimension, and this representation can effectively fuse the temporal transient mode and the frequency rhythm mode while maintaining the time resolution, thereby enhancing the discrimination ability of different types of brain waves.

[0093] 2. Bidirectional temporal Mamba unit

[0094] The bidirectional temporal Mamba module realizes forward and backward dependent modeling of EEG signal sequences based on a selective state space mechanism. Its core is to simultaneously capture long-range dependencies and dynamic evolution characteristics while ensuring linear computational complexity, thereby enhancing the model's ability to analyze complex non-stationary EEG signals.

[0095] (1) State space modeling

[0096] A continuous state space model (SSM) can be described by the following first-order differential equation:

[0097]

[0098]

[0099] where represents a single-channel single-time-step input, is the corresponding output, represents a high-dimensional hidden state with a dimension of , and the matrix is a learnable parameter that controls the state transition and input mapping process. To adapt to the modeling needs of discrete time series, the continuous SSM can be discretized by zero-order hold based on the time step

[0100]

[0101]

[0102]

[0103] where and are the first ​The state vector of a time step and the input vector. This discrete form guarantees the effectiveness of the model in discrete sequences, while retaining the ability to model long-range dependencies.

[0104] (2) Bidirectional temporal SSM

[0105] On the basis of traditional unidirectional scanning, the module extracts dependency patterns in different time directions through parallel forward and backward modeling branches, as shown in Figure 3 The input time-frequency embedded sequence feature is first normalized by layer normalization operation to obtain normalized feature , which is then mapped to two orthogonal representation spaces in parallel to separate state modeling and gate control. The linear mapping generates state modeling feature , while the linear mapping generates gate feature .

[0106] Forward branch: state modeling feature is sequentially passed through forward causal convolution and forward state space module to extract forward patterns under time causal constraints.

[0107] Backward branch: gate feature extracts reverse temporal dependencies through reverse causal convolution and reverse state space module to generate backward patterns .

[0108] Fusion mechanism: the forward and backward modeling results and the gate vector are weighted and fused through a learnable gating mechanism, and are linearly transformed to obtain:

[0109]

[0110] wherein, is a trainable scaling parameter used to dynamically adjust the contribution of forward and backward dependency features. Finally, through residual connection, the deep training process is stabilized and the feature expression ability is enhanced, and the updated feature is output:

[0111]

[0112] Through the above bidirectional temporal Mamba structure, the present application can realize global dependency modeling of the current and previous moments of the EEG sequence under the premise of maintaining low computational complexity and efficient state updating, thereby improving the analysis ability of complex non-stationary signals and the accuracy and robustness of classification.

[0113] 3. Balanced perceptual class attention unit

[0114] The module is used to alleviate the class imbalance problem existing in electroencephalogram signal classification tasks, and is particularly suitable for scenarios such as seizure type identification and sleep stage division where few-class samples are scarce. Through the design of a class-aware attention mechanism and an adaptive loss function, the module realizes dynamic reinforcement of few-class features and improves the discriminative ability of the model under imbalanced conditions, such as Figure 4 as shown.

[0115] (1) Class-aware attention mechanism

[0116] First, a learnable class embedding matrix is defined:

[0117]

[0118] where is the total number of classes, denotes the query vector of the th class. In the calculation process, the class-aware attention distribution is generated through the interaction between the class query vector and the embedding feature :

[0119]

[0120] where is a scaling factor used to stabilize the training process. Based on the attention weight , the context representation of the class is aggregated as follows:

[0121] where

[0122] denotes the attention weight at time . (2) Class imbalance modulation

[0123] To explicitly model the class imbalance, a class balance factor based on exponential decay is introduced:

[0124]

[0125] where

[0126] denotes the number of samples of the th class in the training set, is a hyperparameter that controls the sensitivity of rare classes. Then is used to modulate , and the imbalance-aware class embedding representation is obtained as follows:

[0127]

[0128] Finally, the fusion of all modulated category embeddings is represented as the output of the imbalanced perceptual category attention module:

[0129]

[0130] The output can be used as input for subsequent temporal dependency modeling, or as a gating mask to regulate feature flow, thereby enabling class-conditional modeling.

[0131] (3) Equilibrium-like dynamic temperature focusing loss

[0132] At the optimization level, a quasi-equilibrium dynamic temperature focusing loss is proposed ( Its core idea is to combine class imbalance and sample difficulty to dynamically adjust the gradient optimization intensity.

[0133] First, define the sample. Difficulty score :

[0134]

[0135] in, The model represents the samples Real Category The predicted probability. The larger the value, the more difficult the sample classification. To achieve adaptive temperature regulation, a dynamic temperature factor is introduced. :

[0136]

[0137] in, As the reference temperature, For adjustment coefficients, This is a class balance factor. When the sample classification difficulty is high or the class proportion is low, temperature... A lower value results in a steeper Softmax distribution, enhancing the model's focus on that sample. Ultimately, Defined as:

[0138]

[0139] in, As the benchmark focusing factor, The category attention weights are used to maintain attention consistency during feature modeling and loss calculation. Through this design, the imbalance-aware category attention module explicitly enhances the expressive power of minority class samples during feature modeling, while the class-balanced dynamic temperature focusing loss adaptively increases the model's attention to scarce and hard-to-classify samples during optimization. The synergistic effect of these two components enables the model to achieve more stable and balanced classification performance even with extremely imbalanced EEG data distributions.

[0140] Through the above design, this module explicitly enhances the expressive power of minority class samples during the feature modeling stage, while the class-balanced dynamic temperature focusing loss adaptively increases the model's attention to scarce classes and difficult-to-classify samples during the optimization stage. The synergistic effect of these two technologies enables the model to achieve more stable and balanced classification performance even under extremely imbalanced EEG data distributions.

[0141] 4. Time-based dynamic graph construction module

[0142] The aforementioned time-based dynamic graph construction module is used to dynamically model the spatial dependencies between EEG channels under different time windows. It combines physiological priors with data-driven optimization mechanisms to enhance the ability to model interaction patterns in key brain regions, such as... Figure 5 As shown.

[0143] (1) Construction of prior graph

[0144] Within each time window, a dynamic functional connectivity graph is constructed as a prior structure based on the Pearson correlation coefficient (PCC). For each time window... Internal passage and Its time-dynamic correlation connection weights Defined as:

[0145]

[0146] in, Display window inner passage The characteristic representation, and These represent the covariance and variance operations, respectively. Then the time window... Dynamic correlation adjacency matrix It can be represented as:

[0147]

[0148] in, Represents a node To the node The linear functional connectivity strength is used to effectively characterize the synchronous or asynchronous activation patterns of different brain regions at different stages.

[0149] To improve the stability and frequency domain interpretability of the graph structure, its symmetric normalized Laplacian matrix is further calculated :

[0150]

[0151] where the augmented adjacency matrix ( is the identity matrix), is its corresponding degree matrix.

[0152] (2) Attention graph construction

[0153] The prior graph structure constructed only relying on PCC may not be able to fully capture the complex nonlinear dynamic interaction relationship in the EEG signal, and the self-attention mechanism is introduced to adaptively learn the dynamic relationship between channels. The input feature is mapped to the query and key space through linear projection parameters , The self-attention matrix in the time window is calculated:

[0154]

[0155] where denotes a scaling factor for stable training, Each element in denotes the attention weight from channel to channel , reflecting the dynamic influence relationship between nodes in the current window. In order to effectively fuse the PCC graph structure based on physiological prior and the attention graph structure driven by data, the attention guided Laplacian matrix is further constructed:

[0156]

[0157] where the hyperparameter is used to control the fusion ratio of the prior graph structure and the attention graph structure, which improves the flexibility and expression ability of the graph structure while maintaining interpretability.

[0158] (3) Dynamic graph convolution

[0159] Based on the above Laplacian matrix, a dynamic graph convolution network (DGCN) is performed in each time window to perform graph convolution on the EEG signal to capture spatial dependence features:

[0160]

[0161] where, for The output of the layer, For learnable parameter matrix, This is a non-linear activation function. Multiple layers are stacked to extract multi-level spatially dependent features, which are then fed into a classifier via global pooling to achieve the recognition of different EEG types. This module can dynamically capture interaction patterns between different brain regions, enhancing the model's ability to express the propagation paths and synchronous activation features of abnormal EEG changes, and improving generalization performance across individuals and tasks.

[0162] Example 1: Classification of Epilepsy Seizure Types

[0163] To verify the effectiveness of the method of the present invention in the epilepsy detection task, the publicly available TUSZ dataset was selected for experimentation.

[0164] The method was validated on the publicly available epilepsy EEG database TUSZ. This database is one of the largest publicly available epilepsy EEG datasets globally, containing clinical multichannel scalp EEG records acquired in outpatient clinics, intensive care units (ICUs), and epilepsy monitoring units (EMUs) since 2002. The database contains 3968 expert-annotated seizure events from 287 epilepsy patients, with sampling rates ranging from 250 to 1000 Hz and 25 to 129 channels, conforming to the international standard 10-20 system electrode layout, demonstrating good representativeness and authority. The method of this invention was used in classification experiments on eight different seizure types within this dataset, and the results showed that the model exhibited a significant advantage in minority class identification.

[0165] First, all EEG signals were downsampled to 200Hz, and 19 standard channels from the international 10-20 electrode system were selected using a unipolar reference method to ensure consistent channel configuration across data sources. Power frequency noise was suppressed using a 60Hz notch filter, and low-frequency drift artifacts were eliminated through detrending processing. Subsequently, the EEG signals were divided into 4-second sliding window segments with 50% overlap to expand the training samples and enhance the model's sensitivity to seizure dynamics. Only time periods with complete epileptic seizure annotations were retained as valid samples to avoid interference from non-seizure segments during training.

[0166] In terms of data partitioning, a cross-subject classification strategy was adopted to ensure that the training set, validation set, and test set came from different patients, thereby truly reflecting the model's generalization ability on unseen individuals.

[0167] During the training process, the Adam optimizer is adopted, the initial learning rate is set to 1e-6, and the cosine annealing learning rate scheduling strategy is combined to accelerate convergence and suppress oscillation. The maximum training batch is set to 300, and the early stopping mechanism is triggered when the validation set loss does not decrease significantly for 10 consecutive rounds, effectively preventing overfitting. The batch size is set to 128, taking into account the convergence effect and computational efficiency.

[0168] In the model performance evaluation, accuracy, F1 score and Cohen's kappa coefficient are used as evaluation indicators to comprehensively measure the model performance from the overall precision, class balance and consistency. The experimental results show that the method described in the application can achieve stable and clinically applicable performance in the classification task of seizure type.

[0169] Embodiment two: sleep EEG staging

[0170] To further verify the applicability of the method in the sleep EEG staging task, the public Sleep-EDFX dataset is selected for experiment.

[0171] Verification is performed on the public EEG sleep database Sleep-EDFX. The database contains 197 full-night polysomnography records, each subject's record duration is not less than 7 hours, covering multiple complete sleep cycles. The subjects are aged 25-101 years old, and the data has high population diversity. The sleep stage annotation is manually scored by trained technicians according to international standards, covering five typical stages of wakefulness (W), light sleep stages N1 and N2, deep sleep stage N3, and rapid eye movement stage (REM). The method is used for 5-stage sleep classification experiment on the dataset, and the results show that it is superior to existing mainstream methods in all evaluation indicators, especially in the recognition of minority classes.

[0172] In all experiments, the patient-independent partitioning strategy is adopted to ensure that the training set and test set are completely independent at the individual level, avoid information leakage, and truly reflect the cross-subject generalization ability of the model. The experimental results fully prove that the method proposed in the application can ensure lightweight computation while considering classification accuracy and robustness, especially suitable for EEG classification tasks such as seizure type identification and sleep staging with significant class imbalance characteristics, and has wide clinical application prospects and engineering deployment value.

[0173] All EEG signals are unified to 100Hz to ensure consistency across recordings. Single-channel EEG is used as input features to avoid multi-lead signal dependency, which is more suitable for low-cost application scenarios. According to the label information provided by the dataset, the sleep recordings are divided into 30-second segments, and each segment corresponds to a sleep stage label (W, N1, N2, N3, REM). Each EEG segment is z-score standardized to eliminate amplitude differences between different subjects and improve model generalization.

[0174] 10-fold cross-validation is used to ensure the stability and generalization of the evaluation results. In each fold, the training set, validation set and test set are composed of segments from different subjects to avoid data leakage. The Adam optimizer is used with an initial learning rate of 1e-4 and a cosine annealing learning rate scheduling strategy to accelerate convergence and avoid local oscillation. The batch size is set to 256 to balance the GPU training efficiency and model convergence effect. Dropout and early stopping mechanisms are used to prevent overfitting when the validation set has no performance improvement for 10 consecutive rounds.

[0175] The model performance is evaluated on the test set of each fold cross-validation, and the 10-fold average result is finally reported. In terms of model performance evaluation, accuracy, F1 score and Cohen's kappa coefficient are used as evaluation indicators. The proposed method significantly outperforms existing mainstream deep learning methods in F1 score and Kappa coefficient, especially in N1, N3 and other minority class stages, which fully demonstrates the effectiveness and generalization ability of the proposed unbalanced perception mechanism.

[0176] Table 1: List of different types of epilepsy publications (TUSZ dataset)

[0177]

[0178] Table 2: List of different sleep stages (Sleep-EDFX dataset)

[0179]

Claims

1. An electroencephalogram signal classification system for class imbalance oriented tasks, characterized by, The system comprises a data preprocessing module, a time-frequency embedding module, an electroencephalogram signal enhancement module, a time dynamic graph construction module and an electroencephalogram classification module; the time-frequency embedding module comprises a time domain feature extraction unit, a frequency domain feature extraction unit and a time-frequency feature fusion unit; the electroencephalogram signal enhancement module comprises an electroencephalogram bidirectional time sequence Mamba unit and an electroencephalogram balanced perception class attention unit; wherein: The time-frequency embedding module is used for parallel time domain and frequency domain feature extraction of the input electroencephalogram signal, and fusion of the two to obtain time-frequency embedded electroencephalogram data; The electroencephalogram balanced perception class attention unit processes the class features of the time-frequency embedded electroencephalogram data through a class perception attention mechanism and an adaptive loss function to obtain first reinforced electroencephalogram data; The electroencephalogram bidirectional time sequence Mamba unit enhances the sequence forward and backward association of the first reinforced electroencephalogram data through a selective state space mechanism to obtain second reinforced electroencephalogram data; The time dynamic graph construction module enhances the data interaction of key brain regions in the second reinforced electroencephalogram data through a physiological priori and data-driven optimization mechanism to obtain third reinforced electroencephalogram data; The electroencephalogram classification module identifies the electroencephalogram class through the third reinforced electroencephalogram data and outputs an electroencephalogram diagnosis result.

2. The electroencephalogram signal classification system for class imbalance oriented tasks according to claim 1, wherein, The time-frequency embedding module is used for parallel time domain and frequency domain feature extraction of the input electroencephalogram signal, and fusion of the two to obtain time-frequency embedded electroencephalogram data process, comprising: The time domain feature extraction unit uses a lightweight one-dimensional convolutional neural network combined with a learning position embedding strategy to obtain the time domain embedding representation of each channel of the input electroencephalogram signal according to the following formula: ; wherein the time domain embedding is represented as , is a time domain embedding dimension, is a learnable position encoding matrix; The frequency domain feature extraction unit extracts frequency spectrum information of the input electroencephalogram signal through Fourier transform to obtain the frequency domain embedding representation of each channel of the electroencephalogram signal according to the following formula: ; wherein the frequency domain embedding is represented as , represents the frequency domain embedding dimension, , is a learnable weighting coefficient; the time-frequency feature fusion unit splices the time domain embedding and the frequency domain embedding along the channel dimension, linearly maps through a fully connected layer and adopts a ReLU activation function to obtain the time-frequency embedding electroencephalogram data: ; wherein the time-frequency embedding d is the hidden dimension.

3. The electroencephalogram signal classification system for class imbalance oriented tasks according to claim 1, wherein, The process of the electroencephalogram balanced perception class attention unit processing the class features of the time-frequency embedded electroencephalogram data through a class perception attention mechanism and an adaptive loss function to obtain first reinforced electroencephalogram data; comprising: The class perception electroencephalogram signal is obtained according to the following formula: ; wherein, represents the attention weight at time is an attention weight representation:​ ; wherein, is the total number of classes, represents the query vector of the class; is a scaling factor: The class balanced perception electroencephalogram signal is obtained by processing the class perception electroencephalogram signal according to the following formula: ; wherein is an exponentially decaying category balance factor, i.e. ; wherein, representing a class the number of samples in the training set, is a hyperparameter controlling the sensitivity to rare classes; The first reinforced electroencephalogram data is output by fusing all the modulated class balanced perception electroencephalogram signals: 。 4. The electroencephalogram signal classification system for class imbalance oriented tasks according to claim 1, wherein, The electroencephalogram bidirectional time sequence Mamba unit enhances the sequence forward and backward association of the first reinforced electroencephalogram data through a selective state space mechanism to obtain second reinforced electroencephalogram data; normalizing the first reinforcement electroencephalography data sequence features by layer normalizing the first electroencephalography data features , linearly mapping the first electroencephalogram normalized electroencephalogram data features to the state electroencephalogram features, respectively and gating the electroencephalogram features ; wherein: State electroencephalogram features based on forward branches Sequentially passing through a forward causal convolution and a forward state space extracts a forward mode under temporal causal constraints ; Gated electroencephalographic features based on backward branches Backward patterns are generated by extracting inverse temporal dependencies through reverse causal convolution and reverse state space modules ​ The forward and backward modeling results and the gating vector are weighted and fused through a learnable gating mechanism, and the second electroencephalogram normalized features are obtained through linear transformation: ; wherein, is a trainable scaling parameter; The second reinforced electroencephalogram data is output by deep training of the second electroencephalogram normalized features through residual connection: 。 5. The electroencephalogram signal classification system for class imbalance oriented tasks according to claim 1, wherein, The process of the time dynamic graph construction module enhancing the data interaction of key brain regions in the second reinforced electroencephalogram data through a physiological priori and data-driven optimization mechanism to obtain third reinforced electroencephalogram data; comprising: constructing a time window in the second reinforced electroencephalogram data through a prior graph intra-dynamic correlation adjacency matrix ; Time windows in the second enhanced EEG data were constructed using attention mapping. Inner attention matrix ; The dynamic correlation adjacency matrix is calculated by the following formula The first optimized driving electroencephalogram data is obtained by calculation: ; wherein the augmented adjacency matrix ( is the identity matrix, is its corresponding degree matrix The attention matrix is calculated by the following equation The second optimized driving electroencephalic data is obtained by calculation: ; wherein the hyperparameters are used to control the fusion ratio of the prior graph structure and the attention graph structure; The third reinforced electroencephalogram data is output by capturing the electroencephalogram spatial dependence features in each time window of the second normalized electroencephalogram matrix through a dynamic graph convolution network: ; wherein, is the output of the layer, is a matrix of learnable parameters, is a non-linear activation function.

Citation Information

Patent Citations

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

    CN112426161A

  • Electroencephalogram signal classification method

    CN117243566A

  • System and method for classifying and identifying epilepsy in electroencephalogram signal based on time sequence

    CN120611239A

  • Mental Strengthening & Programming Systems & Methods

    US20170287354A1

  • Epileptic electroencephalogram recognition system based on hierarchical graph convolutional neural network, terminal, and storage medium

    WO2021226778A1