Electroencephalogram signal depression identification method based on multi-dimensional attention fusion mechanism
The EEG signal depression identification method based on a multi-dimensional attention fusion mechanism solves the problems of complex feature engineering and limited generalization ability in existing technologies, achieving efficient and accurate EEG signal depression identification and providing visualized diagnostic support, thereby improving the accuracy and adaptability of identification.
Patent Information
- Application Number
- CN202511425463.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2025-12-30
AI Technical Summary
Existing methods for identifying depression based on EEG signals suffer from complex feature engineering, limited generalization ability, sensitivity to noise and individual differences, and recognition performance is easily limited by feature quality. Deep learning methods also lack the ability to integrate spatiotemporal features and adapt to multi-dimensional information.
A depression identification method based on EEG signals using a multi-dimensional attention fusion mechanism is adopted, including a lightweight backbone network, an EEG channel attention module, a neural spectrum activation module, and a feature depth attention module. The multi-dimensional attention fusion mechanism enhances and fuses EEG signal features in spatial, spectral, and depth dimensions step by step. Combined with the lightweight backbone network, EEG channel attention module, and neural spectrum activation module, adaptive feature extraction and enhancement of EEG signals are achieved.
It achieves efficient and accurate EEG signal recognition for depression, possesses adaptive capabilities to key brain regions, frequency bands, and depth features, provides accurate application value, and is accurately applicable to clinical diagnostic needs. It provides visualized saliency EEG channel maps and EEG time-frequency feature heatmaps, improving the accuracy and adaptability of recognition.
Smart Images

Figure CN121237382A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for identifying depression based on electroencephalogram (EEG) signals using a multi-dimensional attention fusion mechanism. Background Technology
[0002] Electroencephalogram (EEG) signal analysis is commonly used to assess brain function and thus aid in the identification of mental illnesses such as depression. Traditional EEG-based depression identification methods largely rely on machine learning algorithms, such as KNN, LR, and linear discriminant analysis. These methods typically depend on a large number of manually extracted features, resulting in complex feature engineering, limited generalization ability, sensitivity to noise and individual differences, and performance limitations imposed by feature quality, leading to low overall efficiency and accuracy. With the development of deep learning technology, neural network-based EEG depression identification methods have emerged, capable of automatically learning features from raw signals, significantly improving identification speed and accuracy. Among these methods, some employ convolutional neural networks to directly extract spatiotemporal features from EEG signals. While this achieves some feature dimensionality reduction, it neglects the frequency band specificity of EEG signals and the topological structure of brain functional networks. Other methods introduce graph neural networks or long short-term memory networks to model the functional connectivity or temporal dynamics of the brain. Although this improves spatiotemporal feature fusion, its ability to adapt to multi-dimensional information remains insufficient, resulting in high model complexity and limited generalization ability to different individuals. Summary of the Invention
[0003] The present invention aims to overcome the above-mentioned shortcomings of the prior art and provide a method for identifying depression based on EEG signals using a multi-dimensional attention fusion mechanism.
[0004] The present invention solves the technical problem by adopting the following technical solution:
[0005] A method for identifying depression based on EEG signals using a multi-dimensional attention fusion mechanism includes the following steps:
[0006] Step 1: Obtain EEG signals from multiple groups of healthy subjects and patients with depression. Preprocess the EEG signals to obtain an EEG signal dataset. Divide the EEG dataset into a training set, a validation set, and a test set according to a set ratio.
[0007] Step 2: Construct a depression recognition model based on EEG signals using a multi-dimensional attention fusion mechanism, including a lightweight backbone network, an EEG channel attention module, a neural spectrum activation module, and a feature-based deep attention module; wherein, the EEG channel attention module and the deep attention module are cascaded sequentially and integrated into the lightweight backbone network, used to progressively enhance and fuse EEG signal features in spatial, spectral, and depth dimensions, thereby forming the multi-dimensional attention fusion mechanism;
[0008] The lightweight backbone network, serving as the main network for EEG signal feature extraction, significantly reduces the number of neural network parameters by fusing deep convolution and separable convolution techniques. The EEG channel attention module uses learnable weight tensors to multiply with the input signal, outputting an enhanced feature tensor to achieve adaptive feature enhancement in the spatial dimension, solving the problem that the "spatiotemporal serial" processing paradigm struggles to integrate channel information during feature extraction. The neural spectrum activation module, located after the temporal convolutional layer of the lightweight backbone network, is responsible for explicitly embedding prior knowledge of neural oscillations closely related to depression, achieving decomposition and adaptive feature calibration of the four key frequency bands θ, α, β, and γ. Through structured multi-step processing, it completes frequency band-specific feature enhancement and channel reweighting. The feature depth attention module is responsible for adaptive recalibrating features in the depth dimension to enhance the model's ability to integrate and discriminate information across levels.
[0009] Step 3: Input the training set into the depression recognition model for training, and at the same time use the validation set to validate the model during training, so as to obtain the final EEG signal depression recognition model.
[0010] Step 4: Input the test set into the final EEG signal depression recognition model to complete the depression recognition of EEG signals of different people in the test set;
[0011] Step 1 specifically includes:
[0012] Step 1.1 Obtain EEG signals from multiple groups of healthy subjects and patients with depression;
[0013] Step 1.2 Use the MNE-Python library function mne.io.read_raw() to read the EEG data file;
[0014] Step 1.3 Use the MNE-Python library function raw.filter() to remove high-frequency noise and low-frequency drift from the EEG signal;
[0015] Step 1.4 Use the MNE-Python library function raw.notch_filter() to remove power frequency interference from the EEG acquisition device on the EEG signal;
[0016] Step 1.5 Use the MNE-Python library function mne.preprocessing.ICA() to perform independent component analysis to remove interference from other physiological signals on the EEG signal;
[0017] Step 1.6 Use the MNE-Python library function mne.Epochs() to segment continuous EEG signal data into event-related segments;
[0018] Step 1.7 uses the Python library function torch.from_numpy() to convert the segmented EEG signal data into Tensor vectors, which will be convenient for subsequent use in the EEG signal depression recognition network;
[0019] Step 1.8 Divide the preprocessed EEG signal data into training set, validation set and test set according to the set ratio;
[0020] Step 2 specifically includes:
[0021] The lightweight backbone network employs a temporal convolutional layer with a kernel size of (21, 1, 75), where 21 represents the number of kernels, and 1 and 75 represent the kernel size in the spatial and temporal dimensions, respectively. This is followed by a spatial convolutional layer with a kernel size of (7, C, 1), where C represents the number of EEG channels. This module uses the GELU activation function to improve gradient flow and expression performance. To further enhance the model's adaptability to EEG signal acquisition devices with different sampling rates, an adaptive average pooling layer is introduced, with a pooling kernel size k. pooling The dynamic calculation is shown in formula (1):
[0022]
[0023] Where f is the sampling frequency of the input EEG signal, N t This represents the number of training samples.
[0024] The magnitude of the EEG signal input to the EEG channel attention module is x∈R 1×C×T The learnable weight tensor is c∈R D×1×C Then the attention output of the EEG channel is x′∈R D×C×T As shown in formula (2);
[0025]
[0026] The output incorporates the channel-spatial features of the EEG signal and is directly input into the temporal convolutional layer in the backbone network.
[0027] The neural spectrum activation module, through structured multi-step processing, completes frequency band-specific feature enhancement and channel reweighting. The specific process is as follows:
[0028] The first step is multi-band decomposition. A set of parameterized convolutional kernels is used to decompose the input features x∈R. D×C×T Filtering is performed to extract sub-features of different frequency bands, as shown in formula (3):
[0029] X b =Conv1D(X; φ b )φ b∈{θ,α,β,γ} (3)
[0030] φ b To correspond to the convolution kernel parameters for each frequency band, the parameters can be adaptively adjusted based on the training data to fit individual differences.
[0031] The second step is frequency band energy extraction. For each frequency band feature X... b The energy characteristics are calculated by averaging across the spatial and temporal dimensions to capture the intensity distribution of the signal within the frequency band, as shown in Equation (4):
[0032]
[0033] This operation effectively suppresses noise interference while preserving physiological significance.
[0034] The third step is neural activation and weight generation. A fully connected layer with a bottleneck structure is introduced to compress and activate the frequency band energy, generating channel-level attention weights. First, the frequency band energy is globally averaged and compressed, as shown in formula (5):
[0035]
[0036] The weights are then mapped via two fully connected layers and a nonlinear activation function, as shown in Equation (6):
[0037]
[0038] in, and W2∈R C×C / 16 This forms the bottleneck structure, where δ represents the ReLU activation function, σ is the Sigmoid function, and the final output is the attention weight vector s.
[0039] The fourth step is feature recalibration. The attention weights obtained in the previous step are used to adaptively weight the original features using a band-channel approach, enhancing neural oscillation patterns related to depression and suppressing irrelevant features, as shown in formula (7):
[0040]
[0041] The feature depth attention module consists of three parts: semi-global pooling, local cross-depth interaction, and adaptive weighting, which achieves efficient feature selection and fusion while preserving electrophysiological interpretability.
[0042] Let the input features be F∈R D′×C′×T′ The module generates a deep attention map M(F)∈R through the following steps. D′×C′×T′ As shown in formula (8):
[0043]
[0044] Here, Pooling represents a semi-global pooling operation, which first performs global average pooling on the input features in the spatial dimension while preserving the integrity of the temporal dimension, achieving preliminary compression and context enhancement of deep features. Conv represents a depthwise convolution operation, which performs cross-depth interaction and transformation on the pooled features. This operation has few parameters and can effectively preserve the local structure of the features. Softmax is used to normalize the convolution result along the depth dimension, generating an attention probability distribution in the depth dimension to highlight the information-rich feature hierarchy. Finally, the normalized attention weights are combined with the original feature scale through the Hadamard product to complete the feature recalibration in the depth dimension. The output features of the feature deep attention module are directly input into the spatial convolutional layer in the backbone network.
[0045] Step 3 specifically includes:
[0046] Step 3.1: Input the EEG signals from the training set into the final EEG signal depression recognition model in batches according to the set batch size. Enhance the spatial features of the EEG signals through the channel attention module to obtain preliminary features.
[0047] Step 3.2: The initial features are sequentially passed through a temporal convolutional layer, a neural spectral activation block, a deep attention module, and a spatial convolutional layer to enhance, strengthen, and recalibrate the features in the spatial, spectral, and depth dimensions, thereby obtaining optimized high-dimensional features;
[0048] Step 3.3: Input the optimized high-dimensional feature map into a classifier consisting of a global feature pooling layer and a fully connected layer to obtain a two-dimensional vector, where the value of each dimension represents the predicted probability that the input sample belongs to the depression category or the normal category.
[0049] Step 3.4: Select binary cross-entropy as the loss function and calculate the loss function of the model on the training set; use the adaptive moment estimation optimization algorithm to minimize the loss function and iteratively train the EEG signal depression recognition model; Step 3.5: After N training cycles, use the validation set to validate the current model and calculate the loss value of the model on the validation set;
[0050] Step 3.6: During training, continuously monitor the model's performance on the validation set; when the loss value on the validation set does not decrease for M consecutive training cycles, determine that the model has converged and start the early stopping mechanism to stop training and obtain the trained EEG signal depression recognition model; otherwise, update the model network parameters obtained during training and return to step 3.1.
[0051] Step 4 specifically includes:
[0052] Step 4.1: Input the EEG signals from the test set into the final EEG signal depression recognition model in batches;
[0053] Step 4.2: The model outputs the recognition results of the input EEG signals and generates salient EEG channel feature maps and EEG time-frequency feature heatmaps corresponding to the model decisions based on class activation mapping technology, so as to identify key brain regions and EEG frequency bands related to depression recognition and provide a neurophysiological explanation for the model decisions.
[0054] The present invention has the following beneficial effects:
[0055] (1) It can accurately and efficiently identify depression by EEG signals.
[0056] (2) It integrates multi-dimensional attention mechanisms and has the ability to adaptively focus on key brain regions, frequency bands and depth features.
[0057] (3) This invention accurately assesses EEG signals and provides visualized saliency EEG channel maps and EEG time-frequency characteristic heat maps, which meet the needs of clinical diagnosis and have high practical application value. Attached Figure Description
[0058] Figure 1 This is the overall flowchart of the present invention.
[0059] Figure 2 This is a structural diagram of the identification network in this invention. Detailed Implementation
[0060] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0061] A method for identifying depression based on EEG signals using a multi-dimensional attention fusion mechanism includes the following steps:
[0062] Step 1: Obtain EEG signals from multiple groups of healthy subjects and patients with depression. Preprocess the EEG signals to obtain an EEG signal dataset. Divide the EEG dataset into a training set, a validation set, and a test set according to a set ratio.
[0063] Step 1.1 Obtain EEG signals from multiple groups of healthy subjects and patients with depression;
[0064] Step 1.2 Use the MNE-Python library function mne.io.read_raw() to read the EEG data file;
[0065] Step 1.3 Use the MNE-Python library function raw.filter() to remove high-frequency noise and low-frequency drift from the EEG signal;
[0066] Step 1.4 Use the MNE-Python library function raw.notch_filter() to perform a 50Hz notch filter to remove the power frequency interference of the EEG acquisition device on the EEG signal;
[0067] Step 1.5 Use the MNE-Python library function mne.preprocessing.ICA() to perform independent component analysis and remove physiological artifacts such as electrooculography and electromyography, and remove interference from other physiological signals on the EEG signal;
[0068] Step 1.6 Use the MNE-Python library function mne.Epochs() to segment the continuous EEG signal data into event-related segments with a fixed duration of 2 seconds;
[0069] Step 1.7 uses the Python library function torch.from_numpy() to convert the segmented EEG signal data into Tensor vectors, which will be convenient for subsequent use in the EEG signal depression recognition network;
[0070] Step 1.8 Divide the preprocessed EEG signal data into training set, validation set and test set according to an 8:1:1 ratio;
[0071] Step 2: Construct a depression recognition model based on EEG signals using a multi-dimensional attention fusion mechanism, including a lightweight backbone network, an EEG channel attention module, a neural spectrum activation module, and a feature-based deep attention module; wherein, the EEG channel attention module and the deep attention module are cascaded sequentially and integrated into the lightweight backbone network, used to progressively enhance and fuse EEG signal features in spatial, spectral, and depth dimensions, thereby forming the multi-dimensional attention fusion mechanism;
[0072] The lightweight backbone network, serving as the main network for EEG signal feature extraction, significantly reduces the number of neural network parameters by fusing deep convolution and separable convolution techniques. The EEG channel attention module uses learnable weight tensors to multiply with the input signal, outputting an enhanced feature tensor to achieve adaptive feature enhancement in the spatial dimension, solving the problem that the "spatiotemporal serial" processing paradigm struggles to integrate channel information during feature extraction. The neural spectrum activation module, located after the temporal convolutional layer of the lightweight backbone network, is responsible for explicitly embedding prior knowledge of neural oscillations closely related to depression, achieving decomposition and adaptive feature calibration of the four key frequency bands θ, α, β, and γ. Through structured multi-step processing, it completes frequency band-specific feature enhancement and channel reweighting. The feature depth attention module is responsible for adaptive recalibrating features in the depth dimension to enhance the model's ability to integrate and discriminate information across levels.
[0073] The lightweight backbone network employs a temporal convolutional layer with a kernel size of (21, 1, 75), where 21 represents the number of kernels, and 1 and 75 represent the kernel size in the spatial and temporal dimensions, respectively. This is followed by a spatial convolutional layer with a kernel size of (7, C, 1), where C represents the number of EEG channels. This module uses the GELU activation function to improve gradient flow and expression performance. To further enhance the model's adaptability to EEG signal acquisition devices with different sampling rates, an adaptive average pooling layer is introduced, with a pooling kernel size k. pooling The dynamic calculation is shown in formula (1):
[0074]
[0075] Where f is the sampling frequency of the input EEG signal, N t This represents the number of training samples.
[0076] The magnitude of the EEG signal input to the EEG channel attention module is x∈R 1×C×T The learnable weight tensor is c∈R D×1×C Then the attention output of the EEG channel is x′∈R D×C×T As shown in formula (2);
[0077]
[0078] The output incorporates the channel-spatial features of the EEG signal and is directly input into the temporal convolutional layer in the backbone network.
[0079] The neural spectrum activation module, through structured multi-step processing, completes frequency band-specific feature enhancement and channel reweighting. The specific process is as follows:
[0080] The first step is multi-band decomposition. A set of parameterized convolutional kernels is used to decompose the input features x∈R. D×C×T Filtering is performed to extract sub-features of different frequency bands, as shown in formula (3):
[0081] X b =Conv1D(X; φ b )φ b ∈{θ,α,β,γ} (3)
[0082] φ b To correspond to the convolution kernel parameters for each frequency band, the parameters can be adaptively adjusted based on the training data to fit individual differences.
[0083] The second step is frequency band energy extraction. For each frequency band feature X... b The energy characteristics are calculated by averaging across the spatial and temporal dimensions to capture the intensity distribution of the signal within the frequency band, as shown in Equation (4):
[0084]
[0085]
[0086] This operation effectively suppresses noise interference while preserving physiological significance.
[0087] The third step is neural activation and weight generation. A fully connected layer with a bottleneck structure is introduced to compress and activate the frequency band energy, generating channel-level attention weights. First, the frequency band energy is globally averaged and compressed, as shown in formula (5):
[0088]
[0089] The weights are then mapped via two fully connected layers and a nonlinear activation function, as shown in Equation (6):
[0090]
[0091] in, and W2∈R C×C / 16 This forms the bottleneck structure, where δ represents the ReLU activation function, σ is the Sigmoid function, and the final output is the attention weight vector s.
[0092] The fourth step is feature recalibration. The attention weights obtained in the previous step are used to adaptively weight the original features using a band-channel approach, enhancing neural oscillation patterns related to depression and suppressing irrelevant features, as shown in formula (7):
[0093]
[0094] The feature depth attention module consists of three parts: semi-global pooling, local cross-depth interaction, and adaptive weighting, which achieves efficient feature selection and fusion while preserving electrophysiological interpretability.
[0095] Let the input features be F∈R D′×C′×T′ The module generates a deep attention map M(F)∈R through the following steps. D′×C′×T′ As shown in formula (8):
[0096]
[0097] Here, Pooling represents a semi-global pooling operation, which first performs global average pooling on the input features in the spatial dimension while preserving the integrity of the temporal dimension, achieving preliminary compression and context enhancement of deep features. Conv represents a depthwise convolution operation, which performs cross-depth interaction and transformation on the pooled features. This operation has few parameters and can effectively preserve the local structure of the features. Softmax is used to normalize the convolution result along the depth dimension, generating an attention probability distribution in the depth dimension to highlight the information-rich feature hierarchy. Finally, the normalized attention weights are combined with the original feature scale through the Hadamard product to complete the feature recalibration in the depth dimension. The output features of the feature deep attention module are directly input into the spatial convolutional layer in the backbone network.
[0098] Step 3. Input the training set into the depression recognition model for training, and at the same time use the validation set to validate the model during training, so as to obtain the final EEG signal depression recognition model;
[0099] Step 3.1: Input the EEG signals from the training set into the final EEG signal depression recognition model in batches according to the set batch size. Enhance the spatial features of the EEG signals through the channel attention module to obtain preliminary features.
[0100] Step 3.2: The initial features are sequentially passed through a temporal convolutional layer, a neural spectral activation block, a deep attention module, and a spatial convolutional layer to enhance, strengthen, and recalibrate the features in the spatial, spectral, and depth dimensions, thereby obtaining optimized high-dimensional features;
[0101] Step 3.3: Input the optimized high-dimensional feature map into a classifier consisting of a global feature pooling layer and a fully connected layer to obtain a two-dimensional vector, where the value of each dimension represents the predicted probability that the input sample belongs to the depression category or the normal category.
[0102] Step 3.4: Select binary cross-entropy as the loss function and calculate the loss function of the model on the training set; use the adaptive moment estimation optimization algorithm to minimize the loss function and iteratively train the EEG signal depression recognition model;
[0103] Step 3.5: After N training cycles, validate the current model using the validation set and calculate the model's loss value on the validation set;
[0104] Step 3.6: During training, continuously monitor the model's performance on the validation set; when the loss value on the validation set does not decrease for M consecutive training cycles, determine that the model has converged and start the early stopping mechanism to stop training and obtain the trained EEG signal depression recognition model; otherwise, update the model network parameters obtained during training and return to step 3.1.
[0105] Step 4: Input the test set into the final EEG signal depression recognition model to complete the depression recognition of EEG signals of different people in the test set;
[0106] Step 4.1: Input the EEG signals from the test set into the final EEG signal depression recognition model in batches;
[0107] Step 4.2: The model outputs the recognition results of the input EEG signals and generates salient EEG channel feature maps and EEG time-frequency feature heatmaps corresponding to the model decisions based on class activation mapping technology, so as to identify key brain regions and EEG frequency bands related to depression recognition and provide a neurophysiological explanation for the model decisions.
[0108] This invention designs a depression recognition model based on a multi-dimensional attention fusion mechanism using EEG signals. The model consists of four modules: a lightweight backbone network, an EEG channel attention module, a neural spectrum activation module, and a feature depth attention module. The lightweight backbone network uses a deep separable convolutional structure to extract multi-scale spatiotemporal features; the EEG channel attention module enhances the signal representation ability of key electrodes through learnable tensor transformations; the neural spectrum activation module fuses prior knowledge of neural oscillations in the θ, α, β, and γ frequency bands to achieve frequency band-channel adaptive feature recombination and enhancement; context-aware calibration and fusion of cross-level features further improve feature discriminativeness. This invention can efficiently and accurately classify depressive states from multi-source EEG signals end-to-end, while generating neurophysiologically interpretable EEG channel saliency maps and time-frequency feature heatmaps. This invention requires no manual feature engineering, has good cross-device generalization ability and clinical applicability, and provides a reliable and efficient intelligent tool for the auxiliary diagnosis of depression.
Claims
1. A method for recognizing depression in electroencephalogram signals based on a multi-dimensional attention fusion mechanism, comprising the following steps: Step 1: Obtain multiple sets of electroencephalogram signals of healthy subjects and patients with depression, preprocess the electroencephalogram signals to obtain an electroencephalogram data set, and divide the electroencephalogram data set into a training set, a validation set and a test set according to a set proportion; Step 2: Construct an electroencephalogram signal depression recognition model based on a multi-dimensional attention fusion mechanism, including a lightweight skeleton network, an electroencephalogram channel attention module, a neural spectral excitation module and a feature depth attention module; wherein the electroencephalogram channel attention module and the depth attention module are cascaded in turn and integrated in the lightweight skeleton network, which is used to gradually enhance and fuse the electroencephalogram signal features in spatial, spectral and depth dimensions, thereby forming the multi-dimensional attention fusion mechanism; wherein the lightweight skeleton network serves as the backbone network for feature extraction of the electroencephalogram signals, and significantly reduces the number of neural network parameters by fusing deep convolution technology and separable convolution technology; the electroencephalogram channel attention module uses a learnable weight tensor to perform product operation with the input signal, outputs an enhanced feature tensor, realizes adaptive feature enhancement in the spatial dimension, and solves the problem that the "time-space serial" processing paradigm cannot fuse channel information in the feature extraction stage; the neural spectral excitation module is located after the time series convolution layer of the lightweight skeleton network, is responsible for explicitly embedding the neural oscillation prior knowledge closely related to depression, realizes decomposition and adaptive feature calibration of four key frequency bands θ, α, β and γ, and completes frequency band-specific feature enhancement and channel reweighting through structured multi-step processing; the feature depth attention module is responsible for adaptive recalibration of the features in the depth dimension to enhance the model's integration and discrimination ability of cross-level information; Step 3. Input the training set into the depression recognition model for training, and use the validation set to verify the model during training to obtain the final electroencephalogram signal depression recognition model; Step 4: Input the test set into the final electroencephalogram signal depression recognition model to complete the depression recognition of the electroencephalogram signals of different persons in the test set.
2. The electroencephalogram signal depression recognition method based on multi-dimensional attention fusion mechanism according to claim 1, wherein Step 1 specifically comprises: Step 1.1 Obtain multiple sets of electroencephalogram signals of healthy subjects and patients with depression; Step 1.2 Read the electroencephalogram data file using the MNE-Python library function mne.io.read_raw() function; Step 1.3 Remove high-frequency noise and low-frequency drift in the electroencephalogram signal using the MNE-Python library function raw.filter() function; Step 1.4 Remove power frequency interference of the electroencephalogram signal caused by the electroencephalogram acquisition device using the MNE-Python library function raw.notch_filter() function; Step 1.5 Perform independent component analysis using the MNE-Python library function mne.preprocessing.ICA() function to remove interference of other physiological signals on the electroencephalogram signal; Step 1.6 Use the MNE-Python library function mne.Epochs() to segment continuous EEG signal data into event-related segments; Step 1.7 uses the Python library function torch.from_numpy() to convert the segmented EEG signal data into Tensor vectors, which will be convenient for subsequent use in the EEG signal depression recognition network; Step 1.8 Divide the preprocessed EEG signal data into training set, validation set and test set according to the set ratio.
3. The electroencephalogram signal depression recognition method based on multi-dimensional attention fusion mechanism according to claim 1, characterized in that, The lightweight skeleton network described in step 2 adopts a time convolution layer with a convolution kernel set to (21, 1, 75), where 21 is the number of convolution kernels, and 1 and 75 represent the kernel size of the spatial dimension and the time dimension respectively; then a spatial convolution layer is adopted with a convolution kernel set to (7, C, 1), where C is the number of electroencephalogram channels; the module adopts a GELU activation function to improve gradient flow and expression performance; to further enhance the adaptability of the model to different sampling rate electroencephalogram signal acquisition devices, an adaptive average pooling layer is introduced with a pooling kernel size k pooling The dynamic calculation is shown in formula (1): Wherein, f is the sampling frequency of the input brain electrical signal, , N t is the number of training samples; The input electroencephalogram signal size of the electroencephalogram channel attention module is x ∈ R 1×C×T The learnable weight tensor is c ∈ R D×1×C The electroencephalogram channel attention output is x' ∈ R D×C×T As shown in formula (2); The output incorporates the channel-spatial features of the EEG signal and is directly input into the temporal convolutional layer in the backbone network; The neural spectrum activation module, through structured multi-step processing, completes frequency band-specific feature enhancement and channel reweighting. The specific process is as follows: First, multi-band decomposition; use a set of parameterized convolution kernels on the input feature x ∈ R D×C×T Filtering is performed to extract sub-features of different frequency bands, as shown in equation (3): X b = Conv1D(X; φ b )φ b ∈ {θ, α, β, γ} (3) φ b The convolution kernel parameters corresponding to each frequency band can be adaptively adjusted according to the training data to fit individual differences. Second step, band energy extraction; for each band feature X b The energy feature is calculated by averaging in spatial and temporal dimensions to capture the intensity distribution of the signal within the band, as shown in equation (4): This operation effectively suppresses noise interference while preserving physiological significance; The third step is neural activation and weight generation; a fully connected layer with a bottleneck structure is introduced to compress and activate the frequency band energy, generating channel-level attention weights; first, the frequency band energy is globally averaged and compressed, as shown in formula (5): The weights are then mapped via two fully connected layers and a nonlinear activation function, as shown in Equation (6): wherein, and W2∈R C×C / 16 forms a bottleneck structure, δ represents a ReLU activation function, σ is a Sigmoid function, and the final output is an attention weight vector s; The fourth step is feature recalibration; the attention weights obtained in the previous step are used to adaptively weight the original features by frequency band and channel to enhance the neural oscillation patterns related to depression and suppress irrelevant features, as shown in formula (7): The feature depth attention module consists of three parts: semi-global pooling, local cross-depth interaction, and adaptive weighting, which achieves efficient feature selection and fusion while preserving electrophysiological interpretability. Let the input feature be F ∈ R D′×C′×T′ The module generates a deep attention map M(F) ∈ R D′×C′×T′ As shown in equation (8): Here, Pooling represents a semi-global pooling operation, which first performs global average pooling on the input features in the spatial dimension while preserving the integrity of the temporal dimension, achieving preliminary compression and context enhancement of deep features; Conv represents a deep convolution operation, which performs cross-depth interaction and transformation on the pooled features. This operation has few parameters and can effectively preserve the local structure of the features; Softmax is used to normalize the convolution result along the depth dimension, generating an attention probability distribution in the depth dimension to highlight the information-rich feature hierarchy; finally, the normalized attention weights are combined with the original feature scale through the Hadamard product to complete the feature recalibration in the depth dimension; the output features of the feature deep attention module are directly input into the spatial convolutional layer in the skeleton network.
4. The electroencephalogram signal depression recognition model based on a multi-dimensional attention fusion mechanism according to claim 1, wherein Step 3 includes: Step 3.1: Input the EEG signals from the training set into the final EEG signal depression recognition model in batches according to the set batch size. Enhance the spatial features of the EEG signals through the channel attention module to obtain preliminary features. Step 3.2: The initial features are sequentially passed through a temporal convolutional layer, a neural spectral activation block, a deep attention module, and a spatial convolutional layer to enhance, strengthen, and recalibrate the features in the spatial, spectral, and depth dimensions, thereby obtaining optimized high-dimensional features; Step 3.3: The optimized high-dimensional feature map is input into a classifier composed of a global feature pooling layer and a fully connected layer to obtain a two-dimensional vector, wherein each dimension represents the prediction probability of the input sample belonging to the depression category or the normal category; Step 3.4: Binary cross-entropy is selected as the loss function, and the loss function of the model on the training set is calculated; the adaptive moment estimation optimization algorithm is used to minimize the loss function, and the electroencephalogram depression recognition model is iteratively trained; Step 3.5: After N training cycles, the current model is verified using the validation set, and the loss value of the model on the validation set is calculated; Step 3.6: During the training process, the effect of the model on the validation set is continuously monitored; when the loss value of the validation set does not decrease for M consecutive training cycles, it is determined that the model has converged and the early stopping mechanism is started, the training is stopped, and the trained electroencephalogram depression recognition model is obtained; otherwise, the model network parameters obtained during the training process are updated and the process returns to step 3.
1.
5. The electroencephalogram signal depression recognition method based on multi-dimensional attention fusion mechanism according to claim 1, characterized in that, The step 4 comprises: Step 4.1: The electroencephalogram signals in the test set are input into the final electroencephalogram depression recognition model in batches; Step 4.2: The model outputs the recognition result of the input electroencephalogram signal, and generates a significant electroencephalogram channel feature map and an electroencephalogram time-frequency feature heat map corresponding to the model decision based on the class activation mapping technology, to identify the key brain regions and electroencephalogram frequency bands related to depression recognition, and provide neurophysiological explanation for the model decision.
Citation Information
Cited By
Depression recognition system based on electroencephalogram signals
CN121489484A