Method for recognizing depression type electroencephalogram signal, storage medium, product and recognition device

By constructing an EEG recognition model with a multidimensional feature extractor and classifier, and combining a training framework with domain adaptation and domain adversarial mechanisms, the problem of insufficient accuracy and generalization in the recognition of depressive EEG signals in existing technologies is solved, and depressive EEG signal recognition with higher accuracy and better generalization ability is achieved.

CN122163232APending Publication Date: 2026-06-09ANHUI UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ANHUI UNIV
Filing Date
2026-05-12
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing neural network-based EEG recognition schemes for depression generally suffer from insufficient recognition accuracy and generalization due to limitations in model feature extraction capabilities and the amount of sample data.

Method used

A brainwave recognition model including a multidimensional feature extractor and a classifier is constructed. The multidimensional feature extractor extracts brainwave signal features through a shallow labeled encoding (STE) module and a two-branch adaptive fusion (TCLF) network. A training framework of domain adaptation mechanism and domain adversarial mechanism is introduced, and cross-entropy loss, pseudo-label loss and domain adversarial loss are used for training.

Benefits of technology

It significantly improved the model's detection accuracy and generalization ability for EEG signals, enabling it to better adapt to individual differences and recognition tasks across subjects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122163232A_ABST
    Figure CN122163232A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of electroencephalogram recognition, and particularly relates to a depression type electroencephalogram signal recognition method, a storage medium, a product and a recognition device. The method comprises: constructing an electroencephalogram recognition model comprising a multi-dimensional feature extractor and a classifier. The multi-dimensional feature extractor comprises an STE module and at least one layer of TCLF network. The STE module extracts shallow features of the input electroencephalogram signal. The TCLF network comprises a CNN-based local feature extraction branch, a Transformer-based global feature extraction branch, an adaptive fusion module and an FFT module, and is used for extracting multi-dimensional features from the shallow features. The classifier generates a classification result of the electroencephalogram signal according to the multi-dimensional features. A training framework introducing a domain adaptation mechanism and a domain adversarial mechanism is used to train the electroencephalogram recognition model. The trained network model is used to recognize the input electroencephalogram signal. The present application solves the defects of insufficient detection accuracy and generalization of the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of electroencephalography (EEG) recognition, specifically relating to a method for recognizing depressive EEG signals, and its corresponding storage medium, computer program product, and EEG recognition device. Background Technology

[0002] Depression (MDD) is a complex mental disorder characterized by persistent low mood, loss of interest, and cognitive decline, severely impacting patients' quality of life. Timely and accurate diagnosis and intervention are crucial to preventing the condition from worsening. Currently, clinical MDD detection relies on comprehensive evaluations, such as patient scale tests and clinical assessments by physicians. Among these scales, the PHQ9 and Hamilton Depression Rating Scale are the most commonly used. However, these methods are highly subjective and may lead to inconsistencies and biases in diagnostic results. Therefore, finding an objective, reliable, and efficient method for detecting depression has become a current research hotspot.

[0003] In recent years, physiological indicators-based depression detection technologies have received widespread attention. Electroencephalography (EEG), in particular, as an objective source of physiological data, has shown unique advantages in analyzing brain function and diagnosing mental illnesses due to its non-invasiveness, high temporal resolution, and difficulty in falsification. For example, S2DSCNN designs a two-dimensional self-attention structure based on shallow CNNs and the Grad-CAM algorithm, enabling the model to capture information at different scales and spans within the functional connectivity matrix. MCRNN uses a multi-scale convolutional recurrent neural network to analyze EEG, effectively classifying patients into two neurophysiological subtypes.

[0004] However, research on the neural mechanisms of depression via EEG faces two major challenges: insufficient utilization of EEG features and insufficient model generalization ability due to significant individual variability. First, regarding feature utilization, current methods mainly include manual and automated feature extraction. The former relies on manual feature extraction and machine learning techniques, which often require substantial expertise and experience and are easily influenced by subjective factors, thus limiting the effectiveness and reliability of the features. The latter, centered on deep learning technology, automatically mines potential features from raw EEG signals by constructing neural network models. This method is better at capturing complex and hidden nonlinear features in EEG signals, thus opening new possibilities for improving the sufficiency of feature utilization. Second, regarding model generalization, significant differences among individuals in age, sex, genetic background, disease course, and comorbidities make it exceptionally difficult to extract universally applicable biomarkers from EEG data. This results in existing studies performing poorly on new individuals outside the training set, exhibiting weak generalization ability, thus severely limiting their potential for translation into clinical diagnosis and assessment. In addition, existing studies either only target specific subtypes of depression or rely on partial labeling information from the target domain, which still have significant limitations in terms of model universality and practical deployment feasibility. Summary of the Invention

[0005] To address the shortcomings of existing neural network-based EEG recognition schemes, which generally suffer from insufficient recognition accuracy and generalization due to limitations in model feature extraction capabilities and sample data quantity, this invention provides a novel method for recognizing depressive EEG signals, along with its corresponding storage medium, computer program product, and EEG recognition device.

[0006] This invention is achieved using the following technical solution: A method for identifying depressive EEG signals includes: A multidimensional feature extractor and a classifier are constructed for EEG recognition. The multidimensional feature extractor comprises a Shallow Labeled Encoding (STE) module and at least one layer of Two-Branch Adaptive Fusion (TCLF) network. The STE module extracts shallow features containing location encoding from the input EEG signal. The TCLF network includes a CNN-based local feature extraction branch, a Transformer-based global feature extraction branch, an Adaptive Fusion (DAFM) module, and an FFT module. The TCLF network following the STE module simultaneously inputs the shallow features into both branches for feature extraction. The DAFM module aligns the output features of the two branches and then fuses them into enhanced deep features using adaptively generated fusion weights. The FFT module performs a Fast Fourier Transform on the local features extracted by the local feature extraction branch to obtain spectral features. When a multi-layer TCLF network is included, the deep features output from the previous layer are used as input to the next layer. The deep features output from the last layer are concatenated with the local features and spectral features output from each layer to obtain the multidimensional features output by the multidimensional feature extractor. The classifier generates the classification result of the EEG signal based on the multidimensional features.

[0007] A training framework incorporating domain adaptation and domain adversarial mechanisms is constructed. A joint loss function is constructed using source domain classification loss, target domain pseudo-label loss, and domain adversarial loss based on cross-entropy loss. The EEG recognition module is trained using sample signals from the source and target domains.

[0008] The model parameters of the EEG recognition model that meets the performance requirements after training are retained and used to recognize the input EEG signals.

[0009] As a further improvement of the present invention, in the STE module, the input data is processed sequentially through two two-dimensional convolutional layers, a BN layer, an ELU activation layer and a max pooling layer, and the resulting features are output as shallow features after positional encoding embedding.

[0010] As a further improvement of the present invention, in the TCLF network, the global feature extraction branch includes a max pooling layer, a multi-head attention (MSA) module, and a feedforward network.

[0011] The global feature extraction branch first performs max pooling on the input shallow features to reduce the feature dimensionality, and then the MSA module generates multi-scale attention features based on the dimensionality-reduced input features. Finally, the features output from the max pooling layer and the MSA module are concatenated and input into the feedforward network to obtain global features.

[0012] As a further improvement of the present invention, in the TCLF network, the local feature extraction branch sequentially includes a Dropout layer, a one-dimensional convolutional layer, a BN layer, an ELU activation layer, and a max pooling layer; shallow features are processed by each layer in the local feature extraction branch to obtain local features.

[0013] As a further improvement of this invention, in the TCLF network, the DAFM module includes two linear alignment layers and a fusion weight generation module. First, the global and local features are aligned using two independent linear alignment layers to obtain new global features. and new local features Then, the fusion weight generation module generates weights based on... and splicing features concat feat Generate fusion weights Finally, based on the fusion weights... and Weighted fusion is performed to obtain enhanced deep features. ; .

[0014] The fusion weight generation module includes, in sequence, a first linear layer, an LN layer, a GELU activation layer, a Dropout layer, a second linear layer, and a Sigmoid activation layer. It generates the fusion weights. The expression is: ; In the above formula, W 1. b 1 represents the weights and biases of the first linear layer, respectively; W 2. b 2 represents the weights and biases of the second linear layer, respectively; represents the Sigmoid activation function; z represents the output feature of the Dropout layer in the fusion weight generation module; Dropout (·) represents the Dropout operation; GELU represents the GELU activation function; LN(·) represents the layer normalization operation; cat[·] represents the feature concatenation operation.

[0015] As a further improvement of the present invention, in the training framework that introduces a domain adaptation mechanism, the classifier of the EEG recognition model includes multiple source domain classifiers and a target domain classifier; the target domain classifier includes a pseudo-label generator and a confidence filter.

[0016] During the training phase, the model is first trained on source domain data, using real labels to calculate the classification loss, thus ensuring the model can accurately identify depressive features in EEG signals. Subsequently, when processing target domain data, the target domain classifier generates pseudo-labels based on the current prediction results and a confidence threshold; only when the model's prediction confidence is higher than the confidence threshold are the generated pseudo-labels used for training. The calculation of pseudo-labels involves both probability prediction and confidence filtering, constrained by a target domain pseudo-label loss based on cross-entropy loss.

[0017] As a further improvement to this invention, the EEG recognition model also includes a gradient inversion layer and a domain classifier in the training framework that introduces a domain adversarial mechanism. The source domain features and target domain features extracted by the multidimensional feature extractor are first processed by the gradient inversion layer, and then the domain classifier is used to obtain the predicted score of domain affiliation; finally, the domain adversarial loss is calculated to guide the model in parameter optimization.

[0018] As a further improvement to the present invention, combined loss L total The expression is as follows: ; In the above formula, L sdt , L tdp , L dom These represent the source domain classification loss, the target domain pseudo-label loss, and the domain adversarial loss, respectively. Indicates the source domain sample at the th k Predicted values ​​on the class; Indicates the source domain sample number. k Real labels on the class; C Represents the total number of categories; Indicates the target domain. k The target domain category prediction results after the samples are filtered by a high-confidence mask; Indicates the target domain sample at the th k High-confidence pseudo-labels for this class; The representation domain discriminator predicts the source domain samples as source domain samples; The domain discriminator predicts the target domain sample as the target domain result; Represented as the domain label of the source domain sample; Domain labels representing the target domain samples; and They represent L tdp and L dom The weight.

[0019] The present invention also includes a storage medium storing a computer program, which, when executed by a processor, creates an EEG recognition model trained as described in the aforementioned method for recognizing depressive EEG signals, and is used to recognize input EEG signals.

[0020] The present invention also includes a computer program product comprising a computer program that, when executed by a processor, creates an EEG recognition model trained as described in the aforementioned method for recognizing depressive EEG signals, and is used to recognize input EEG signals.

[0021] The present invention also includes an EEG recognition device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it creates an EEG recognition model trained as described in the aforementioned method for recognizing depressive EEG signals, and uses it to recognize input EEG signals.

[0022] The technical solution provided by this invention has the following beneficial effects: This invention provides a novel method for identifying depressive EEG signals, making improvements at both the EEG recognition model design and network training levels. At the network model design level, this invention proposes a multi-dimensional feature extractor with dynamic adaptive fusion, which extracts fine-grained local features and coarse-grained global features through two feature extraction branches based on CNN and Transformer, respectively. The dynamic adaptive fusion strategy effectively integrates the dual-branch features of CNN and Transformer, simultaneously mining local details and global correlation information in the EEG signal. The improved network model can significantly improve the detection accuracy of EEG signals.

[0023] At the network model training level, this invention proposes a novel strategy that incorporates domain adaptation and domain adversarial mechanisms. During the training phase, a multi-dimensional loss strategy is employed, including classification loss, pseudo-label loss, and domain adversarial loss, to enhance the model's adaptability to new subjects. Through a phased learning strategy, the model parameters are progressively optimized. This new training strategy not only improves the model's detection accuracy but also enables the model to exhibit good generalization ability. Attached Figure Description

[0024] Figure 1 This is a diagram of the EEG recognition model used in the depressive EEG signal recognition method provided in Embodiment 1 of the present invention.

[0025] Figure 2 This is a schematic diagram of the STE module in the EEG recognition model of Embodiment 1 of the present invention.

[0026] Figure 3This is a schematic diagram of the TCLF network in the EEG recognition model of Embodiment 1 of the present invention.

[0027] Figure 4 This is a schematic diagram of the DAFM module in the EEG recognition model of Embodiment 1 of the present invention.

[0028] Figure 5 This is a schematic diagram of the FFT module in the EEG recognition model of Embodiment 1 of the present invention.

[0029] Figure 6 This is a t-SNE visualization of the feature information output by different modules in the present invention during performance testing experiments. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0031] Example 1

[0032] To address the shortcomings in accuracy and generalization of existing neural network-based EEG signal recognition schemes for depressive disorders, this embodiment provides a method for recognizing depressive EEG signals. This method primarily includes two improvements: Firstly, at the feature extraction level of the EEG recognition model, this embodiment proposes a novel dual-branch adaptive fusion network, abbreviated as TCLF network. This network can achieve dual-branch feature extraction and adaptive feature fusion enhancement. Specifically, this network extracts local and global features of the EEG through feature extraction branches based on CNN and Transformer modules, respectively. Then, it dynamically adjusts the contribution of features from different branches through a dynamic adaptive fusion mechanism, and combines a feature alignment layer to solve the problem of cross-branch feature distribution differences. Compared with static fusion strategies such as feature addition or dimension concatenation commonly used in existing network models, the improved model of this invention can more efficiently capture complementary correlations and deep discriminative information between features from different branches. Furthermore, compared with some feature fusion methods that rely on complex cross-attention mechanisms to enhance feature interaction capabilities, the technical solution provided by this invention can significantly reduce computational burden, making it more suitable for widespread application in clinical scenarios.

[0033] On the other hand, during the training phase of the EEG recognition model, this invention employs a unique training framework that incorporates domain adaptation and domain adversarial mechanisms. The domain adaptation mechanism generates predictions on unlabeled target domain data during training and selects high-confidence predictions as pseudo-labels to assist in optimizing model parameters using source domain data. This gradually transitions the model's predictive performance on source domain data to target domain data. The domain adversarial mechanism utilizes gradient inversion layers for domain adversarial training to minimize the differences in domain attributes between the source and target domains. This novel training strategy not only improves the model's adaptability and accuracy on new subject groups but also enhances its generalization ability across different subjects, effectively addressing the problems of large individual variability and insufficient cross-subject model generalization.

[0034] In detail, such as Figure 1 As shown in the figure, the method for identifying depressive EEG signals provided in this embodiment includes the following steps: I. Construct an EEG recognition model that includes a multidimensional feature extractor and a classifier.

[0035] In the EEG recognition model constructed in this embodiment, a multidimensional feature extractor is used to extract multidimensional and multi-level features from the input EEG signal, and adaptively fuses and enhances the extracted features to obtain the required multidimensional features. A classifier is used to generate classification results for the EEG signal based on the multidimensional features.

[0036] The multidimensional feature extractor in the constructed EEG recognition model includes a shallow labeled encoding (STE) module and at least one layer of two-branch adaptive fusion (TCLF) network. In practical applications, the number of layers in the two-branch adaptive fusion network can be dynamically adjusted as needed. For example, compared with an EEG recognition model using a single-layer two-branch adaptive fusion network, an EEG recognition model using a two-layer two-branch adaptive fusion network achieves a greater increase in model classification accuracy with relatively small model parameter expansion. However, when the two-branch adaptive fusion network grows to three layers or more, the increase in model classification accuracy is relatively low compared to the scale of model parameter expansion. Therefore, in a more optimized scheme, the constructed EEG recognition model preferably adopts a multidimensional feature extractor containing a two-layer two-branch adaptive fusion network.

[0037] In the multidimensional feature extractor, the STE module is used to extract shallow features containing location encoding based on the input EEG signal. In this embodiment, as... Figure 2As shown, the STE module sequentially comprises two 2D convolutional layers, a Batch Normalization (BN) layer, an ELU activation layer, and a max-pooling layer. The input EEG signal first undergoes feature extraction through the two 2D convolutional layers to obtain corresponding feature maps. In this embodiment, the kernel sizes of the two 2D convolutional layers can be optimized and adjusted as needed; they can use the same kernel or different kernel sizes. The features extracted by the 2D convolutional layers are batch normalized in the BN layer, and then non-linearly activated by the activation function in the ELU activation layer. The activated features are then max-pooled through the MaxPool layer to achieve feature downsampling and dimensionality reduction, obtaining shallow features that retain the salient features of the original data. Finally, the obtained features are embedded using positional encoding and output as shallow features (denoted as F). In this embodiment, the shallow features extracted from the EEG signal by the STE module are simultaneously input into the two feature extraction branches of the subsequent first TCLF network to extract deep features containing global and local features, as well as spectral features, respectively.

[0038] like Figure 1 and Figure 3 As shown, the TCLF network designed in this embodiment includes a CNN-based local feature extraction branch, a Transformer-based global feature extraction branch, an adaptive fusion (DAFM) module, and an FFT module.

[0039] The TCLF network following the STE module serves as the first TCLF network. This first TCLF network simultaneously inputs the shallow features extracted by the STE module into both branches for feature extraction. In the Transformer-based global feature extraction branch, the shallow features undergo multi-head attention computation and weighted fusion to obtain multi-size attention features; these features are then processed through a series of steps to obtain the original global features. In the CNN-based local feature extraction branch, shallow features, after being processed by the feature extraction network, can yield local features at the corresponding scale. Next, the DAFM module aligns the output features of the two branches and then fuses them into an enhanced deep feature using adaptively generated fusion weights, denoted as . The FFT module is used to perform a fast Fourier transform on the local features extracted by the local feature extraction branch to obtain spectral features.

[0040] In a multidimensional feature extractor, when multiple layers of TCLF networks are included, the deep features output from the previous layer serve as the input to the next layer. The deep features output from the last layer are concatenated with the local and spectral features output from each layer to form the multidimensional features output by the multidimensional feature extractor. If only one layer of TCLF network is included, the deep, local, and spectral features output from that layer are concatenated and directly used as the multidimensional features output by the multidimensional feature extractor.

[0041] like Figure 3 As shown, in the TCLF network, the global feature extraction branch includes a max pooling layer, a multi-head attention (MSA) module, and a feedforward network (FFN). The global feature extraction branch first performs max pooling on the input shallow features to reduce the feature dimensionality, and then the MSA module generates multi-scale attention features based on the dimensionality-reduced input features. Finally, the features output by the max pooling layer and the MSA module are concatenated and input into the feedforward network for processing to obtain the global features.

[0042] In detail, within the multi-head attention module of the global feature extraction branch, each attention head first passes through a learnable parameter matrix. W q , W k , W v Input shallow features after max pooling MaxPool ( F Convert ) into the corresponding query vector Q Key vector K Sum value vector V : ; Subsequently, based on the query vector, the following formula is used... Q Key vector K Sum value vector V Calculate the corresponding attention score : ; In the above formula, d k This represents the dimension of the key vector.

[0043] Next, the calculated attention score is multiplied by the input features of the MSA module to obtain the multi-scale attention features weighted by the multi-head attention mechanism, denoted as . F MSA .

[0044] Finally, the features output from the max pooling layer and the MSA module are concatenated and then input into the feedforward network for processing to obtain coarse-grained global features. , The expression is as follows: ; In the above formula, Maxpool (·) indicates a max pooling operation; FFN This represents a feedforward network. Additionally, global features... The superscript i represents the layer index of the TCLF network to which the global feature extraction branch belongs. When i=1, it means that it is a global feature extracted by the global feature extraction branch of the first layer TCLF network; when i=2, it means that it is a global feature extracted by the global feature extraction branch of the second layer TCLF network, and so on.

[0045] like Figure 3 As shown, in the TCLF network, the local feature extraction branch sequentially includes a Dropout layer, a one-dimensional convolutional layer, a BN layer, an ELU activation layer, and a max pooling layer. As the shallow feature F is processed sequentially through each layer in the local feature extraction branch, it is gradually transformed into fine-grained local features in the CNN branch. In this embodiment, this is denoted as... .

[0046] It should be noted that the global features output by the two feature extraction branches and local features Although both are extracted from shallow features F, their data processing methods differ, focusing on coarse-grained and fine-grained feature information respectively, resulting in different feature dimensions. To address this issue, this embodiment designs a novel Adaptive Fusion (DAFM) module in the TCLF network. This module can perform linear transformation and feature alignment on features extracted from the two branches with different dimensions. Then, a gating network is used to learn dynamic weights, thereby adaptively fusing coarse-grained global features and fine-grained local features, and resolving the problem of inconsistent feature distribution between the two branches.

[0047] Specifically, such as Figure 4 As shown, the DAFM module provided in this embodiment includes two linear alignment layers and a fusion weight generation module. First, the global and local features are aligned using two independent linear alignment layers to obtain new global features. and new local features : ; In the above equation, Linear1 and Linear2 are the linear alignment layers corresponding to the CNN branch and the Transformer branch, respectively; they independently perform linear transformations on the input features of their respective branches to eliminate the problem of scale inconsistency. The parameters of the two linear alignment layers can be adaptively optimized through training.

[0048] Then, through the fusion weight generation module, based on... and splicing features concat feat Generate fusion weights The fusion weight generation module in this embodiment is a gated network that can generate fusion weights based on the concatenated features input in real time. Specifically, the fusion weight generation module sequentially includes a first linear layer, an LN layer, a GELU activation layer, a Dropout layer, a second linear layer, and a Sigmoid activation layer; the introduced Dropout layer can improve the model's generalization ability. This fusion weight generation module generates fusion weights. The expression is: ; In the above formula, W 1. b 1 represents the weights and biases of the first linear layer, respectively; W 2. b 2 represents the weights and biases of the second linear layer, respectively; represents the Sigmoid activation function; z represents the output feature of the Dropout layer in the fusion weight generation module; Dropout (·) represents the Dropout operation; GELU represents the GELU activation function; LN(·) represents the layer normalization operation; cat[·] represents the feature concatenation operation.

[0049] Next, this embodiment will adjust the fusion weights accordingly. and Weighted fusion is performed to obtain enhanced deep features. : .

[0050] The output deep features contain both global dependency information and local detailed dynamic features, providing an important basis for subsequent information processing.

[0051] Furthermore, in the TCLF network, this embodiment also extracts local features from the local feature extraction branch. The data is input to the FFT module, which then extracts spectral features containing depression-related rhythmic spectral details from the EEG signal. The schematic diagram of the FFT module is shown below. Figure 5 As shown, it consists of a Fast Fourier Transform (FFT.fft) unit, an absolute value calculation unit, a mean calculation unit, and a logic processing unit (log). The FFT module performs a Fast Fourier Transform on the input data to calculate the frequency distribution and detail-preserving values, thereby obtaining the spectral features with preserved details.

[0052] Finally, in the multidimensional feature extractor, this embodiment concatenates the deep features output by the last layer of the TCLF network with the local features and spectral features output by the aforementioned layers of the TCLF network to obtain the desired multidimensional features.

[0053] 2. Construct a training framework that incorporates domain adaptation and domain adversarial mechanisms. Employ source domain classification loss, target domain pseudo-label loss, and domain adversarial loss based on cross-entropy loss, and use source and target domain sample signals to train the EEG recognition module.

[0054] New participants often lack pre-labeled information, which limits the generalization ability of traditional supervised learning methods. To address this issue, this embodiment employs a training framework that introduces a domain adaptation mechanism during the training phase. Figure 1 As shown, within this framework, the classifier of the EEG recognition model includes multiple source domain classifiers and one target domain classifier; the target domain classifier includes a pseudo-label generator and a confidence filter.

[0055] During the training phase, the model is first trained on source domain data, and the classification loss is calculated using the true labels to ensure that the model can accurately identify depressive features in EEG signals. In this embodiment, a source domain classification loss based on cross-entropy loss is used in this phase. L sdt Its expression is: ; In the above formula, Indicates the source domain sample at the th k Predicted values ​​on the class; Indicates the source domain sample number. k Real labels on the class; C This indicates the total number of categories.

[0056] Subsequently, when processing target domain data, the target domain classifier utilizes a pseudo-label generator and a confidence filter to generate pseudo-labels based on the current prediction results and a confidence threshold. Only when the model's prediction confidence exceeds the confidence threshold are the generated pseudo-labels used for training; thus improving model performance in the absence of true labels. This strategy significantly enhances the model's generalization ability, making it more suitable for new clinical settings and diverse subjects.

[0057] The pseudo-label calculation process involves probability prediction and confidence screening, and is constrained by a target domain pseudo-label loss based on cross-entropy loss; the specific process is as follows: Assuming the extracted first j The EEG characteristics of each target sample are ,in, d Representing feature dimension, N tThe total number of samples in the target domain. The classifier trained in the source domain is used for the first... j The original predicted score (i.e., logits) for each target sample is denoted as... ,in, C The number of EEG-related categories for depression (e.g., in this embodiment) C = 2).

[0058] To quantify the model's prediction confidence for the target sample in each category, this embodiment uses the softmax function to convert the log odds value into class probabilities. The details are as follows: ; In the above formula, Indicates the first j The target sample belongs to the first c The probability of each depression category; and They belong to the first c and the k The predicted scores of target samples in each category.

[0059] Furthermore, the initial pseudo-label of the j-th target sample is defined as the category corresponding to the highest probability (i.e., the most likely category of depression predicted by the source domain classifier), that is: ; In the above formula, Indicates the first j The confidence score of each target domain sample.

[0060] Thus, in the first stage of training, this embodiment transferred the ability to recognize depressive EEG patterns from the source domain to the target domain, laying the foundation for subsequent unsupervised training based on pseudo-supervision.

[0061] Because of the distribution shift between the source and target domains, the initially generated pseudo-labels may contain labeling errors. These noisy labels can cause negative transfer (leading to a decrease in model recognition performance). Therefore, this embodiment introduces a confidence filtering mechanism in the target domain classifier to retain only reliable pseudo-labels; the implementation process is as follows: First, based on the calculated number j Calculate the confidence score of each target domain sample; set a confidence threshold. (Typically optimized within the range of [0.5, 0.9]) to filter high-confidence samples and define a binary mask. To distinguish between reliable and unreliable pseudo-labels.

[0062] ; In the above formula, Indicates the first j Each target domain sample is a high-confidence pseudo-label (which can be retained for training). This indicates a low confidence level (and should be discarded to avoid noise monitoring).

[0063] The core basis of this screening strategy is: high-confidence samples. It more closely approximates the true depression labels in the target domain. This mechanism can effectively reduce the negative impact of erroneous pseudo-labels and ensure that the supervision signals for the depressive EEG signal recognition task are authentic and reliable.

[0064] In this embodiment, pseudo-labels selected based on confidence levels can be used for the second-stage training of the target domain data. Furthermore, this embodiment calculates cross-entropy loss for samples with high confidence levels in the target domain. This strategy helps mitigate the adverse effects of noisy labels on model training, thereby improving the model's performance and generalization ability in the target domain. By focusing on high-confidence samples, this embodiment can more effectively utilize pseudo-labels in unsupervised domain adaptation, ensuring that the information learned by the model is both reliable and valuable.

[0065] In this embodiment, a target domain pseudo-label loss based on cross-entropy loss is used. L tdp The calculation is as follows: ; In the above formula, Indicates the target domain. k The target domain category prediction results after high-confidence mask filtering; Indicates the target domain sample at the th k High-confidence pseudo-labels for each class; C represents the total number of classes.

[0066] In the model training of this embodiment, in order to reduce the distribution difference between the source domain and the target domain and improve the model's generalization ability among different subjects, in addition to the aforementioned domain adaptation mechanism, this embodiment also introduces a domain adversarial mechanism into the training framework. For example... Figure 1 As shown, the domain adversarial mechanism further incorporates a gradient inversion layer (GRL) and a domain classifier (Damain Head) into the EEG recognition model. This mechanism uses a domain classifier to identify domain features, while the gradient inversion layer reverses the gradient direction during backpropagation, thereby forcing the multidimensional feature extractor to generate domain-invariant feature representations.

[0067] In the training strategy that introduces a domain adversarial mechanism in this embodiment, the source and target domain features extracted by the multidimensional feature extractor are first processed through a gradient reversal layer, and then the domain classifier is used to obtain the predicted score of the domain affiliation. Finally, the domain adversarial loss is calculated to guide the model in parameter optimization. Specifically, the implementation process of the domain adversarial mechanism is as follows: First, the source domain tag Set to 0, target domain label Set to 1. The EEG features of the source domain, after being processed by a gradient inversion layer (GRL), are input into the domain classifier to obtain a predicted score for domain attribution. , : .

[0068] In the above formula, Represents the EEG characteristics of the source domain, GRL(·) represents the gradient inversion layer operation, and N s This represents the number of samples in the source domain.

[0069] Correspondingly, the target domain features are also processed by a gradient inversion layer (GRL) before being input into the domain classifier to obtain the predicted score for domain attribution. , : ; In the above formula, N represents the EEG characteristics of the target domain. t This represents the number of samples in the target domain.

[0070] Next, based on the predicted domain affiliation scores of the source and target domain samples, the classification loss is calculated using cross-entropy loss to evaluate the discriminative ability of the domain classifier for source and target domain samples. The average of these two loss values ​​is taken as the final domain adversarial loss. L dom This ensures that the model achieves balanced optimization across both domains. Specifically, domain adversarial loss. L dom The calculation formula is as follows: ; In the above formula, The representation domain discriminator predicts the source domain samples as source domain samples; The domain discriminator predicts the target domain sample as the target domain result.

[0071] In summary, this embodiment employs a joint loss function during the training phase, which includes source domain classification loss, target domain pseudo-label loss, and domain adversarial loss. L total Its expression is as follows: ; In the above formula, and They represent L tdp and L dom The weight.

[0072] Third, retain the model parameters of the EEG recognition model that meets the performance requirements after training, and use them to recognize the input EEG signals.

[0073] In this embodiment, accuracy, specificity, precision, recall, and F1 score can be used as performance evaluation metrics for the trained EEG recognition module. The network model used in the application phase only needs to include a parameter-optimized multidimensional feature extractor and a target domain classifier.

[0074] Example 2

[0075] The method for identifying depressive EEG signals provided in Example 1 is essentially a data processing method. It analyzes the input raw EEG signals to identify whether they belong to the depressive EEG signal category, which carries a risk of depression. Furthermore, it can classify depressive EEG signals to identify the corresponding subtypes. In practical applications, the identification results provided by this method can serve as auxiliary information for clinicians diagnosing patients with depression.

[0076] In this embodiment, to better apply the solution in Embodiment 1, this embodiment further provides a storage medium, a computer program product, and an EEG recognition device. The storage medium provided in this embodiment stores a computer program. When the computer program is executed by a processor, it creates an EEG recognition model trained in the depressive EEG signal recognition method of Embodiment 1, and uses it to recognize the input EEG signals.

[0077] The computer program product provided in this embodiment includes a computer program. When the computer program is executed by a processor, it creates an EEG recognition model trained in the depressive EEG signal recognition method of Embodiment 1, and uses it to recognize the input EEG signals.

[0078] The EEG recognition device provided in this embodiment includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it creates an EEG recognition model trained as in the method for recognizing depressive EEG signals in Embodiment 1, and uses it to recognize input EEG signals.

[0079] The EEG recognition device provided in this embodiment is essentially a computer device. In practical applications, it can be an embedded device to directly predict faults based on vibration signals collected from the front end. Alternatively, it can be a standalone computer device, such as a laptop, tablet, desktop computer, or a rack server, blade server, tower server, or cabinet server (including standalone servers or server clusters composed of multiple servers) capable of executing computer programs. This allows for the separate processing of vibration signals from different sources output from the front end and enables fault analysis.

[0080] The computer device in this embodiment includes, but is not limited to, a memory and a processor that can be interconnected via a system bus. In this embodiment, the memory (i.e., the readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory can be an internal storage unit of the computer device, such as the hard disk or RAM of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Of course, the memory can also include both internal storage units and external storage devices of the computer device. In this embodiment, the memory is typically used to store the operating system and various application software installed on the computer device. Furthermore, the memory can also be used to temporarily store various types of data that have been output or will be output.

[0081] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is typically used to control the overall operation of a computer device.

[0082] Simulation test

[0083] To verify the performance of the depressive EEG signal recognition method provided by this invention, technicians simulated and trained the relevant scheme and tested the performance of the trained network model. The specific experimental process is as follows: I. Dataset This experiment used two publicly available EEG datasets for depression: MODMA and HUSM. The MODMA dataset was collected by Lanzhou University. All participants signed written informed consent forms before the start of the study. The research protocol and informed consent procedures were approved by the local biomedical research ethics committee of the Second Hospital of Lanzhou University and complied with the ethical principles of the World Medical Association (Declaration of Helsinki). This dataset contains resting-state EEG recordings of 24 patients diagnosed with major depressive disorder (MDD) and 29 healthy controls (HC). Participants wore 128-lead electrode caps and recorded EEG signals for 5 minutes at a sampling rate of 250 Hz with their eyes closed. The HUSM dataset was collected by Universiti Kelantan, Malaysia, at Sultan Ismail Petra Hospital (HUSM), and its experimental design was approved by the local human ethics committee. From the official repository of this dataset, this experiment obtained EEG data recorded in a resting-state state with eyes closed, including data from 30 MDD patients and 28 HC. Data acquisition was performed using a 19-lead electrode cap, recording signals at a sampling rate of 256 Hz over a 5-minute period.

[0084] To address the inherent significant noise issue in EEG signals, this experiment applied a series of preprocessing steps to improve data quality for both datasets. These included removing 50 Hz power line interference, applying a bandpass filter in the 0.5–50 Hz range, performing ICA analysis, using the iclabel toolbox to remove artifacts related to EMG, EOS, and ECG activity, and eliminating samples with absolute amplitudes exceeding 150 μV. To ensure consistency between the two datasets, the electrode positions in the MODMA dataset were aligned with the 19-lead configuration used in the HUSM dataset. Nearly identical electrode positions (Fp1, F7, F3, T3, C3, T5, P3, O1, Fp2, F4, F8, C4, T4, P4, T6, O2, Fz, Pz, Oz) were selected to achieve channel spatial alignment. Furthermore, the HUSM dataset was resampled to a 250 Hz sampling frequency. These preprocessing steps ensured data compatibility from both sources for subsequent comparative analysis.

[0085] II. Experimental Environment

[0086] This experiment employed a participant-independent 10-fold cross-validation method, with the final performance metric being the average of 10 validations. The Adam optimizer was used for model training, with an initial learning rate of 1e-4, a weight decay coefficient of 2e-5, and a fixed batch size of 80. All experiments were conducted on a computer running Windows 10, with hardware including an Intel Core i7-10700 CPU and an NVIDIA GeForce RTX 4090 GPU, and Python 3.7 as the software environment.

[0087] III. Evaluation Indicators for the Control Group

[0088] To comprehensively evaluate model performance, this experiment used five evaluation metrics, including accuracy, specificity, precision, recall, and F1 score.

[0089] To more accurately evaluate the relative performance of the proposed solution, this invention compares its solution with several state-of-the-art existing solutions on two datasets. The existing baseline models used as the control group include EEGNet2D, DeepConvNet, ShallowConvNet, Tception, HEMAsNet, Deformer, MGFormer, and STKG-TP.

[0090] Among them, EEGNet2D, DeepConvNet, and ShallowConvNet are convolutional neural network-based models that capture the spatial and temporal features of EEG signals through multiple convolutional layers. The Tception model extracts multi-scale temporal features of EEG signals using time windows of different scales. HEMAsNet combines multi-scale convolutional neural networks and long short-term memory units, focusing on extracting temporal features from both hemispheres of the brain. The Deformer model uses parallel Transformers and CNN-based branches to simultaneously extract long-term and short-term EEG temporal features, and achieves efficient decoding of EEG signals through feature addition and fusion. MGFormer is a hybrid architecture combining convolutional neural networks and Transformers, specifically designed for EEG-based Alzheimer's disease classification. The STKG-TP model combines spatiotemporal knowledge graphs with trajectory semantic cross-fusion technology for the identification of depression.

[0091] IV. Experimental Results and Analysis

[0092] In this experiment, the proposed method and the control group were trained and tested on two datasets. The performance metrics obtained are shown in the table below: Table 1: Performance comparison of the present invention and the control group scheme on different datasets

[0093] Analysis of the data in the table above shows that the accuracy of the proposed solution is higher than the baseline model on both MODMA and HUSM datasets. Specifically, the proposed solution achieves a maximum accuracy of 90.77% on MODMA, which is 2.75%-15.34% higher than other methods. The same experimental results are observed on the HUSM dataset, where the accuracy is 5.54%-18.71% higher than other methods. On the MODMA dataset, although Deformer achieved a higher recall rate, its specificity was only 81.29%, 9.75% lower than the proposed solution, indicating that its output is relatively biased towards positive samples. Compared to the proposed solution, STKG-TP achieved a slightly higher F1 score, but the other four metrics were lower, indicating that the proposed solution still has a significant advantage in correctly identifying depressive EEG signals. In summary, the proposed solution demonstrates good generalization ability when processing different datasets, maintaining high accuracy and stability on both MODMA and HUSM datasets.

[0094] V. Ablation Experiment

[0095] 5.1 Training Strategy

[0096] To systematically evaluate the effectiveness of the three loss functions used in the training phase of the proposed method, comprehensive ablation experiments were conducted on two benchmark datasets, MODMA and HUSM. Specifically, this experiment compared the performance of the complete model with several simplified variants by progressively introducing different loss terms: source domain classification loss only (denoted as A0), loss including source domain classification loss and domain adversarial loss (denoted as A1), and loss including source domain classification loss and target domain pseudo-label loss (denoted as A2). The performance metrics of the different schemes are shown in the table below: Table 2: Ablation Experiment Results of the Scheme of the Invention

[0097] Analysis of the data in the table above shows that the five performance metrics obtained by the A0 method are 87.21%, 85.17%, 86.62%, 90.46%, and 85.06%, respectively. Compared to the A0 method, the A1 method shows improvements in all metrics, especially on the HUSM dataset, where the specificity metric is improved by 4.1%. For the A2 method, the performance improvement is slightly lower than that of the A1 method, possibly because the complex and variable distribution of EEG signal data makes it impossible for pseudo-labels to accurately capture all key category features. However, compared to the A0 method, all performance metrics are improved, indicating that the A2 method still has a positive effect on improving model performance, especially the specificity metric, which shows a significant improvement of 3.65%-4.25% on both datasets. Finally, the complete scheme of fusing three loss functions adopted in this invention outperforms all other schemes, improving the accuracy by 3.56% and 3.92% on the two datasets, respectively.

[0098] 5.2 Network Model Design

[0099] To more intuitively analyze the contributions of each functional module in the EEG recognition model provided by this invention, this experiment used t-SNE technology to visualize the original input features and the deep features processed by a two-layer TCLF network. The results are as follows: Figure 6 As shown in the figure, data points corresponding to depressive EEG patterns (MDD) are represented by green circles, while non-depressive EEG data (HC) are represented by blue squares. Analysis of the data in the graph shows that the features of MDD and HC in the original input features overlap significantly, making them difficult to distinguish. However, with the gradual addition of domain adaptation strategies, the proposed method can effectively differentiate between MDD and HC. This visualization not only confirms the effectiveness of each module in the proposed method but also intuitively demonstrates how these modules work synergistically to improve the accuracy of depression detection.

[0100] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for identifying depressive EEG signals, characterized in that, It includes: Construct an EEG recognition model that includes a multidimensional feature extractor and a classifier; The multidimensional feature extractor includes a shallow labeling and encoding (STE) module and at least one layer of a two-branch adaptive fusion network (TCLF). The STE module extracts shallow features containing location encoding based on the input EEG signal. The TCLF network includes a CNN-based local feature extraction branch, a Transformer-based global feature extraction branch, an adaptive fusion module (DAFM), and an FFT module. The TCLF network following the STE module simultaneously inputs the shallow features into both branches for feature extraction. The DAFM module aligns the output features of the two branches and then fuses them into enhanced deep features using adaptively generated fusion weights. The FFT module performs a fast Fourier transform on the local features extracted by the local feature extraction branch to obtain spectral features. When a multi-layer TCLF network is included, the deep features output from the previous layer are used as the input to the next layer. The deep features output from the last layer are concatenated with the local features and spectral features output from each layer to obtain the multidimensional features output by the multidimensional feature extractor. The classifier is used to generate classification results of EEG signals based on multidimensional features; A training framework incorporating domain adaptation and domain adversarial mechanisms is constructed. The source domain classification loss, target domain pseudo-label loss, and domain adversarial loss based on cross-entropy loss are used as joint loss functions. The EEG recognition module is trained using source domain and target domain samples. The model parameters of the EEG recognition model that meets the performance requirements after training are retained and used to recognize the input EEG signals.

2. The method for identifying depressive EEG signals as described in claim 1, characterized in that: In the STE module, the input data is processed sequentially through two 2D convolutional layers, a BN layer, an ELU activation layer, and a max pooling layer. The resulting features are then embedded using positional encoding and output as shallow features.

3. The method for identifying depressive EEG signals as described in claim 1, characterized in that: In the TCLF network, the global feature extraction branch includes a max pooling layer, a multi-head attention module (MSA), and a feedforward network. The global feature extraction branch first performs max pooling on the input shallow features to reduce the feature dimensionality, and then the MSA module generates multi-scale attention features based on the dimensionality-reduced input features. Finally, the features output from the max pooling layer and the MSA module are concatenated and input into the feedforward network to obtain global features.

4. The method for identifying depressive EEG signals as described in claim 1, characterized in that: In the TCLF network, the local feature extraction branch includes Dropout layer, one-dimensional convolutional layer, BN layer, ELU activation layer and max pooling layer in sequence; shallow features are processed by each layer in the local feature extraction branch to obtain local features.

5. The method for identifying depressive EEG signals as described in claim 4, characterized in that: In the TCLF network, the DAFM module includes two linear alignment layers and a fusion weight generation module. First, the global and local features are aligned using two independent linear alignment layers to obtain new global features. and new local features Then, the fusion weight generation module generates weights based on... and splicing features concat feat Generate fusion weights Finally, based on the fusion weights... and Weighted fusion is performed to obtain enhanced deep features. ; ; The fusion weight generation module includes, in sequence, a first linear layer, an LN layer, a GELU activation layer, a Dropout layer, a second linear layer, and a Sigmoid activation layer; it generates the fusion weights. The expression is: ; In the above formula, W 1. b 1 represents the weights and biases of the first linear layer, respectively; W 2. b 2 represents the weights and biases of the second linear layer, respectively; represents the Sigmoid activation function; z represents the output feature of the Dropout layer in the fusion weight generation module; Dropout (·) represents the Dropout operation; GELU represents the GELU activation function; LN(·) represents the layer normalization operation; cat[·] represents the feature concatenation operation.

6. The method for identifying depressive EEG signals as described in claim 5, characterized in that: In the training framework that introduces a domain adaptation mechanism, the classifier of the EEG recognition model includes multiple source domain classifiers and a target domain classifier; the target domain classifier includes a pseudo-label generator and a confidence filter. The model is first trained on source domain data and the classification loss is calculated using real labels to ensure that the model can accurately identify depressive features in EEG signals. Subsequently, when processing target domain data, the target domain classifier generates pseudo-labels based on the current prediction results and confidence thresholds; only when the model's prediction confidence is higher than the confidence threshold will the generated pseudo-labels be used for training; the calculation process of pseudo-labels involves probability prediction and confidence screening, and is constrained by the target domain pseudo-label loss based on cross-entropy loss. Furthermore / or, in the training framework that introduces domain adversarial mechanisms, the EEG recognition model also includes a gradient inversion layer and a domain classifier; the source domain features and target domain features extracted by the multidimensional feature extractor are first processed by the gradient inversion layer, and then the domain classifier is used to obtain the predicted score of domain affiliation; finally, the domain adversarial loss is calculated to guide the model to optimize parameters.

7. The method for recognizing depressive EEG signals as described in claim 6, characterized in that: Joint losses L total The expression is as follows: ; In the above formula, L sdt , L tdp , L dom These represent the source domain classification loss, the target domain pseudo-label loss, and the domain adversarial loss, respectively. Indicates the source domain sample at the th k Predicted values ​​on the class; Indicates the source domain sample number. k Real labels on the class; C Represents the total number of categories; Indicates the target domain. k The target domain category prediction results after the samples are filtered by a high-confidence mask; Indicates the target domain sample at the th k High-confidence pseudo-labels for this class; The representation domain discriminator predicts the source domain samples as source domain samples; The domain discriminator predicts the target domain sample as the target domain result; Represented as the domain label of the source domain sample; Domain labels representing the target domain samples; and They represent L tdp and L dom The weight.

8. A storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it creates the EEG recognition model trained in the method for recognizing depressive EEG signals as described in any one of claims 1-7, and uses it to recognize the input EEG signals.

9. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it creates the EEG recognition model trained in the method for recognizing depressive EEG signals as described in any one of claims 1-7, and uses it to recognize the input EEG signals.

10. A brainwave recognition device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it creates an EEG recognition model trained in the method for recognizing depressive EEG signals as described in any one of claims 1-7, and uses it to recognize input EEG signals.