Teenager depression detection system based on multi-task electroencephalogram biological signals
By integrating multi-task EEG signals and improving the Transformer model, this method addresses the shortcomings of existing depression detection methods, achieving efficient and accurate detection of depression in adolescents, providing objective diagnostic evidence, applicable to adolescents, and reducing the risk of misdiagnosis and missed diagnosis.
Patent Information
- Application Number
- CN202510890446.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-11-21
AI Technical Summary
现有的抑郁症检测方法缺乏客观生物标志物,单一任务数据信息不全面,计算复杂度高且存在过拟合风险,难以有效整合多任务脑电图信号。
A multi-task EEG biosignal detection system is adopted, which integrates EEG signals from open-eye resting task, closed-eye resting task, attention task and non-attention task. Combined with EEG biosignal learning module and improved Transformer model, the system achieves efficient detection of adolescent depression through data preprocessing, feature extraction, feature fusion and depression classification.
It improves the accuracy and reliability of depression detection, provides objective diagnostic evidence, enables early detection of potential depression patients, reduces the risk of misdiagnosis and missed diagnosis, is suitable for adolescents, and has high safety and convenience.
Smart Images

Figure CN120983036A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of deep learning and biomedicine, and in particular to a system for detecting adolescent depression based on multi-task electroencephalogram (EEG) biosignals. Background Technology
[0002] Depression is a common mental disorder that greatly disrupts the daily lives of sufferers. Adolescents, as an important part of society, face pressure from academics, family, and social life, and the incidence of depression among them is constantly rising. Early diagnosis and timely intervention are crucial to mitigating the impact of depression. However, current diagnostic methods largely rely on patients' subjective descriptions and clinicians' experience, lacking objective biomarkers. This can lead to misdiagnosis and missed diagnosis, and may also delay treatment.
[0003] In recent years, electroencephalography (EEG), as a neurophysiological indicator that can directly reflect brain activity, has gradually become a hot topic in depression detection research due to its advantages such as being non-invasive, real-time, and low-cost. EEG signals can capture changes in the brain's electrical activity under different cognitive and emotional states, thus providing a possibility for the objective diagnosis of depression. Currently, EEG signal acquisition methods are mainly divided into invasive and non-invasive methods, with non-invasive methods being widely used in research due to their higher safety and convenience.
[0004] Although research on depression based on electroencephalogram (EEG) signals has made some progress, existing methods mostly focus on single-task EEG data, such as resting-state or attentional tasks, lacking the fusion and utilization of multi-task data. EEG signals from different tasks can reflect the brain's activity characteristics under different states, and the fusion of multi-task data can provide more comprehensive physiological information, helping to improve the accuracy and reliability of depression detection.
[0005] Furthermore, traditional methods for detecting depression often face problems of excessive computational complexity and overfitting when processing complex EEG signals. While deep learning technology excels in feature extraction and pattern recognition, it still has limitations when processing long sequences of EEG signals. Therefore, effectively integrating multi-task EEG signals and leveraging advanced machine learning algorithms to overcome the shortcomings of existing technologies has become a key challenge in current research on depression detection. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing methods for detecting depression, such as the lack of objective biomarkers, incomplete information due to single-task data, excessive computational complexity, and the risk of overfitting. This invention provides a multi-task EEG biosignal-based system for detecting adolescent depression. By integrating multi-task EEG signals from open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks, and combining this with an EEG biosignal learning module and an improved Transformer model, this system achieves efficient detection of adolescent depression, providing objective and accurate evidence for clinical diagnosis and intervention.
[0007] To achieve the above objectives, the technical solution provided by this invention is: a adolescent depression detection system based on multi-task EEG biosignals, comprising:
[0008] The EEG data acquisition module guides users to conduct experiments according to the designed experimental paradigms of open-eye resting task, closed-eye resting task, attention task and non-attention task, and uses EEG equipment to collect and read the user's EEG data.
[0009] The data preprocessing module is used to perform preprocessing operations on the EEG data read by the EEG data acquisition module, including signal filtering, artifact removal, signal rereference, and data normalization.
[0010] The feature extraction module utilizes the EEG biosignal learning module and an improved Transformer model to extract features from preprocessed EEG data, obtaining features related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks. The EEG biosignal learning module processes and analyzes the EEG data, including a biosignal segmentation module, Fast Fourier Transform (FFT), segment embedding, channel embedding, and positional encoding. The biosignal segmentation module divides the EEG data into multiple segments. The FFT transforms these segments from a time dimension to a frequency dimension for better analysis of patterns and features. Segment embedding and channel embedding encode segments and channels respectively to better represent their features and information. Positional encoding preserves the temporal order of the data. The improved Transformer model integrates the information output by the EEG biosignal learning module, analyzing the EEG data from multiple perspectives and extracting features helpful for depression detection. This improved Transformer model introduces surrogate vectors, each responsible for aggregating and transmitting information within a local region.
[0011] The feature fusion module is used to fuse features related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks to construct a feature representation that can comprehensively reflect the state of depression.
[0012] The depression classification module uses a classifier to classify features from the feature fusion module that are related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks, and obtains depression detection results.
[0013] Furthermore, the EEG data acquisition module includes a task experiment paradigm module and a data loading module, wherein:
[0014] The task experiment paradigm module utilizes visual and auditory guidance to help users enter different task states according to the instructions on the computer screen. During this process, EEG data is collected, amplified, and filtered using an EEG acquisition device before being read. The specific experimental procedures for the open-eye resting task, closed-eye resting task, attention task, and non-attention task are as follows:
[0015] Note the task: Participants perform mental arithmetic subtraction, that is, continuously subtract a fixed number in their minds until they hear a stop signal; this task requires participants to concentrate on continuous calculation operations, which can effectively activate brain regions related to attention.
[0016] Non-attentional task: Participants engage in a period of restful imagination without specific stimuli. During this process, participants are free to think or recall without needing to focus their attention on a specific task or goal, thus reflecting the characteristics of the subject's brain electrical activity in a natural state.
[0017] Eyes-open resting task: Participants remain quiet with their eyes open, able to focus on a fixed point or observe their surroundings naturally, without engaging in any specific activities or thinking. This state helps to observe the basic EEG activity of the subjects in the eyes-open state.
[0018] Eyes-closed resting task: Participants close their eyes and rest, relax their body and brain, and minimize the impact of external visual stimuli on the brain, so as to obtain the resting EEG activity characteristics of the subjects in the eyes-closed state.
[0019] Between each task, the system will provide participants with appropriate rest time to avoid fatigue and interference between tasks;
[0020] The data loading module is used to read EEG data from the local machine, including MAT and CNT formats, and to receive EEG data transmitted online from the task experiment paradigm module.
[0021] Furthermore, the data preprocessing module is used to preprocess the EEG data read by the EEG data acquisition module: First, signal filtering is performed using a second-order Butterworth filter with a filtering range of 0.5 to 50 Hz to remove high-frequency noise and low-frequency drift interference; second, Daubechies wavelet transform with a decomposition scale of 3 is used, and FastICA algorithm independent component analysis is used for artifact removal to effectively remove interference signals such as eye movement artifacts and electromyography artifacts; then, signal rereference is performed using the average reference method, taking the average value of the signals from all channels as the new reference point to reduce the influence of the reference electrodes on the signal; finally, data normalization is performed using Z-score normalization to unify the data from different channels to the same dimension, thereby improving the accuracy and comparability of subsequent analysis.
[0022] Furthermore, the specific details of the biosignal segmentation module, Fast Fourier Transform, segment embedding, channel embedding, and positional encoding are as follows:
[0023] The biosignal segmentation module divides the record of each channel into tokens with a duration of t seconds. Adjacent tokens overlap for p seconds to ensure data continuity and preserve the temporal information in the EEG data. The k-th token of the i'-th channel is represented as: S[i',(tp)(k-1):(tp)(k-1)+t]. The number of tokens in each channel is limited by the total signal duration J, i.e., (tp)(k-1)+t≤J, where J is the length of the EEG biosignal, and p is crucial for preserving the temporal information of the EEG biosignal.
[0024] The Fast Fourier Transform (FFT) is a method for converting time-domain signals to the frequency domain. Performing an FFT on each token yields its amplitude and phase information at each frequency component, as shown in the formula:
[0025]
[0026] In the formula: f represents frequency, in Hertz; n represents discrete time index, ranging from 0, 1, 2, ..., N-1; X(f) represents the amplitude of the signal at frequency f; x(n) represents the amplitude of the signal at time point n; N represents the number of sampling points of the signal; i is the imaginary unit; e is the base of the natural logarithm; π is pi. The Fast Fourier Transform (FFT) can obtain the amplitude and phase information of EEG data segments at different frequency components, transforming the time dimension to the frequency dimension, allowing observation of the energy distribution of the signal at different frequencies.
[0027] The purpose of the segment embedding is to extract the energy characteristics of each token in different frequency bands from a spectral perspective and transform them into an energy vector. The frequency bands include delta waves, theta waves, alpha waves, beta waves, and gamma waves. The formula for calculating the energy in each frequency band is as follows:
[0028]
[0029] In the formula: E b F represents the energy within the b-th frequency band; b This represents the frequency range corresponding to the b-th frequency band; PSD(f) represents the power spectral density at frequency f.
[0030] Then, a fully connected network with 5 neurons in the input layer, 128 neurons in the hidden layer, and 64 neurons in the output layer is used to process the energy vector and generate segment embeddings. This process can highly summarize the features of EEG data segments in the frequency domain and form a feature vector that can represent the EEG data segment, which is convenient for subsequent analysis and processing.
[0031] The channel embedding involves learning a shared embedding table for all channels, with each channel corresponding to a 64-dimensional embedding vector. These vectors are optimized during model training to capture the features of each channel. When processing the signal of each channel, the corresponding channel embedding vector is added to the token representation of the signal. In this way, each token not only contains its own time and frequency features, but also information about the channel to which it belongs.
[0032] The positional encoding encodes the sequence information of segments within a channel into the final token embedding, enabling the model to perceive the temporal order of the data. The sine and cosine functions are used to encode the sequence information of segments within a channel into the final token embedding, forming a final token embedding containing spatiotemporal information. The positional encoding formula is as follows:
[0033]
[0034] In the formula: pos represents the position of the token; m represents the index of the embedding dimension; d represents the embedding dimension; PE (pos,m) This represents the position code of dimension m at position pos; PE (pos,2m+1) The position code at position pos is represented by dimension m+1. The position information is transformed into a numerical form that the model can process through sine and cosine functions, and then incorporated into the final token embedding. In this way, the model can make full use of temporal sequence information when processing data, thereby improving the understanding and analysis of EEG data.
[0035] Ultimately, the EEG biosignals are tokenized into sentences, represented as Sen∈R N×l In the formula N 'The number of tokens is represented by l, which is the number of segments generated after processing by the biosignal segmentation module; l represents the dimension of the token embedding, which is the length of the vector converted into each segment; and R represents the real number field. This matrix Sen contains the embedding vectors of all tokens, and each vector integrates the time-frequency features and location information of the segment for subsequent feature extraction and analysis.
[0036] Furthermore, the improved Transformer model introduces a proxy attention mechanism to reduce computational complexity and improve processing efficiency. The attention mechanism in the improved Transformer model is used to process the final token embedding and extract features from the multi-channel EEG signal. The process formula is as follows:
[0037] OA = Attn S (Q,A,Attn S (A,K,V))
[0038] In the formula: OA represents the output of the attention mechanism in the improved Transformer model; Q, K, and V represent the query, key, and value matrices, respectively; A represents the auxiliary matrix used for broadcasting and aggregation operations in the attention mechanism; Attn S (A,K,V) represents the softmax attention mechanism. In the above process, the query matrix Q represents the focus on other information, the key matrix K represents the features of the information, and the value matrix V represents the actual information content. By calculating the matching degree between the query and the key, and by weighted summing of the values, the model can automatically learn which information is more important, and thus extract more valuable EEG features. The improved Transformer model optimizes the above process by introducing surrogate vectors. A surrogate vector set P = {p1, p2, ..., p...} is introduced. v'}, each agent vector p v' This function is responsible for aggregating local region information. Here, it generates a proxy vector from the input sequence through a linear transformation. The calculation formula is as follows:
[0039] P = W P X l
[0040] In the formula: X l It is the input EEG feature matrix, with dimension N. l ×D l N l D is the sequence length. l W is the feature dimension. P It is a learnable linear transformation matrix with dimension M. l ×N l M lGiven the number of surrogate vectors, this linear transformation allows the model to map from the EEG feature space to the surrogate vector space, enabling each surrogate vector to focus on specific feature combinations and local region information; each surrogate vector p v' Local region information is obtained by weighting the input sequence and summing the weights, where α is the weight. g,u Calculated using the following formula:
[0041]
[0042] In the formula: It is the nth digit of the input sequence. l A marker, here k l This is a loop variable used to iterate through each marker in the input sequence; by calculating the similarity or correlation between the surrogate vector and each marker, the model can determine which markers contribute more to the local region of interest of the current surrogate vector. After obtaining the weights, the surrogate vector is updated as follows:
[0043]
[0044] This process enables each surrogate vector to focus on different local regions of the input sequence, effectively reducing the computational cost of attention. Each surrogate vector combines the feature vectors in the original input sequence through a weighted summation. Feature vectors with higher weights contribute more to the surrogate vector, thus enabling the surrogate vector to highlight the key features of the local region while suppressing the influence of irrelevant or noisy information.
[0045] Furthermore, the feature fusion module concatenates or weights the features from the open-eye resting task, closed-eye resting task, attention task, and non-attention task to form a comprehensive feature vector, which fully reflects the subject's EEG activity state. During feature fusion, to determine the weights of different task features, a weighted fusion strategy based on task importance is adopted: First, cross-validation is performed on the training set to calculate the contribution of each task feature to the depression classification; then, weights are assigned to each task feature according to its contribution, with higher-contribution features having larger weights; finally, the different task features are weighted and summed according to their weights to obtain the comprehensive feature vector. This weighted fusion strategy can fully utilize the information from different task features, improve the representational ability of the comprehensive feature vector, and thus enhance the accuracy of depression detection.
[0046] Furthermore, the depression classification module uses a classifier to classify the features fused by the feature fusion module after integrating open-eye resting task, closed-eye resting task, attention task, and non-attention task. The classifiers include support vector machines, random forests, decision trees, K-nearest neighbors, and Bayesian classifiers. Each classifier has its unique algorithm and applicable scenarios.
[0047] The support vector machine (SVM) divides data into two classes by finding a hyperplane, and is suitable for both linearly separable and nonlinear data. When using the SVM, a kernel function mapping method is used to map nonlinearly separable data to a high-dimensional space, making it linearly separable in the high-dimensional space.
[0048] Random forest is an ensemble learning method that improves classification accuracy and stability by constructing multiple decision trees and combining their results. The following steps are used for random forest: First, determine the number of decision trees by experimenting to find the optimal number to balance classification performance and computational complexity; second, determine the depth of each decision tree by pruning to prevent overfitting; finally, use feature selection to choose the features that contribute most to the classification of depression as the splitting features for each decision tree.
[0049] The decision tree makes classification decisions through a series of branch nodes, which is easy to understand and interpret. In the decision tree, the Gini index is used as the selection criterion for split features. At each split node, the Gini index of each feature is calculated, and the feature with the smallest Gini index is selected as the split feature.
[0050] The K-nearest neighbors classification is based on the category of the nearest neighbor in the training data, which is suitable for densely distributed data. For K-nearest neighbors, the following optimization measures are adopted: First, determine an appropriate number of neighbors K and select the optimal K value through cross-validation; Second, use a distance-weighted method to give greater weight to neighbors closer to the test sample, thereby improving the rationality of the classification decision.
[0051] The Bayesian classifier is based on Bayes' theorem and is suitable for processing data with probabilistic characteristics, making full use of prior knowledge. The Bayesian classifier uses the following method: First, it estimates the prior probability based on the proportion of different class samples in the training data; second, it estimates the conditional probability using maximum likelihood estimation; finally, it calculates the posterior probability based on Bayes' theorem and selects the class with the highest posterior probability as the classification result.
[0052] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0053] This invention innovatively integrates multi-task EEG signals from open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks. Compared to existing technologies that rely solely on single-task data, this fusion approach can more comprehensively capture the brain's physiological information under different cognitive and emotional states. By fusing multi-task data, this invention provides a richer and more comprehensive feature base, thereby significantly improving the reliability and accuracy of depression detection results. The EEG signals from different tasks reflect the brain's activity characteristics under different states; this multi-dimensional information helps to more accurately identify physiological markers of depression.
[0054] This invention employs an improved Transformer model combined with an EEG biosignal learning module, effectively addressing the problems of excessive computational complexity and overfitting in traditional methods when processing long-sequence EEG signals. The improved Transformer model, through its powerful self-attention mechanism, can better capture long-range dependencies in EEG data, improving the efficiency and accuracy of feature extraction. The EEG biosignal learning module includes key steps such as biosignal segmentation, fast Fourier transform, segment embedding, channel embedding, and positional encoding. These steps work together to transform EEG biosignals into feature representations containing spatiotemporal information, providing a novel and effective feature extraction approach for depression detection, further improving the accuracy and interpretability of the detection results.
[0055] This invention is specifically designed for the detection of depression in adolescents, fully considering the impact of academic, family, and social pressures on the onset of depression. As a vital part of society, the incidence of depression among adolescents is constantly rising, making early diagnosis and timely intervention crucial for mitigating its impact. This invention can provide clinicians with objective and accurate diagnostic evidence, assisting in the development of personalized treatment plans, and has significant clinical value and social significance.
[0056] This invention is applicable to adolescents, providing a specialized detection method for this high-incidence and often overlooked group of depression. Through multi-task data fusion and an efficient feature extraction learning mechanism, potential depression patients can be identified in a timely manner, enabling early intervention and treatment. Furthermore, this invention employs a non-invasive EEG data acquisition method, offering high safety and convenience, making it easily acceptable to patients, while reducing medical costs and risks, further broadening its applicability and demonstrating broad application prospects and social value.
[0057] This invention combines deep learning technology with biomedical engineering technology, bringing new technological breakthroughs and development directions to the field of depression detection. This technological integration and innovation not only improves the accuracy and reliability of depression detection but also promotes the continuous progress and improvement of related technologies, providing new ideas and methods for future research and application of depression detection technology. Attached Figure Description
[0058] Figure 1 This is a schematic diagram showing the relationship between the various modules of the system of the present invention.
[0059] Figure 2 This is a schematic diagram of a 32-channel electrode used to acquire brainwave signals in an EEG data acquisition module.
[0060] Figure 3 This is a schematic diagram of the attention experiment paradigm designed for the system of this invention.
[0061] Figure 4 This is an architectural diagram of the EEG biosignal learning module and the improved Transformer model of the present invention. Detailed Implementation
[0062] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.
[0063] like Figure 2 As shown in the embodiments of the present invention, the EEG acquisition device used covers multiple regions of electrodes, including frontal channels FP1, FP2, F7, F3, FZ, F4, and F8; temporal channels FT7 and FT8; central channels FC3, FCZ, and FC4; parietal channels T3, C3, CZ, C4, and T4; occipital channels O1, OZ, and O2; and reference electrode channels A1 and A2. Based on the international 10-20 system layout, it can comprehensively monitor brain electrical activity, providing rich physiological information for depression detection. The frontal region reflects attention and emotion regulation functions, the central region is associated with motor and sensory functions, the parietal and occipital regions are involved in spatial attention and visual processing, respectively, and the temporal region is involved in auditory and memory functions. These channels can comprehensively monitor the electrical activity of various brain regions, providing rich physiological information for depression detection. Specifically, the frontal region reflects attention and emotion regulation functions, the central region is associated with motor and sensory functions, the parietal and occipital regions are involved in spatial attention and visual processing, respectively, and the temporal region is involved in auditory and memory functions.
[0064] This embodiment discloses a multi-task EEG biosignal-based adolescent depression detection system. This system integrates EEG signals from open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks, and utilizes an EEG biosignal learning module and an improved Transformer model to achieve efficient detection of adolescent depression. The relationships between the system modules are as follows: Figure 1 As shown, it specifically includes the following functional modules:
[0065] The EEG data acquisition module guides users to conduct experiments according to the designed experimental paradigms of open-eye resting task, closed-eye resting task, attention task and non-attention task, and uses EEG equipment to collect and read the user's EEG data.
[0066] The data preprocessing module is used to perform preprocessing operations on the EEG data read by the EEG data acquisition module, including signal filtering, artifact removal, signal rereference, and data normalization.
[0067] The feature extraction module utilizes the EEG biosignal learning module and an improved Transformer model to extract features from preprocessed EEG data, obtaining features related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks. The EEG biosignal learning module processes and analyzes the EEG data, including a biosignal segmentation module, Fast Fourier Transform (FFT), segment embedding, channel embedding, and positional encoding. The biosignal segmentation module divides the EEG data into multiple segments. The FFT transforms these segments from a time dimension to a frequency dimension for better analysis of patterns and features. Segment embedding and channel embedding encode segments and channels respectively to better represent their features and information. Positional encoding preserves the temporal order information of the data. The improved Transformer model integrates the information output by the EEG biosignal learning module, analyzing the EEG data from multiple perspectives and extracting features helpful for depression detection. This improved Transformer model reduces the computational load for attention tasks by introducing surrogate vectors, each responsible for aggregating and transmitting information within a local region.
[0068] The feature fusion module is used to fuse features related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks to construct a feature representation that can comprehensively reflect the state of depression.
[0069] The depression classification module uses a classifier to classify features from the feature fusion module that are related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks, and obtains depression detection results.
[0070] Specifically, the EEG data acquisition module includes a task experiment paradigm module and a data loading module, wherein:
[0071] The task experiment paradigm module utilizes visual and auditory guidance to help users enter different task states according to on-screen instructions. During this process, EEG data is collected, amplified, and filtered using an EEG acquisition device before being read. The experimental design of this invention aims to comprehensively evaluate the EEG activity of adolescents by capturing changes in brain electrical activity under different cognitive and emotional states through data acquisition in open-eye resting tasks, closed-eye resting tasks, attentional tasks, and non-attentional tasks. The experimental design module's evoked paradigm is as follows: Figure 3 As shown, the task status includes the following four states:
[0072] Eyes-open resting task: Participants remain silent with their eyes open, focusing on a fixed point or naturally observing their surroundings without engaging in any specific activity or thought. This state helps to observe the subject's basic EEG activity while eyes-open.
[0073] Closed-eyes resting task: Participants close their eyes and rest, relax their bodies and brains, and minimize the impact of external visual stimuli on the brain, so as to obtain the resting brain electrical activity characteristics of the subjects in the closed-eyes state.
[0074] Attention Task: Participants perform mental arithmetic subtraction, such as mentally subtracting a fixed number, like 7, starting with a larger number, like 1000, subtracting 7 each time, until they hear a stop signal. This task requires participants to concentrate on continuous calculations, effectively activating brain regions associated with attention.
[0075] Non-attentional task: Participants engage in a period of restful imagination without specific stimuli. During this process, participants are free to engage in internal thinking or recall without needing to focus their attention on a specific task or goal, thereby reflecting the characteristics of the subject's brain electrical activity in a natural state.
[0076] Between each task, the system will provide participants with appropriate rest time to avoid fatigue and interference between tasks.
[0077] The experiment recruited 100 middle school students, including 50 patients with depression and 50 healthy controls. A 32-channel EEG acquisition device was used with a sampling rate of 250Hz. The experimental paradigm module guided users to enter different task states according to on-screen prompts through visual and auditory means, while the EEG acquisition device amplified and filtered the signals.
[0078] The data loading module is used to read EEG data from the local machine, including MAT and CNT formats, and to receive EEG data transmitted online from the task experiment paradigm module.
[0079] Specifically, the data preprocessing module takes the following steps:
[0080] 1. Signal filtering and cleaning: The raw EEG signal is processed by a second-order Butterworth filter from 0.5 to 50 Hz to fill missing values, and a 50 Hz notch filter is used to remove power frequency noise.
[0081] 2. Signal rereference: The filtered EEG signal is rereferenced to the average reference to reduce the influence of the reference electrode.
[0082] 3. Data normalization: The Z-score normalization method is used to process the preprocessed EEG data to eliminate the dimensional differences between channels.
[0083] These preprocessing steps significantly improved the quality of EEG data, laying a solid foundation for subsequent analysis and applications.
[0084] Specifically, such as Figure 4 As shown, the specific details of the biosignal segmentation module, Fast Fourier Transform, segment embedding, channel embedding, and positional encoding are as follows:
[0085] The biosignal segmentation module divides the record of each channel into tokens with a duration of t seconds. Adjacent tokens overlap for p seconds to ensure data continuity and preserve the temporal information in the EEG data. The k-th token of the i'-th channel is represented as: S[i',(tp)(k-1):(tp)(k-1)+t]. The number of tokens in each channel is limited by the total signal duration J, i.e., (tp)(k-1)+t≤J, where J is the length of the EEG biosignal, and p is crucial for preserving the temporal information of the EEG biosignal.
[0086] The Fast Fourier Transform (FFT) is a method for converting time-domain signals to the frequency domain. Performing an FFT on each token yields its amplitude and phase information at each frequency component, as shown in the formula:
[0087]
[0088] In the formula: f represents frequency, in Hertz; n represents discrete time index, ranging from 0, 1, 2, ..., N-1; X(f) represents the amplitude of the signal at frequency f; x(n) represents the amplitude of the signal at time point n; N represents the number of sampling points of the signal; i is the imaginary unit; e is the base of the natural logarithm; π is pi. The Fast Fourier Transform (FFT) can obtain the amplitude and phase information of EEG data segments at different frequency components, transforming the time dimension to the frequency dimension, allowing observation of the energy distribution of the signal at different frequencies.
[0089] The purpose of the segment embedding is to extract the energy characteristics of each token in different frequency bands from a spectral perspective and transform them into an energy vector. The frequency bands include delta waves, theta waves, alpha waves, beta waves, and gamma waves. The formula for calculating the energy in each frequency band is as follows:
[0090]
[0091] In the formula: E b F represents the energy within the b-th frequency band; b This represents the frequency range corresponding to the b-th frequency band; PSD(f) represents the power spectral density at frequency f.
[0092] Then, a fully connected network with 5 neurons in the input layer, 128 neurons in the hidden layer, and 64 neurons in the output layer is used to process the energy vector and generate segment embeddings. This process can highly summarize the features of EEG data segments in the frequency domain and form a feature vector that can represent the EEG data segment, which is convenient for subsequent analysis and processing.
[0093] The channel embedding involves learning a shared embedding table for all channels, with each channel corresponding to an embedding vector. These vectors are optimized during model training to capture the features of each channel. When processing the signal of each channel, the corresponding channel embedding vector is added to the token representation of the signal. In this way, each token not only contains its own time and frequency features, but also the information of the channel to which it belongs.
[0094] The positional encoding encodes the sequence information of segments within a channel into the final token embedding, enabling the model to perceive the temporal order of the data. The sine and cosine functions are used to encode the sequence information of segments within a channel into the final token embedding, forming a final token embedding containing spatiotemporal information. The positional encoding formula is as follows:
[0095]
[0096] In the formula: pos represents the position of the token; m represents the index of the embedding dimension; d represents the embedding dimension; PE (pos,m) This represents the position code of dimension m at position pos; PE (pos,2m+1) The position code at position pos represents the position encoding of dimension m+1. The position information is transformed into a numerical form that the model can process through sine and cosine functions, and then incorporated into the final token embedding. In this way, the model can make full use of temporal sequence information when processing data, thereby improving its ability to understand and analyze EEG data.
[0097] Ultimately, the EEG biosignals are tokenized into sentences, represented as Sen∈R N'×lIn the formula, N' represents the number of tokens, i.e., the number of segments generated after processing by the biosignal segmentation module; l represents the dimension of the token embedding, i.e., the length of the vector converted into each segment; and R represents the real number field. This matrix Sen contains the embedding vectors of all tokens, and each vector integrates the time-frequency features and location information of the segment for subsequent feature extraction and analysis. Through this tokenization process, complex EEG biosignals can be transformed into a structured data form, enabling subsequent feature extraction and analysis modules to process this data more efficiently and providing a more accurate feature representation for depression detection.
[0098] Specifically, such as Figure 4 As shown, the improved Transformer model reduces computational complexity and improves processing efficiency by introducing a proxy attention mechanism. The attention mechanism in the improved Transformer model is used to process the final token embedding and extract features from the multi-channel EEG signal. The process formula is as follows:
[0099] OA = Attn S (Q,A,Attn S (A,K,V))
[0100] In the formula: OA represents the output of the attention mechanism in the improved Transformer model; Q, K, and V represent the query, key, and value matrices, respectively; A represents the auxiliary matrix used for broadcasting and aggregation operations in the attention mechanism; Attn S (A,K,V) represents the softmax attention mechanism. In the above process, the query matrix Q represents the focus on other information, the key matrix K represents the features of the information, and the value matrix V represents the actual information content. By calculating the matching degree between the query and the key, and performing a weighted summation of the values, the model can automatically learn which information is more important, and thus extract more valuable features. The improved Transformer model optimizes the above process by introducing surrogate vectors. A surrogate vector set P = {p1, p2, ..., p...} is introduced. v'}, each agent vector p v' This function is responsible for aggregating local region information. Here, a proxy vector is generated from the input sequence through a linear transformation, calculated using the following formula:
[0101] P = W P X l
[0102] In the formula: X l It is the input EEG feature matrix, with dimension N. l ×D l (N l D is the sequence length. l (as feature dimension), WP It is a learnable linear transformation matrix with dimension M. l ×N l M l Let p be the number of surrogate vectors. Through this linear transformation, the model can map from the EEG feature space to the surrogate vector space, allowing each surrogate vector to focus on specific feature combinations and local region information. Each surrogate vector p v' Local region information is obtained by weighting the input sequence and summing the weights, where α is the weight. g,u Calculated using the following formula:
[0103]
[0104] In the formula: It is the nth digit of the input sequence. l A marker, here k l `<variable>` is a loop variable used to iterate through each tag in the input sequence. By calculating the similarity or relevance between the surrogate vector and each tag, the model can determine which tags contribute more to the local region of interest of the current surrogate vector. After obtaining the weights, the surrogate vector is updated as follows:
[0105]
[0106] This process enables each surrogate vector to focus on different local regions of the input sequence, effectively reducing the computational burden of attention. Specifically, each surrogate vector combines feature vectors from the original input sequence through a weighted summation. Feature vectors with higher weights contribute more to the surrogate vector, thus highlighting key features of local regions while suppressing the influence of irrelevant or noisy information. Specifically, the feature fusion module concatenates or weights and fuses features from open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks to form a comprehensive feature vector that fully reflects the subject's EEG activity state. During feature fusion, a weighted fusion strategy based on task importance is adopted to determine the weights of different task features. Specifically, first, cross-validation is performed on the training dataset to calculate the contribution of each task feature to the depression classification; then, weights are assigned to each task feature according to the contribution, with higher-contribution features receiving larger weights; finally, the different task features are weighted and summed according to their weights to obtain the comprehensive feature vector. This weighted fusion strategy fully utilizes the information from different task features, improves the representational power of the comprehensive feature vector, and thus enhances the accuracy of depression detection.
[0107] Specifically, the depression classification module uses support vector machines, random forests, decision trees, K-nearest neighbors, and Bayesian classifiers to classify features fused from open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks by the feature fusion module. Each classifier has its unique algorithm and applicable scenarios, among which:
[0108] The support vector machine (SVM) divides data into two classes by finding a hyperplane, and is suitable for both linearly separable and nonlinear data. When using the SVM, a kernel function mapping method is used to map nonlinearly separable data to a high-dimensional space, making it linearly separable in the high-dimensional space.
[0109] Random forest is an ensemble learning method that improves classification accuracy and stability by constructing multiple decision trees and combining their results. The following steps are used for random forest: First, determine the number of decision trees by experimenting to find the optimal number to balance classification performance and computational complexity; second, determine the depth of each decision tree by pruning to prevent overfitting; finally, use feature selection to choose the features that contribute most to the classification of depression as the splitting features for each decision tree.
[0110] The decision tree makes classification decisions through a series of branch nodes, which is easy to understand and interpret. In the decision tree, the Gini index is used as the selection criterion for split features. At each split node, the Gini index of each feature is calculated, and the feature with the smallest Gini index is selected as the split feature.
[0111] The K-nearest neighbors classification is based on the category of the nearest neighbor in the training data, which is suitable for densely distributed data. For K-nearest neighbors, the following optimization measures are adopted: First, determine an appropriate number of neighbors K and select the optimal K value through cross-validation; Second, use a distance-weighted method to give greater weight to neighbors closer to the test sample, thereby improving the rationality of the classification decision.
[0112] The Bayesian classifier is based on Bayes' theorem and is suitable for processing data with probabilistic characteristics, making full use of prior knowledge. The Bayesian classifier uses the following method: First, it estimates the prior probability based on the proportion of different class samples in the training data; second, it estimates the conditional probability using maximum likelihood estimation; finally, it calculates the posterior probability based on Bayes' theorem and selects the class with the highest posterior probability as the classification result.
[0113] Model performance was evaluated using cross-validation after adjusting model parameters and structure. Experimental results show that the system achieved an accuracy of up to 85.00% on the independent test set, demonstrating its potential in early screening for adolescent depression and the effectiveness of multi-task EEG data fusion. During the validation phase, the trained model was tested using an independent test set to ensure its reliability and effectiveness in practical applications. Furthermore, this module records the model's training process and validation results, providing a reference for subsequent model improvement and optimization.
[0114] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. A system for detecting adolescent depression based on multi-task EEG biosignals, characterized in that, include: The EEG data acquisition module guides users to conduct experiments according to the designed experimental paradigms of open-eye resting task, closed-eye resting task, attention task and non-attention task, and uses EEG equipment to collect and read the user's EEG data. The data preprocessing module is used to perform preprocessing operations on the EEG data read by the EEG data acquisition module, including signal filtering, artifact removal, signal rereference, and data normalization. The feature extraction module utilizes the EEG biosignal learning module and an improved Transformer model to extract features from preprocessed EEG data, obtaining features related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks. The EEG biosignal learning module processes and analyzes the EEG data, including a biosignal segmentation module, Fast Fourier Transform (FFT), segment embedding, channel embedding, and positional encoding. The biosignal segmentation module divides the EEG data into multiple segments. The FFT transforms these segments from a time dimension to a frequency dimension for better analysis of patterns and features. Segment embedding and channel embedding encode segments and channels respectively to better represent their features and information. Positional encoding preserves the temporal order of the data. The improved Transformer model integrates the information output by the EEG biosignal learning module, analyzing the EEG data from multiple perspectives and extracting features helpful for depression detection. This improved Transformer model introduces surrogate vectors, each responsible for aggregating and transmitting information within a local region. The feature fusion module is used to fuse features related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks to construct a feature representation that can comprehensively reflect the state of depression. The depression classification module uses a classifier to classify features from the feature fusion module that are related to open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks, and obtains depression detection results.
2. The adolescent depression detection system based on multi-task EEG biosignals according to claim 1, characterized in that, The EEG data acquisition module includes a task experiment paradigm module and a data loading module, wherein: The task experiment paradigm module utilizes visual and auditory guidance to help users enter different task states according to the instructions on the computer screen. During this process, EEG data is collected, amplified, and filtered using an EEG acquisition device before being read. The specific experimental procedures for the open-eye resting task, closed-eye resting task, attention task, and non-attention task are as follows: Note the task: Participants perform mental arithmetic subtraction, that is, continuously subtract a fixed number in their minds until they hear a stop signal; this task requires participants to concentrate on continuous calculation operations, which can effectively activate brain regions related to attention. Non-attentional task: Participants engage in a period of restful imagination without specific stimuli. During this process, participants are free to think or recall without needing to focus their attention on a specific task or goal, thus reflecting the characteristics of the subject's brain electrical activity in a natural state. Eyes-open resting task: Participants remain quiet with their eyes open, able to focus on a fixed point or observe their surroundings naturally, without engaging in any specific activities or thinking. This state helps to observe the basic EEG activity of the subjects in the eyes-open state. Eyes-closed resting task: Participants close their eyes and rest, relax their body and brain, and minimize the impact of external visual stimuli on the brain, so as to obtain the resting EEG activity characteristics of the subjects in the eyes-closed state. Between each task, the system will provide participants with appropriate rest time to avoid fatigue and interference between tasks; The data loading module is used to read EEG data from the local machine, including MAT and CNT formats, and to receive EEG data transmitted online from the task experiment paradigm module.
3. The adolescent depression detection system based on multi-task EEG biosignals according to claim 2, characterized in that, The data preprocessing module is used to preprocess the EEG data read by the EEG data acquisition module: First, signal filtering is performed using a second-order Butterworth filter with a filtering range of 0.5 to 50 Hz to remove high-frequency noise and low-frequency drift interference; second, Daubechies wavelet decomposition with a wavelet transform scale of 3 and FastICA algorithm independent component analysis are used for artifact removal to effectively remove interference signals such as eye movement artifacts and electromyography artifacts; then, signal rereference operation is performed using the average reference method, taking the average value of the signals from all channels as the new reference point to reduce the influence of the reference electrodes on the signal; Finally, data normalization was implemented using Z-score normalization to unify the data from different channels under the same scale, thereby improving the accuracy and comparability of subsequent analyses.
4. The adolescent depression detection system based on multi-task EEG biosignals according to claim 3, characterized in that, The specific details of the biosignal segmentation module, Fast Fourier Transform, segment embedding, channel embedding, and positional encoding are as follows: The biosignal segmentation module divides the record of each channel into tokens with a duration of t seconds. Adjacent tokens overlap for p seconds to ensure data continuity and preserve the temporal information in the EEG data. The k-th token of the i'-th channel is represented as: S[i',(tp)(k-1):(tp)(k-1)+t]. The number of tokens in each channel is limited by the total signal duration J, i.e., (tp)(k-1)+t≤J, where J is the length of the EEG biosignal, and p is crucial for preserving the temporal information of the EEG biosignal. The Fast Fourier Transform (FFT) is a method for converting time-domain signals to the frequency domain. Performing an FFT on each token yields its amplitude and phase information at each frequency component, as shown in the formula: In the formula: f represents frequency, in Hertz; n represents discrete time index, ranging from 0, 1, 2, ..., N-1; X(f) represents the amplitude of the signal at frequency f; x(n) represents the amplitude of the signal at time point n; N represents the number of sampling points of the signal; i is the imaginary unit; e is the base of the natural logarithm; π is pi. The Fast Fourier Transform (FFT) can obtain the amplitude and phase information of EEG data segments at different frequency components, transforming the time dimension to the frequency dimension, allowing observation of the energy distribution of the signal at different frequencies. The purpose of the segment embedding is to extract the energy characteristics of each token in different frequency bands from a spectral perspective and transform them into an energy vector. The frequency bands include delta waves, theta waves, alpha waves, beta waves, and gamma waves. The formula for calculating the energy in each frequency band is as follows: In the formula: E b F represents the energy within the b-th frequency band; b This represents the frequency range corresponding to the b-th frequency band; PSD(f) represents the power spectral density at frequency f. Then, a fully connected network with 5 neurons in the input layer, 128 neurons in the hidden layer, and 64 neurons in the output layer is used to process the energy vector and generate segment embeddings. This process can highly summarize the features of EEG data segments in the frequency domain and form a feature vector that can represent the EEG data segment, which is convenient for subsequent analysis and processing. The channel embedding involves learning a shared embedding table for all channels, with each channel corresponding to a 64-dimensional embedding vector. These vectors are optimized during model training to capture the features of each channel. When processing the signal of each channel, the corresponding channel embedding vector is added to the token representation of the signal. In this way, each token not only contains its own time and frequency features, but also information about the channel to which it belongs. The positional encoding encodes the sequence information of segments within a channel into the final token embedding, enabling the model to perceive the temporal order of the data. The sine and cosine functions are used to encode the sequence information of segments within a channel into the final token embedding, forming a final token embedding containing spatiotemporal information. The positional encoding formula is as follows: In the formula: pos represents the position of the token; m represents the index of the embedding dimension; d represents the embedding dimension; PE (pos,m) This represents the position code of dimension m at position pos; PE (pos,2m+1) The position code at position pos is represented by dimension m+1. The position information is transformed into a numerical form that the model can process through sine and cosine functions, and then incorporated into the final token embedding. In this way, the model can make full use of temporal sequence information when processing data, thereby improving the understanding and analysis of EEG data. Ultimately, the EEG biosignals are tokenized into sentences, represented as Sen∈R N'×l In the formula, N' represents the number of tokens, i.e. the number of segments generated after processing by the biosignal segmentation module; l represents the dimension of token embedding, i.e. the length of the vector converted into each segment; R represents the real number field; this matrix Sen contains the embedding vectors of all tokens, and each vector integrates the time-frequency features and location information of the segment for subsequent feature extraction and analysis.
5. The adolescent depression detection system based on multi-task EEG biosignals according to claim 4, characterized in that, The improved Transformer model introduces a proxy attention mechanism to reduce computational complexity and improve processing efficiency. The attention mechanism in the improved Transformer model is used to process the final token embedding and extract features from the multi-channel EEG signal. The process formula is as follows: OA=Attn S (Q,A,Attn S (A,K,V)) In the formula: OA represents the output of the attention mechanism in the improved Transformer model; Q, K, and V represent the query, key, and value matrices, respectively; A represents the auxiliary matrix used for broadcasting and aggregation operations in the attention mechanism; Attn S (A,K,V) represents the softmax attention mechanism. In the above process, the query matrix Q is used to represent the focus on other information, the key matrix K is used to represent the features of the information, and the value matrix V is used to represent the actual information content. By calculating the degree of matching between the query and the key, and by weighted summing of the values, the model can automatically learn which information is more important and thus extract more valuable EEG features. The improved Transformer model optimizes the above process by introducing surrogate vectors, specifically a surrogate vector set P = {p1, p2, ..., p...}. v' }, each agent vector p v' This function is responsible for aggregating local region information. Here, it generates a proxy vector from the input sequence through a linear transformation. The calculation formula is as follows: P=W P X l In the formula: X l It is the input EEG feature matrix, with dimension N. l ×D l N l D is the sequence length. l W is the feature dimension. P It is a learnable linear transformation matrix with dimension M. l ×N l M l Given the number of surrogate vectors, this linear transformation allows the model to map from the EEG feature space to the surrogate vector space, enabling each surrogate vector to focus on specific feature combinations and local region information; each surrogate vector p v' Local region information is obtained by weighting the input sequence and summing the weights, where α is the weight. g,u Calculated using the following formula: In the formula: x nl It is the nth digit of the input sequence. l A marker, here k l This is a loop variable used to iterate through each marker in the input sequence; by calculating the similarity or correlation between the surrogate vector and each marker, the model can determine which markers contribute more to the local region of interest of the current surrogate vector. After obtaining the weights, the surrogate vector is updated as follows: This process enables each surrogate vector to focus on different local regions of the input sequence, effectively reducing the computational cost of attention. Each surrogate vector combines the feature vectors in the original input sequence through a weighted summation. Feature vectors with higher weights contribute more to the surrogate vector, thus enabling the surrogate vector to highlight the key features of the local region while suppressing the influence of irrelevant or noisy information.
6. The adolescent depression detection system based on multi-task EEG biosignals according to claim 5, characterized in that, The feature fusion module concatenates or weights features from open-eye resting tasks, closed-eye resting tasks, attention tasks, and non-attention tasks to form a comprehensive feature vector that fully reflects the subject's EEG activity state. During feature fusion, a weighted fusion strategy based on task importance is adopted to determine the weights of different task features: First, cross-validation is performed on the training set to calculate the contribution of each task feature to the depression classification; then, weights are assigned to each task feature according to its contribution, with higher-contribution features receiving larger weights; finally, the different task features are weighted and summed to obtain the comprehensive feature vector. This weighted fusion strategy fully utilizes the information from different task features, improves the representational power of the comprehensive feature vector, and thus enhances the accuracy of depression detection.
7. The adolescent depression detection system based on multi-task EEG biosignals according to claim 6, characterized in that, The depression classification module uses a classifier to classify the features fused by the feature fusion module from open-eye resting task, closed-eye resting task, attention task, and non-attention task. The classifiers include support vector machines, random forests, decision trees, K-nearest neighbors, and Bayesian classifiers. Each classifier has its unique algorithm and applicable scenarios. The support vector machine (SVM) divides data into two classes by finding a hyperplane, and is suitable for both linearly separable and nonlinear data. When using the SVM, a kernel function mapping method is used to map nonlinearly separable data to a high-dimensional space, making it linearly separable in the high-dimensional space. Random forest is an ensemble learning method that improves classification accuracy and stability by constructing multiple decision trees and combining their results. The following steps are used for random forest: First, determine the number of decision trees by experimenting to find the optimal number to balance classification performance and computational complexity; second, determine the depth of each decision tree by pruning to prevent overfitting; finally, use feature selection to choose the features that contribute most to the classification of depression as the splitting features for each decision tree. The decision tree makes classification decisions through a series of branch nodes, which is easy to understand and interpret. In the decision tree, the Gini index is used as the selection criterion for split features. At each split node, the Gini index of each feature is calculated, and the feature with the smallest Gini index is selected as the split feature. The K-nearest neighbors classification is based on the category of the nearest neighbor in the training data, which is suitable for densely distributed data. For K-nearest neighbors, the following optimization measures are adopted: First, determine an appropriate number of neighbors K and select the optimal K value through cross-validation; Second, use a distance-weighted method to give greater weight to neighbors closer to the test sample, thereby improving the rationality of the classification decision. The Bayesian classifier is based on Bayes' theorem and is suitable for processing data with probabilistic characteristics, making full use of prior knowledge. The Bayesian classifier uses the following method: First, it estimates the prior probability based on the proportion of different class samples in the training data; second, it estimates the conditional probability using maximum likelihood estimation; finally, it calculates the posterior probability based on Bayes' theorem and selects the class with the highest posterior probability as the classification result.