A mental illness detection method based on GBO-M-CNN

By using the GBO-M-CNN method to screen key EEG channels, construct multi-layer brain functional networks, and optimize model parameters, the problems of information redundancy and low model optimization efficiency in EEG signal detection are solved, and efficient automatic detection of mental illnesses is achieved.

CN122245639APending Publication Date: 2026-06-19LANZHOU JIAOTONG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LANZHOU JIAOTONG UNIV
Filing Date
2026-03-22
Publication Date
2026-06-19

Smart Images

  • Figure CN122245639A_ABST
    Figure CN122245639A_ABST
Patent Text Reader

Abstract

This invention discloses a method for detecting mental illness based on GBO-M-CNN, belonging to the field of intelligent diagnostic technology. The method includes: in the information representation stage, introducing multi-scale Euclidean norm weighted permutation entropy (ENPE) to evaluate the complexity of EEG channels, thereby obtaining the optimal channel subset; in the discriminative modeling stage, constructing a multi-branch convolutional neural network (M-CNN), designing learnable frequency band weights and a joint cross-entropy loss mechanism to achieve adaptive allocation and collaborative discrimination of multi-frequency band EEG features; in the parameter optimization stage, employing a grouped Bayesian (GBO) strategy to perform grouped search and collaborative optimization of M-CNN hyperparameters, forming a GBO-M-CNN detection model; and achieving automatic detection of mental illness through the GBO-M-CNN model. This invention solves the problems of insufficient EEG signal complexity representation, weak multi-frequency information fusion capability, and low efficiency of high-dimensional hyperparameter search, achieving high-precision automatic detection of mental illness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent diagnostic technology, and in particular to a method for detecting mental illnesses based on GBO-M-CNN. Background Technology

[0002] Mental illness is a state characterized by disorder or abnormality in perception, thinking, emotion, behavior, and will, resulting from the dysfunction of psychological processes caused by the combined effects of multiple factors. Among these, mental illnesses such as depression and anxiety disorders have high prevalence and disability rates, posing a significant challenge to global public health. Statistics from the World Health Organization show that the number of people with mental illness worldwide continues to rise, and the burden of mental disorders is increasing year by year, placing enormous pressure on social healthcare systems and public health management.

[0003] Currently, the most widely used clinical method for diagnosing mental illness is face-to-face interviews based on the Diagnostic and Statistical Manual of Mental Disorders (DSM-IV) and the International Classification of Diseases (ICD-11). In practice, this method heavily relies on the accuracy of the patient's subjective report and the clinician's personal experience, which to some extent limits the objectivity and accuracy of the diagnosis. Therefore, developing mental illness testing based on objective physiological signals has significant social and practical value.

[0004] Electroencephalography (EEG), as a method for monitoring neural electrical signals, has been widely used in the analysis and research of mental illnesses due to its advantages such as non-invasiveness, high temporal resolution, low cost, and ease of operation. Meanwhile, computer-aided diagnostic technologies based on signal processing and machine learning are rapidly developing, providing efficient means for the automated detection of EEG signals. However, existing EEG-based mental illness detection methods still face three main problems: First, high-density EEG signals exhibit information redundancy, easily diluting disease-related discriminative information; second, multi-frequency EEG feature fusion often employs an equal-weight strategy, ignoring the differences in discriminative capabilities among different frequency bands; and third, machine learning model parameter optimization methods typically perform global searches in high-dimensional parameter spaces, making it difficult to adapt to multi-branch model structures and limiting search efficiency. To address these problems, this invention provides a mental illness detection method based on GBO-M-CNN. Summary of the Invention

[0005] To address the aforementioned technical problems, this invention provides a mental illness detection method based on GBO-M-CNN, forming a collaborative detection mechanism of "information enhancement → discriminative modeling → parameter optimization" for the automatic detection of mental illnesses.

[0006] The technical solution adopted in this invention includes the following steps:

[0007] Step 1: Acquire multi-channel EEG signals X a,b ={x1, x2, …, x N The signals from each channel are segmented and processed with a time window of 6 seconds and a sliding step of 2 seconds.

[0008] Step 2: Calculate the multi-scale Euclidean norm weighted permutation entropy (ENPE) for each EEG channel to characterize the complexity of the EEG signal, and sort and select the optimal subset of EEG channels according to the complexity.

[0009] Step 3: Perform frequency band decomposition based on the optimal channel subset, calculate the functional connectivity between multi-frequency channels using the phase lag index (PLI), and construct a multi-layer brain functional network (M-BFN). The PLI calculation process is as follows:

[0010]

[0011]

[0012] (1)

[0013] Where L is the signal length, sign(·) is the sign function, and ϕ(t) represents the instantaneous phase of the EEG signal x(t). (t) is the Hilbert transform of x(t).

[0014] Step 4: Using M-BFN as input, construct a multi-branch convolutional neural network (M-CNN) model. Each branch of M-CNN is a branch convolutional neural network with a consistent structure. The mapping process of each branch-CNN can be represented as follows:

[0015] (2)

[0016] Where, θ (b) Let f represent the trainable parameters of the b-th branch, K be the number of classes, and each branch have an output dimension matching the number of classes. (b) is a logits vector of dimension K, which represents the model's unnormalized linear predictions for each category.

[0017] Step 5: Introduce a learnable frequency band weight mechanism into the M-CNN model to adaptively weight features of different frequency bands, and train the model using the cross-entropy loss function, which is:

[0018] (3)

[0019] Among them, L e For terminal classification cross-entropy loss, Let λ be the cross-entropy loss of the b-th branch network, λ1∈[0,1] be the ratio factor between the terminal cross-entropy loss and the branch cross-entropy loss, and λ2≥0 be the frequency band weight regularization coefficient. This is the frequency band weighting regularization term.

[0020] Step 6: Use the Grouped Bayesian Optimization (GBO) strategy to perform grouped search and collaborative optimization of the hyperparameters of the M-CNN model to obtain the optimal model parameter configuration and generate the GBO-M-CNN detection model;

[0021] Step 7: Implement automatic detection of mental illnesses based on the GBO-M-CNN model.

[0022] Furthermore, the specific process of step two is as follows:

[0023] (1) For multi-scale coarse-grained sequences Given an embedding dimension m and a delay factor t, we reconstruct the phase space of the vector to obtain the embedding vector:

[0024] , l=1, 2, …, L (4)

[0025] in, Let b be the signal segment of the a-th EEG channel, and let m be the embedding vector constructed at scale s, starting from time index l. For a single coarse-grained signal value at the corresponding scale, L=(N-s+1)-(m-1)t represents the total number of embedding vectors that can be constructed at the current scale.

[0026] (2) Embedded vectors The elements are arranged in ascending order of their numerical values:

[0027] (5)

[0028] in, This represents the permutation pattern corresponding to the l-th embedding vector, i.e., an index sequence of length m, used to describe the relative size relationship of each component within the embedding vector.

[0029] (3) Design each embedding vector Euclidean norm weighting factor:

[0030] (6)

[0031] In the formula, μ∈[0,1] is the amplitude weighting coefficient, and the first term The second term represents the magnitude of the embedded vector. The two terms represent the Euclidean distance between adjacent embedding vectors in the embedding space. They respectively characterize the amplitude stability and volatility of the signal from the perspectives of signal space energy and dynamics, thereby enhancing the sensitivity of PE to energy changes.

[0032] (4) The weighted probability of the r-th permutation pattern is defined as:

[0033] (7)

[0034] Here, the molecule represents all corresponding permutation patterns. The sum of the weighted factors of the embedding vectors, with the denominator being the sum of the weighted factors of all embedding vectors at scale s.

[0035] (5) ENPE at scale s is defined as:

[0036] (8)

[0037] Calculate each EEG signal subsequence X sequentially a,b Different scales Take their average value as the channel's ENPE Integrating all channels ENPE Construct the ENPE feature matrix of the EEG signal. For each channel... ENPE The values ​​are sorted in descending order, and the top K channels are selected to generate the optimal channel subset.

[0038] Furthermore, the specific process of step five is as follows:

[0039] (1) M-CNN introduces a learnable frequency band weight fusion mechanism in the feature fusion layer, which affects the logits vector f output by each branch. (b) Perform linear weighting to generate the final discrimination score:

[0040] , α b ≥0 and (9)

[0041] in, These are trainable frequency band weight parameters constrained by Soft-max normalization, representing the relative contribution of each frequency band to the final classification. The fused logits vector is mapped to a class probability distribution via a Soft-max function and used for the final decision.

[0042] (2) To enhance the model's cross-frequency collaborative capability, a multi-level supervised joint cross-entropy constraint is constructed. This constraint consists of two types of cross-entropy terms and a frequency band weight regularization term. The first is the end-to-end cross-entropy, used to constrain the overall discrimination performance after fusion. The calculation process is as follows:

[0043] (10)

[0044] Where, δ y,k This is an indicator function whose value is determined by the true label y of the sample. It is used to select the predicted probability corresponding to the true class in the cross-entropy loss.

[0045] Second is the branch cross entropy, which is used to constrain the independent discriminative ability of each branch. The calculation process is as follows:

[0046] (11)

[0047] Third, the frequency band weight smoothing regularization term, by penalizing the degree to which the weight vector deviates from a uniform distribution, suppresses the phenomenon of extreme weight collapse:

[0048] (12)

[0049] The joint cross-entropy loss is defined as the weighted sum of the above three terms:

[0050] (13)

[0051] Where λ1∈[0,1] is the ratio factor between terminal cross-entropy loss and branch cross-entropy loss, and λ2≥0 is the frequency band weight regularization coefficient.

[0052] Furthermore, the specific process of step six is ​​as follows:

[0053] (1) Let the original hyperparameter space be:

[0054] Z = {θ1, θ2, ..., θ} n} (14)

[0055] Based on the hyperparameter functional correlation, it is divided into m non-overlapping subsets P1, P2, ..., P m :

[0056] (15)

[0057] (2) For each subspace P i Bayesian optimization is employed independently, with the joint cross-entropy loss function as the optimization objective. To approximate the response relationship between the objective function and the hyperparameters, a Gaussian process (GP) is used to construct its surrogate model.

[0058] f(x)~GP(m(x), k(x, x')) (16)

[0059] Where x and x' represent any two different parameter configurations in the parameter space, m(x) is the mean function, and k(x, x') is the covariance function.

[0060] (3) To select parameter points for the next evaluation, the Expected Improvement (EI) criterion is used as the acquisition function:

[0061] (17)

[0062] Where, f(x) best ) represents the objective function value corresponding to the current optimal parameter configuration, f(x) represents the objective function value predicted by the model, and EI(x) represents the improvement amount between the current parameter configuration and the predicted optimal solution.

[0063] (4) Each subspace P i Considering a state as a state in a Markov chain, construct the inter-group transition probability matrix M to dynamically select the next subspace to be optimized, denoted as:

[0064] M=[P ij (18)

[0065] The inter-group transition probability is defined as follows:

[0066] (19)

[0067] in, This means that in the t-th trial, when the i-th set of parameters is fixed as the optimal configuration obtained in the current search process, the performance of the j-th set is optimized.

[0068] Compared with the prior art, the beneficial effects of the present invention using the above technical solution are as follows:

[0069] (1) This invention solves the problems of insufficient EEG signal complexity representation and key channel screening. In the information representation stage, the invention introduces multi-scale Euclidean norm weighted permutation entropy (ENPE) to perform multi-scale quantitative analysis of EEG signal complexity, thereby enabling the identification and screening of key EEG channels related to mental illness and improving the information representation capability of EEG signals.

[0070] (2) This invention solves the problem of insufficient collaborative modeling ability of traditional EEG detection models in terms of multi-frequency information fusion. In the discriminative modeling stage, a multi-branch convolutional neural network (M-CNN) is constructed. Through adaptive weight allocation of frequency band information and multi-frequency collaborative learning mechanism, the effective fusion of features of different frequency bands is achieved, thereby improving the model's ability to discriminate and detect mental illnesses.

[0071] (3) This invention solves the problems of low search efficiency and unstable training of deep learning models in high-dimensional hyperparameter space. In the parameter optimization stage, this invention proposes a grouped Bayesian optimization (GBO) strategy. By structurally dividing the hyperparameter space and performing adaptive search in the subspace, the efficiency of model parameter optimization and convergence stability are improved, thereby enhancing the automatic detection performance of the model. Attached Figure Description

[0072] Figure 1 This is a flowchart of the method of the present invention;

[0073] Figure 2 This is a comparison of inter-group ENPE differences in an embodiment of the present invention;

[0074] Figure 3 This is a scatter plot showing the distribution of the mean ENPE values ​​in an embodiment of the present invention.

[0075] Figure 4 This is the GBO-M-CNN structure according to an embodiment of the present invention;

[0076] Figure 5 This is the evolution process of multi-frequency information weights in GBO-M-CNN according to an embodiment of the present invention;

[0077] Figure 6 This is a DP detection process based on GBO-M-CNN in an embodiment of the present invention;

[0078] Figure 7 The present invention presents comparative experimental results from two aspects: frequency band discrimination capability and model category. Among them, (a) is the comparative result of independent discrimination performance of different frequency bands, and (b) is the comparative result of performance of different models. Detailed Implementation

[0079] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and examples. The following examples use depression (DP) detection as a specific application scenario to illustrate the implementation process and technical effects of the mental illness detection method based on GBO-M-CNN provided by the present invention, but are not intended to limit the scope of the present invention.

[0080] Please see Figure 1 As shown, the present invention provides a technical solution: a method for detecting mental illness based on GBO-M-CNN, using DP detection as an example for illustration. The steps of the method are as follows:

[0081] Step 1: Acquire 128-channel EEG data X a,b ={x1, x2, …, x N The signals from each channel are segmented and processed with a time window of 6 seconds and a sliding step of 2 seconds.

[0082] Step 2: Calculate the multi-scale Euclidean norm weighted permutation entropy (ENPE) for each EEG channel to characterize the complexity of the EEG signal, and then sort and select the optimal subset of EEG channels based on the complexity. The process is as follows:

[0083] (1) For multi-scale coarse-grained sequences Given an embedding dimension m and a delay factor t, we reconstruct the phase space of the vector to obtain the embedding vector:

[0084] , l=1, 2, …, L (4)

[0085] in, Let b be the signal segment of the a-th EEG channel, and let m be the embedding vector constructed at scale s, starting from time index l. For a single coarse-grained signal value at the corresponding scale, L=(N-s+1)-(m-1)t represents the total number of embedding vectors that can be constructed at the current scale.

[0086] (2) Embedded vectors The elements are arranged in ascending order of their numerical values:

[0087] (5)

[0088] in, This represents the permutation pattern corresponding to the l-th embedding vector, i.e., an index sequence of length m, used to describe the relative relationships among the components within the embedding vector.

[0089] (3) Design each embedding vector Euclidean norm weighting factor:

[0090] (6)

[0091] In the formula, μ∈[0,1] is the amplitude weighting coefficient, and the first term The second term represents the magnitude of the embedded vector. The two terms represent the Euclidean distance between adjacent embedding vectors in the embedding space. They respectively characterize the amplitude stability and volatility of the signal from the perspectives of signal space energy and dynamics, thereby enhancing the sensitivity of PE to energy changes.

[0092] (4) The weighted probability of the r-th permutation pattern is defined as:

[0093] (7)

[0094] Here, the molecule represents all corresponding permutation patterns. The sum of the weighted factors of the embedding vectors, with the denominator being the sum of the weighted factors of all embedding vectors at scale s.

[0095] (5) ENPE at scale s is defined as:

[0096] (8)

[0097] Calculate each EEG signal subsequence X sequentially a,b Different scales Take their average value as the channel's ENPE Integrate all channels ENPE Construct the ENPE feature matrix of the EEG signal. For each channel... ENPE The values ​​are sorted in descending order, and the top K channels are selected to generate the optimal channel subset.

[0098] Figure 2 The results of the inter-group comparison of ENPE differences are presented. It can be observed that compared with the normal control (NC) group, the overall ENPE level in the DP group was significantly lower across all scales, and the distribution was more discrete. This result indicates abnormal brain activity patterns in DP patients, specifically manifested as decreased complexity and increased synchronicity, consistent with the pathological characteristics of DP patients: slow response to external stimuli and decreased internal information processing ability. Further independent samples t-test statistical analysis showed a significant difference in ENPE values ​​between the two groups (p<0.001), indicating that ENPE has a good ability to distinguish DP-related EEG dynamic abnormalities. This invention further analyzes the ENPE distribution from the perspective of the consistency of channel complexity ranking, and the results are as follows... Figure 3 As shown in the figure, by comparing the scatter plot distribution of the mean ENPE values ​​of the DP group and the NC group, it can be found that the two groups show a high degree of consistency in the ranking of channel complexity. Therefore, the top 46 channels in both groups were selected as the subset of key channels.

[0099] Step 3: Perform frequency band decomposition based on the optimal channel subset, calculate the functional connectivity between multi-frequency channels using the phase lag index (PLI), and generate a multi-layer brain functional network (M-BFN). The PLI calculation process is as follows:

[0100]

[0101]

[0102] (1)

[0103] Where L is the signal length, sign(·) is the sign function, and ϕ(t) represents the instantaneous phase of the EEG signal x(t). (t) is the Hilbert transform of x(t).

[0104] Step 4: Construct a multi-branch convolutional neural network (M-CNN) model, such as... Figure 4 As shown in (b), M-BFN is used as the model input. Each branch of M-CNN is a Branch-CNN with a consistent structure, and the mapping process of each Branch-CNN can be represented as:

[0105] (2)

[0106] Where, θ (b) Here are the trainable parameters for the b-th branch, K is the number of classes, and each branch has an output dimension matching the number of classes, f. (b) is a logits vector of dimension K, which represents the model's unnormalized linear predictions for each category.

[0107] Step 5: Introduce a learnable frequency band weight mechanism into the M-CNN model to adaptively weight features of different frequency bands, and train the model using the cross-entropy loss function, which is:

[0108] (3)

[0109] Among them, L e For terminal classification cross-entropy loss, Let λ be the cross-entropy loss of the b-th branch network, λ1∈[0,1] be the ratio factor between the terminal cross-entropy loss and the branch cross-entropy loss, and λ2≥0 be the frequency band weight regularization coefficient. This is the frequency band weight regularization term. The multi-frequency fusion process of M-CNN is as follows:

[0110] (1) M-CNN introduces a learnable frequency band weight fusion mechanism in the feature fusion layer, which affects the logits vector f output by each branch. (b) Perform linear weighting to generate the final discrimination score:

[0111] , α b ≥0 and (9)

[0112] in, These are trainable frequency band weight parameters constrained by Soft-max normalization, representing the relative contribution of each frequency band to the final classification. The fused logits vector is mapped to class probabilities via the Soft-max function for the final decision.

[0113] (2) To enhance the model's cross-frequency collaborative capability, a multi-level supervised joint cross-entropy constraint is constructed. This constraint consists of two types of cross-entropy terms and a frequency band weight regularization term. The first is the end-to-end cross-entropy, used to constrain the overall discrimination performance after fusion. The calculation process is as follows:

[0114] (10)

[0115] Where, δ y,k This is an indicator function whose value is determined by the true label y of the sample. It is used to select the predicted probability corresponding to the true class in the cross-entropy loss.

[0116] Second, branch cross-entropy, used to constrain the independent discriminative ability of each branch:

[0117] (11)

[0118] Third, the frequency band weight smoothing regularization term, by penalizing the degree to which the weight vector deviates from a uniform distribution, suppresses the phenomenon of extreme weight collapse:

[0119] (12)

[0120] The joint cross-entropy loss is defined as the weighted sum of the above three terms:

[0121] (13)

[0122] Where λ1∈[0,1] is the ratio factor between terminal cross-entropy loss and branch cross-entropy loss, and λ2≥0 is the frequency band weight regularization coefficient.

[0123] Figure 5 The frequency band weight α is shown b and its branch loss The evolution process during iterative training. Under optimal hyperparameter configuration, the weights of each frequency band are initially equally weighted, but gradually differentiate and eventually stabilize during the training process, forming a distinctive frequency band contribution allocation.

[0124] Step Six: The hyperparameters of the M-CNN model are grouped and collaboratively optimized using a Grouped Bayesian Optimization (GBO) strategy, such as... Figure 4 As shown in (a), to obtain the optimal model parameter configuration and generate the GBO-M-CNN detection model, the process is as follows:

[0125] (1) Let the original hyperparameter space be:

[0126] Z = {θ1, θ2, ..., θ} n} (14)

[0127] Based on the hyperparameter functional correlation, it is divided into m non-overlapping subsets P1, P2, ..., P m The grouping space is shown in Table 1.

[0128] (15)

[0129] Table 1 Hyperparameter Search Space

[0130]

[0131] (2) For each subspace P i Independent Bayesian optimization is employed, with the joint cross-entropy loss function as the optimization objective. To approximate the response relationship between the objective function and the hyperparameters, a Gaussian process (GP) is used to construct a surrogate model.

[0132] f(x)~GP(m(x), k(x, x')) (16)

[0133] Where x and x' represent any two different parameter configurations in the parameter space, m(x) is the mean function, in this embodiment m(x)=0, and k(x, x') is the covariance function.

[0134] (3) The Expected Improvement (EI) criterion is used as the acquisition function to select the parameter points for the next evaluation:

[0135] (17)

[0136] Where, f(x) best ) represents the objective function value corresponding to the current optimal parameter configuration, f(x) represents the objective function value predicted by the model, and EI(x) represents the improvement amount between the current parameter configuration and the predicted optimal solution.

[0137] (4) Each subspace P i Treating a state as a state in a Markov chain, construct the inter-group transition probability matrix M to dynamically select the next subspace to be optimized:

[0138] M=[P ij (18)

[0139] The inter-group transition probability is defined as follows:

[0140] (19)

[0141] in, This indicates that in the t-th trial, when the i-th group of parameters is fixed at the optimal configuration obtained during the current search process, the performance of the j-th group is optimized. Tables 2 and 3 show the GBO-M-CNN hyperparameter transition matrix and the optimal model parameter configuration, respectively.

[0142] Table 2 GBO Hyperparameter Set Transition Matrix

[0143] From / To <![CDATA[Architecture(P1)]]> <![CDATA[Training(P2)]]> <![CDATA[Regularization(P3)]]> <![CDATA[Weighting(P4)]]> <![CDATA[Architecture(P1)]]> 0.15 0.35 0.15 0.35 <![CDATA[Training(P2)]]> 0.10 0.50 0.25 0.15 <![CDATA[Regularization(P3)]]> 0.10 0.30 0.40 0.20 <![CDATA[Weighting(P4)]]> 0.10 0.25 0.40 0.25

[0144] Table 3 Optimal Model Parameter Configuration for GBO-M-CNN Model

[0145] Hyperparameter Symbol Search results Conv-filter1 <![CDATA[c1]]> 32 Conv-filter2 <![CDATA[c2]]> 64 Conv-receptive-fields1 <![CDATA[k1]]> 5×5 Conv-receptive-fields2 <![CDATA[k2]]> 3×3 Pooling p 2×2 Activation Φ PReLU Learning rate η 0.001 Batch size b 60 Dropout <![CDATA[d1d2d fc ]]> 0.220.180.3 L2 weight decay <![CDATA[λ w ]]> 0.00015 BN Momentum <![CDATA[m BN ]]> 0.9

[0146] Step 7: Based on the optimized GBO-M-CNN model, visualize the model decision-making process, such as... Figure 6 As shown, the model assigns differentiated weights to different frequency band branches during the convergence phase: frequency bands with lower branch losses are given higher fusion weights, while the contributions of branches with higher losses are suppressed.

[0147] Taking the delta band as an example, the adjacency matrix of this layer of brain functional network is used as the input of Branch CNN1. The network structure features and local connection pattern features are extracted step by step through the dual-core convolutional module to form a high-level semantic representation, and the logits vector f is output. (1) =[-2.40,1.20] T This is used to characterize the unnormalized discrimination scores of the model for DP and NC. Under the constraint of the branch supervision mechanism, this logits vector is mapped to the class probability distribution via a soft-max mapping. =[0.04,0.96] T Based on this probability, the branch crossover entropy loss can be obtained. =0.041, During the backpropagation phase, the parameters of Branch CNN1 are directly updated, continuously reinforcing its learning of the discriminative features of the delta band. Simultaneously, the logits of each branch are weighted and fused to obtain the end-to-end cross-entropy loss L. e Its backpropagation gradient further acts on the frequency band weighting parameter α. b Under the joint supervision mechanism, the delta band exhibits higher stability and consistency in its discriminative output during the fusion stage, resulting in a relatively larger effective gradient contribution of its corresponding logits in the end-to-end cross-entropy loss. This leads to a higher fusion weight allocation under the Soft-max normalization constraint, as shown in the figure where α1=0.36.

[0148] To verify the performance of the GBO-M-CNN model for mental illness detection provided by this invention, a comparative experiment was designed from two aspects: frequency band discrimination ability and model category. The results are as follows: Figure 7 As shown. Figure 7 (a) demonstrates the independent discrimination performance of different frequency bands in DP detection. It can be seen that the delta and alpha bands exhibit strong and stable discrimination capabilities, the beta band has a certain discrimination advantage but relatively limited stability, and the theta and gamma bands have relatively weak independent discrimination performance. Figure 7(b) The performance of the GBO-M-CNN model in detecting mental illnesses was compared with that of various typical models, including Support Vector Machine (SVM), K-Nearest Neighbors (KNN), Random Forest (RF), Convolutional Neural Network (CNN), and Graph Convolutional Neural Network (GCN). The experimental results show that the GBO-M-CNN model has the best accuracy, sensitivity, specificity, and F1 score of 98.92%, 96.62%, 99.33%, and 95.72%, respectively, making it the optimal model. It has a significant advantage in accuracy and sensitivity, which verifies the effectiveness of the mental illness detection method provided by this invention.

[0149] It should be noted that the above embodiments are merely preferred implementations of the technical solution of the present invention and are not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that, without departing from the core design concept and scope of the claims, adaptive adjustments or equivalent substitutions can be made to the specific implementation of the technical solution based on actual application scenarios, including but not limited to structural optimization, parameter adjustment, and functional module reorganization. All equivalent modifications or inventive extensions implemented based on the technical solution of the present invention fall within the scope of protection of the patent rights of this invention. The scope of protection of the present invention should be determined by the complete content of the claims; the embodiments described in the specification and drawings are only used to explain the legal connotation and technical features of the claims.

Claims

1. A method for detecting mental illness based on GBO-M-CNN, characterized in that, Includes the following steps: Step one: collect multi-channel EEG signal X a,b = {x1, x2, …, x N} and segment each channel signal with 6 seconds as time window and 2 seconds as sliding step. Step 2: Calculate the EEG multi-scale Euclidean norm weighted permutation entropy (ENPE) of each channel to characterize the complexity of the EEG signal, and sort and select the optimal subset of EEG channels according to the complexity. Step 3: Perform frequency band decomposition based on the optimal channel subset, calculate the functional connectivity between multi-frequency channels using the phase lag index (PLI), and construct a multi-layer brain functional network (M-BFN). The PLI calculation process is as follows: (1) Where L is the signal length, sign(·) is the sign function, and ϕ(t) represents the instantaneous phase of the EEG signal x(t). (t) is the Hilbert transform of x(t). Step 4: Using M-BFN as input, construct a multi-branch convolutional neural network (M-CNN) model. Each branch of M-CNN is a branch convolutional neural network with a consistent structure. The mapping process of each branch-CNN can be represented as follows: (2) Where, θ (b) Let f represent the trainable parameters of the b-th branch, K be the number of classes, and each branch have an output dimension matching the number of classes. (b) This is a logits vector of dimension K, which represents the model's unnormalized linear predictions for each category. Step 5: Introduce a learnable frequency band weight mechanism into the M-CNN model to adaptively weight features of different frequency bands, and train the model using the cross-entropy loss function, which is: (3) Among them, L e For terminal classification cross-entropy loss, Let λ be the cross-entropy loss of the b-th branch network, λ1∈[0,1] be the ratio factor between the terminal cross-entropy loss and the branch cross-entropy loss, and λ2≥0 be the frequency band weight regularization coefficient. This is the frequency band weighting regularization term. Step 6: Use the Grouped Bayesian Optimization (GBO) strategy to perform grouped search and collaborative optimization of the hyperparameters of the M-CNN model to obtain the optimal model parameter configuration and generate the GBO-M-CNN detection model. Step 7: Implement automatic detection of mental illnesses based on the GBO-M-CNN model.

2. The method for detecting mental illness based on GBO-M-CNN according to claim 1, characterized in that, The specific process of step two is as follows: (1) For multi-scale coarse-grained sequences Given an embedding dimension m and a delay factor t, we reconstruct the phase space of the vector to obtain the embedding vector: , l=1, 2, …, L (4) in, Let b be the signal segment of the a-th EEG channel, and let m be the embedding vector constructed at scale s, starting from time index l. For a single coarse-grained signal value at the corresponding scale, L=(N-s+1)-(m-1)t represents the total number of embedding vectors that can be constructed at the current scale. (2) Embedded vectors The elements are arranged in ascending order of their numerical values: (5) in, This represents the permutation pattern corresponding to the l-th embedding vector, i.e., an index sequence of length m, used to describe the relative size relationship of each component within the embedding vector. (3) Design each embedding vector Euclidean norm weighting factor: (6) In the formula, μ∈[0,1] is the amplitude weighting coefficient, and the first term The second term represents the magnitude of the embedded vector. The two terms represent the Euclidean distance between adjacent embedding vectors in the embedding space. They respectively characterize the amplitude stability and volatility of the signal from the perspectives of signal space energy and dynamics, thereby enhancing the sensitivity of PE to energy changes. (4) The weighted probability of the r-th permutation pattern is defined as: (7) Here, the molecule represents all corresponding permutation patterns. The sum of the weighted factors of the embedding vectors, with the denominator being the sum of the weighted factors of all embedding vectors at scale s. (5) The definition of ENPE at scale s is: (8) Calculate each EEG signal subsequence X sequentially a,b Different scales Take their average value as the channel's ENPE Integrating all channels ENPE Construct the ENPE feature matrix of the EEG signal. For each channel... ENPE The values ​​are sorted in descending order, and the top K channels are selected to generate the optimal channel subset.

3. The method for detecting mental illness based on GBO-M-CNN according to claim 1, characterized in that, Step five involves the following steps: (1) M-CNN introduces a learnable frequency band weight fusion mechanism in the feature fusion layer, which affects the logits vector f output by each branch. (b) Perform linear weighting to generate the final discrimination score: , α b ≥0 and (9) in, These are trainable frequency band weight parameters constrained by Soft-max normalization, representing the relative contribution of each frequency band to the final classification. The fused logits vector is mapped to a class probability distribution via a Soft-max function and used for the final decision. (2) To enhance the model's cross-frequency collaborative capability, a multi-level supervised joint cross-entropy constraint is constructed. This constraint consists of two types of cross-entropy terms and a frequency band weight regularization term. The first is the end-to-end cross-entropy, used to constrain the overall discrimination performance after fusion. The calculation process is as follows: (10) Where, δ y,k This is an indicator function whose value is determined by the true label y of the sample. It is used to select the predicted probability corresponding to the true class in the cross-entropy loss. Second is the branch cross entropy, which is used to constrain the independent discriminative ability of each branch. The calculation process is as follows: (11) Third, the frequency band weight smoothing regularization term, by penalizing the degree to which the weight vector deviates from a uniform distribution, suppresses the phenomenon of extreme weight collapse: (12) The joint cross-entropy loss is defined as the weighted sum of the above three terms: (13) Where λ1∈[0,1] is the ratio factor between terminal cross-entropy loss and branch cross-entropy loss, and λ2≥0 is the frequency band weight regularization coefficient.

4. The method for detecting mental illness based on GBO-M-CNN according to claim 1, characterized in that, Step six involves the following steps: (1) Let the original hyperparameter space be: Z={θ1, θ2, ..., θ n } (14) Based on the hyperparameter functional correlation, it is divided into m non-overlapping subsets P1, P2, ..., P m : (15) (2) For each subspace P i Bayesian optimization is employed independently, with the joint cross-entropy loss function as the optimization objective. To approximate the response relationship between the objective function and the hyperparameters, a Gaussian process (GP) is used to construct its surrogate model. f(x)~GP(m(x), k(x, x')) (16) Where x and x' represent any two different parameter configurations in the parameter space, m(x) is the mean function, and k(x,x') is the covariance function. (3) The Expected Improvement (EI) criterion is used as the acquisition function to select the parameter points for the next evaluation: (17) Where, f(x) best ) represents the objective function value corresponding to the current optimal parameter configuration, f(x) represents the objective function value predicted by the model, and EI(x) represents the improvement amount between the current parameter configuration and the predicted optimal solution. (4) Each subspace P i Treating a state as a state in a Markov chain, construct the inter-group transition probability matrix M to dynamically select the next subspace to be optimized: M=[P ij ] (18) The inter-group transition probability is defined as follows: (19) in, This means that in the t-th trial, when the i-th set of parameters is fixed as the optimal configuration obtained in the current search process, the performance of the j-th set is optimized.