A depression diagnosis and treatment system based on interpretable electroencephalogram adaptive transfer learning

By employing an adaptive transfer learning module and interpretability analysis, the problem of insufficient generalization ability of EEG signal models in multi-center, small-sample scenarios was solved. This enabled the transfer of lightweight target models and interpretable diagnosis and treatment of depression, improving the efficiency and consistency of diagnosis and efficacy evaluation.

CN122376103APending Publication Date: 2026-07-14SOUTH CHINA UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTH CHINA UNIV OF TECH
Filing Date
2026-04-23
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing technologies lack the generalization ability of EEG signal models in multi-center, small-sample scenarios, making it difficult to stably transfer to different hospitals, devices, or populations. Furthermore, they lack interpretability, which affects the diagnosis and efficacy evaluation of mental illnesses.

Method used

Using a large EEG-pretrained model as the source model, candidate matching pairs across model blocks are constructed through an adaptive transfer learning module. Feature transfer weight network and candidate matching pair transfer weight network are introduced for adaptive weighting. Combined with an inner and outer dual-layer optimization mechanism, lightweight target model transfer and training are achieved, improving learning ability and generalization performance in cross-center scenarios, and providing interpretable analysis.

Benefits of technology

The model's learning ability and generalization performance in cross-center scenarios were improved under small sample conditions, providing interpretable diagnostic and treatment results and improving the efficiency and consistency of diagnosis and efficacy evaluation of depression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122376103A_ABST
    Figure CN122376103A_ABST
Patent Text Reader

Abstract

This invention discloses an interpretable EEG adaptive transfer learning-based depression diagnosis and treatment system. The system acquires multi-channel EEG signals through a data preprocessing and quality control module, performing automated preprocessing and quality control to obtain target task data. An adaptive transfer learning module constructs a source model and a lightweight target model, establishing structural block matching pairs between the two models. Feature transfer weights and matching pair weights are introduced to construct a weighted feature matching loss. This loss is combined with task loss and contrastive learning loss for dual-layer optimization, enabling the target model to adaptively converge during the transfer process. Finally, a disease diagnosis and treatment prediction module achieves EEG-based prediction of depression, improving cross-center generalization performance and mitigating overfitting. Simultaneously, an interpretability analysis module analyzes the diagnosis and treatment-related results, identifying key features, key channels, and key brain regions that affect the prediction results, providing interpretable evidence for the model output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of deep learning and biomedicine, and in particular to a diagnostic and treatment system for depression that can interpret brain electrical adaptive transfer learning. Background Technology

[0002] Mental illnesses (such as depressive disorders, bipolar disorder, and schizophrenia spectrum disorders) are characterized by high prevalence, high relapse rates, and a heavy disability burden. They are often accompanied by widespread impairment of emotional, cognitive, and behavioral functions, and have become a significant factor affecting public health and socioeconomic status. In clinical practice, the diagnosis of mental illnesses mainly relies on symptomatological assessment and scale interviews, which are greatly affected by subjectivity, experience differences, and patient cooperation. Furthermore, significant heterogeneity exists among different patients, and comorbidities are complex, posing challenges to disease classification, efficacy prediction, and the development of individualized treatment plans. Therefore, there is an urgent need to develop quantifiable, reproducible, and early-change-sensitive objective biomarkers to aid in diagnosis, disease monitoring, and efficacy evaluation.

[0003] Electroencephalography (EEG) offers advantages such as being non-invasive, convenient, and having high temporal resolution. It can reflect the dynamic changes in brain neural network activity and is considered an important tool for exploring the neurophysiological mechanisms of mental illnesses and for clinical translational applications. However, EEG signals related to mental illnesses typically exhibit weak features, strong noise, significant inter-individual variability, and inconsistent acquisition conditions across centers. Furthermore, clinical data often has limited sample sizes and is class-imbalanced, leading to insufficient generalization ability of models based on traditional manual features or single-center training. This makes it difficult to stably transfer these models to different hospitals, devices, or populations. In recent years, the development of deep learning methods and pre-trained large-scale EEG models has provided new ideas for related research. However, in multi-center, small-sample scenarios, how to fully utilize the prior knowledge of large-scale EEG models and achieve effective transfer from large-scale EEG models as source models to lightweight target models remains one of the key issues driving the practical application and deployment of EEG-assisted diagnosis and treatment of mental illnesses. Summary of the Invention

[0004] The purpose of this invention is to provide an interpretable EEG adaptive transfer learning-based depression diagnosis and treatment system. This system uses a large pre-trained EEG model as the source model to provide general prior knowledge for diagnosis and treatment tasks. It also designs an adaptive transfer learning module, which constructs candidate matching pairs across model structural blocks and introduces a feature transfer weight network and a candidate matching pair transfer weight network to adaptively weight the feature dimension and matching relationship, so that the transfer loss is driven by the difference in data distribution and the task objective. This improves the learning ability under small sample conditions and the generalization performance in cross-center scenarios while ensuring the model's lightweightness and deployability. In this way, it can achieve efficient decoding and application of EEG signals for target tasks and is suitable for multi-center, non-independent, and identically distributed EEG tasks with small sample sizes.

[0005] To achieve the above objectives, the technical solution provided by this invention is: a depression diagnosis and treatment system capable of interpreting brainwave adaptive transfer learning, comprising:

[0006] The data preprocessing and quality control module is used to perform unified processing and standardized quality control on EEG data from different data centers and different acquisition devices, so as to output target EEG data that meets unified quality standards and construct a preprocessed EEG dataset.

[0007] The adaptive transfer learning module is used to build and train a lightweight target model, enabling adaptive feature transfer from the pre-trained source model to the target model of the downstream task, and automatically determining the transfer content and transfer strength, thereby steadily improving the learning effect and generalization performance of the target task in multi-center, cross-device, and cross-subject non-independent and identically distributed scenarios.

[0008] The disease diagnosis and treatment prediction module uses a lightweight target model to perform intelligent diagnosis and treatment of depression based on the input EEG data.

[0009] The interpretability analysis module is used to evaluate the interpretability of the output results of the disease diagnosis and treatment prediction module and analyze the results related to intelligent diagnosis and treatment of depression in order to identify key features, key channels and key brain regions that affect the prediction results, and provide interpretable basis for the model output.

[0010] Furthermore, the data preprocessing and quality control module includes a data loading module and a data preprocessing module, wherein:

[0011] The data loading module is used to read the acquired EEG signals from the local machine, including BDF, SET, and MAT formats;

[0012] The data preprocessing module is used to standardize and perform quality control on the collected EEG data for the target task, providing a consistent input basis for the subsequent adaptive transfer learning module. The preprocessing module performs processes including signal denoising filtering, rereference, baseline correction, artifact and abnormal segment removal, bad channel detection and repair, sample segmentation, and normalization to reduce the impact of cross-center acquisition differences and noise interference on model performance. Finally, the preprocessed EEG dataset is represented as follows:

[0013] ;

[0014] In the formula, This represents the preprocessed EEG dataset; Indicates the first Data sample of 1,000 subjects; They represent the first The number of slices, channels, and duration per subject Indicates the first The diagnosis and treatment labels corresponding to each subject.

[0015] Furthermore, the adaptive transfer learning module uses the preprocessed EEG dataset to train the target model. It constructs candidate matching pairs across model structural blocks and introduces a feature transfer weight network and a candidate matching pair transfer weight network to adaptively weight the feature dimension and matching relationship, ensuring the transfer loss is driven by both data distribution and the task objective. Then, through internal and external two-layer optimization, the target model, feature transfer weight network, and candidate matching pair transfer weight network are jointly updated, allowing the transfer process to adaptively converge during training. This suppresses negative transfer and overfitting introduced by noisy connections and irrelevant representations, resulting in a lightweight target model. The candidate matching pairs across model structural blocks refer to the structural blocks of the source model... The correspondence between the structural blocks of the building blocks and the structural blocks of the target model; the feature transfer weight network is composed of multi-layer fully connected neural networks and is used to calculate the feature transfer weights; the candidate matching pair transfer weight network is composed of multi-layer fully connected neural networks and is used to calculate the candidate matching pair transfer weights; the inner and outer dual-layer optimization joint update refers to the process of using a dual-layer optimization mechanism to collaboratively iteratively update the parameters of the target model, the feature transfer weight network, and the candidate matching pair transfer weight network, wherein the inner layer is used to optimize the target model, and the outer layer is used to optimize the feature transfer weight network and the candidate matching pair transfer weight network to achieve adaptive adjustment and convergence of the transfer; the source model is a large model pre-trained by EEG.

[0016] Furthermore, the adaptive transfer learning module performs the following operations:

[0017] a1. Based on the structure blocks of the source model and the target model, construct candidate matching pairs between structure blocks of different models:

[0018] ;

[0019] In the formula, This represents candidate matching pairs between structural blocks of the source and target models; and These represent the sets of convolutional structure blocks in the source and target models that can be used for transfer learning, respectively. Represents the structural blocks of the source model Structural blocks of the target model A set of candidate matching pairs, To match the feasibility judgment function, used to filter structurally reasonable combinations; These are the structure block numbers of the source model and the target model, respectively. Represent the source model and the target model, respectively;

[0020] b1. Calculation Feature differences of each candidate matching pair:

[0021] ;

[0022] In the formula, Representing different structural blocks , The difference measure at the feature level is used to subsequently construct the feature matching loss and constrain the cross-structure transfer process; For the dimension mapping function of bilinear interpolation; In the source model, the first Each structural block outputs features as source features. In the target model, the first Each structural block outputs the target feature. This represents the Frobenius norm, used to construct feature matching distances;

[0023] c1. Construction of feature transfer weights and candidate matching pair transfer weights:

[0024] ;

[0025] In the formula, Indicates the first from the source model The first structural block is migrated to the target model. Feature transfer weights for each structural block; Indicates the first from the source model The first structural block is migrated to the target model. Transition weights for candidate matching pairs of each structural block; For feature transfer weight network, by Composed of fully connected neural networks, using activation functions. Used to calculate feature transfer weights; For candidate matching pairs, the transfer weight network is formed by... Composed of fully connected neural networks, using activation functions. Used to calculate the migration weights of candidate matching pairs;

[0026] d1. Construction of the adaptive transfer learning loss term:

[0027] ;

[0028] In the formula, This is the adaptive transfer learning loss term; This indicates a weighted calculation based on channel and element. Denotes the Frobenius norm; Indicates the index of the feature map element of the source model and the target model; and express and Model parameters; This represents a single input sample in the preprocessed EEG dataset; Represents the parameters of the target model;

[0029] e1. Construction of loss term based on enhanced sample contrast learning:

[0030] Contrastive learning loss constructs positive and negative sample pairs through noise enhancement. Specifically, Gaussian noise is superimposed on any sample to generate an enhanced sample, thus forming a positive sample pair semantically consistent with the original sample. This enhanced sample is then paired with samples from other categories to form a negative sample pair. The generation process of this enhanced sample is represented as follows:

[0031] ;

[0032] In the formula, Noise term; Indicates a Gaussian distribution. and Let represent the expectation and variance of the Gaussian distribution, respectively. This represents the generated augmented sample;

[0033] Based on the positive and negative sample pairs, the contrastive learning loss is calculated using the contrastive learning objective function, and the contrastive learning loss term is expressed as:

[0034] ;

[0035] In the formula, This represents the contrastive learning loss term; and Representing samples respectively and enhanced samples The feature vector output by the target model For the first Characterization of a negative sample, The number of negative samples generated; For similarity function, Temperature coefficient; Represents the natural exponential function;

[0036] f1. Construction of the overall loss term:

[0037] ;

[0038] In the formula, Represents the total loss item; The task loss function is denoted as ; when the task is diagnostic classification, the task loss function is the cross-entropy loss function; when the task is efficacy prediction regression, the task loss function is the mean squared error loss function. , which are weighting coefficients used to balance the impact of contrastive learning constraints and adaptive transfer learning constraints on the overall training objective;

[0039] g1. Internal and external dual-layer optimization strategy:

[0040] A dual-layer optimization and joint update mechanism is constructed to alternately update the target model parameters and the parameters of the transfer weight generation network in stages, so as to achieve collaborative adaptive optimization of the transfer and target tasks.

[0041] Inner layer optimization: The target model parameters are updated using joint loss, i.e., the parameter updates of the target model are driven by a joint combination of task loss, contrastive learning loss, and adaptive transfer learning loss; the inner layer optimization process is a transfer reinforcement update process, represented as:

[0042] ;

[0043] In the formula, , They represent the target model's first... The parameters are updated in the next iteration; The learning rate during the transfer phase; express and Model parameters; This indicates the current inner optimization round. This represents the total number of optimization iterations for the inner layer. Indicates the parameters of the target model The gradient;

[0044] Outer layer optimization: Update the feature transfer weight network in reverse with the final task loss. Transfer weight network with candidate matching pairs After completing the above After the migration reinforcement update, use the updated target model parameters. The parameters of the weight generation network are updated in reverse; the outer layer optimization process is represented as:

[0045] ;

[0046] In the formula , They represent the first The next iteration Model parameters; , They represent the first The next iteration Model parameters; through the above outer layer update, the transfer strength of each feature dimension and each candidate matching pair will be adaptively adjusted to achieve adaptive convergence of automatically determining the content and transfer strength of the target model from the source model.

[0047] h1. Use backpropagation to train the model and obtain a lightweight target model for intelligent diagnosis and treatment of depression.

[0048] Furthermore, the disease diagnosis and treatment prediction module performs the following operations:

[0049] a2. Use the data preprocessing and quality control module to preprocess and control the quality of the EEG data of the depressed subjects to be tested, and obtain the preprocessed EEG data to be tested.

[0050] b2. Input the preprocessed EEG data to be tested into the lightweight target model obtained by the adaptive transfer learning module to perform intelligent diagnosis and prediction of depression.

[0051] Furthermore, the interpretability analysis module performs the following operations:

[0052] a3. Input the preprocessed EEG data to be tested into the lightweight target model obtained by the adaptive transfer learning module to extract the deep learning feature file of the EEG data to be tested;

[0053] b3. Combine the deep learning feature file with the preprocessed EEG data to be tested, and calculate the multi-band power spectral density energy respectively.

[0054] c3. Divide the electrode channels into multiple functional zones according to the mapping relationship between brain region functions and electrode regions; calculate the Pearson correlation coefficient between brain regions based on the characteristics of multi-band power spectral density energy of each brain region and generate a correlation heatmap to characterize the functional connectivity and synergistic relationship between brain regions, thereby providing interpretable basis for the model output results.

[0055] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0056] 1. A large EEG pre-trained model is introduced as the source model, and adaptive transfer is performed in the target model. This enables the model to still have good fitting and generalization ability under the conditions of limited sample size and significant individual differences, thus alleviating overfitting on small samples.

[0057] 2. Based on the structure blocks of the source model and the target model, a set of matching pairs between different models is constructed, and the matching weights are learned. Addressing the issue of non-independent and identically distributed migration caused by differences in equipment parameters, data collection paradigms, and population distribution among different institutions, adaptive selection of migration location and migration intensity is achieved, reducing the negative migration risk caused by hard matching and improving cross-center migration performance.

[0058] 3. The target model is jointly updated by inner and outer two-layer optimization, and the prior constraints are enhanced by multiple reinforcement updates of only transfer loss; the outer layer updates the feature transfer weight network and candidate matching pair transfer weight network parameters in reverse with the final task loss, so as to achieve adaptive convergence of transfer based on task performance, improve training stability and take into account the diagnostic performance of the target task.

[0059] 4. While outputting diagnostic labels or efficacy prediction scores, the model combines visualization results such as multi-band power spectral density energy characteristics, topographic maps, and brain region connectivity correlation heatmaps to provide explanatory evidence at the brain region network level. This makes the model conclusions traceable, helps medical personnel understand the formation principle of disease diagnosis and treatment results, and also facilitates further verification of the results. Attached Figure Description

[0060] Figure 1 This is a diagram showing the relationships between the modules of the system of this invention.

[0061] Figure 2 This is a flowchart illustrating the specific execution process of the system of this invention. Where: r represents the Pearson correlation coefficient between the actual efficacy score and the predicted efficacy score; AUC represents the area under the receiver operating characteristic curve, used to characterize the overall classification performance of the model; PSD represents the power spectral density energy feature; Labram is the source model (specifically, a large model pre-trained by EEG); Mshllownet is the lightweight target model (specifically, a convolutional neural network).

[0062] Figure 3 This is a schematic diagram of the data preprocessing and quality control interactive interface developed for this invention.

[0063] Figure 4 This is an architecture diagram of the adaptive transfer learning module. Where: Linear represents a fully connected neural network; Softmax and ReLU represent activation functions.

[0064] Figure 5 This is a schematic diagram of a set of diagnostic and therapeutic effect prediction results provided by the present invention. Detailed Implementation

[0065] 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.

[0066] like Figures 1 to 5 As shown, this embodiment discloses a depression diagnosis and treatment system with interpretable EEG adaptive transfer learning. Developed using Python and Matlab, this system can run on Windows devices and includes the following functional modules:

[0067] The data preprocessing and quality control module is used to perform unified processing and standardized quality control on EEG data from different data centers and different acquisition devices, so as to output target EEG data that meets unified quality standards and construct a preprocessed EEG dataset.

[0068] An adaptive transfer learning module is used to construct and train a lightweight target model, enabling adaptive feature transfer from the pre-trained source model to the target model of the downstream task. It automatically determines the transfer content and intensity, thereby stably improving the learning effect and generalization performance of the target task in multi-center, cross-device, and cross-subject non-independent and identically distributed scenarios. The module uses a pre-processed EEG dataset for target model training. It constructs candidate matching pairs across model structural blocks and introduces a feature transfer weight network and a candidate matching pair transfer weight network, adaptively weighting the feature dimension and matching relationship respectively, so that the transfer loss is driven by both data distribution and task objectives. Then, through internal and external two-layer optimization, it jointly updates the target model, the feature transfer weight network, and the candidate matching pair transfer weight network, making the transfer process adaptively converge with training. The method suppresses negative transfer and overfitting introduced by noisy connections and irrelevant representations, and obtains a lightweight target model. The candidate matching pairs across model blocks refer to the correspondence between blocks of the source model and blocks of the target model. The feature transfer weight network consists of a multi-layer fully connected neural network used to calculate feature transfer weights. The candidate matching pair transfer weight network also consists of a multi-layer fully connected neural network used to calculate candidate matching pair transfer weights. The joint update of inner and outer dual-layer optimization refers to the process of collaboratively iteratively updating the parameters of the target model, the feature transfer weight network, and the candidate matching pair transfer weight network using a dual-layer optimization mechanism. The inner layer optimizes the target model, and the outer layer optimizes the feature transfer weight network and the candidate matching pair transfer weight network to achieve adaptive adjustment and convergence of the transfer. The source model is a large model pre-trained with EEG.

[0069] The disease diagnosis and treatment prediction module uses a lightweight target model to perform intelligent diagnosis and treatment of depression based on the input EEG data.

[0070] The interpretability analysis module is used to evaluate the interpretability of the output results of the disease diagnosis and treatment prediction module and analyze the results related to intelligent diagnosis and treatment of depression in order to identify key features, key channels and key brain regions that affect the prediction results, and provide interpretable basis for the model output.

[0071] Specifically, the data preprocessing and quality control module includes a data loading module and a data preprocessing module, wherein:

[0072] The data loading module is used to read the acquired EEG signals from the local machine, including BDF, SET, and MAT formats;

[0073] The data preprocessing module is used to standardize and quality control the collected EEG data for the target task, providing a consistent and reliable input foundation for the subsequent adaptive transfer learning module. The preprocessing module performs processes including signal denoising filtering, rereference, baseline correction, artifact and abnormal segment removal, bad channel detection and repair, sample segmentation, and normalization to reduce the impact of cross-center acquisition differences and noise interference on model performance. Finally, the preprocessed EEG dataset is represented as follows:

[0074] ;

[0075] In the formula, This represents the preprocessed EEG dataset; Indicates the first Data sample of 1,000 subjects; They represent the first The number of slices, channels, and duration per subject Indicates the first The diagnosis and treatment labels corresponding to each subject.

[0076] The specific process and configuration are as follows: An automated processing system is built based on Matlab 2024b and EEGLAB 2024 to perform standardized preprocessing and consistency quality control on EEG data collected from multiple centers, outputting target task data that can be used for model training and inference. The parameters for the data preprocessing section are set as follows: the original EEG signal is uniformly downsampled to 250 Hz; the downsampled signal is subjected to 1–95 Hz bandpass filtering to suppress low-frequency drift and high-frequency noise, and power frequency notch filtering is performed according to the actual power supply environment; further peak threshold detection is performed, with the threshold set to 100. When an EEG segment exhibits abnormal fluctuations exceeding a certain threshold in any channel, the corresponding segment is marked as abnormal for subsequent bad segment removal. Simultaneously, EEG bad channel detection and removal are performed, with an upper limit of 5 bad channel detections to avoid a small number of channels with poor contact significantly impacting the overall signal quality. After the above preprocessing, the continuous signal is divided into epochs, with the epoch division window width set to 1 second. Bad segment screening and quality statistics are performed on the epoch samples, preferably setting a threshold of 30% for the proportion of bad segments in the total sample. When the proportion of bad segments in a subject or a central dataset exceeds this threshold, it is determined to not meet the quality control standards and is marked or removed.

[0077] Specifically, the adaptive transfer learning module performs the following operations:

[0078] a1. Based on the structure blocks of the source model and the target model, construct candidate matching pairs between structure blocks of different models:

[0079] ;

[0080] In the formula, This represents candidate matching pairs between structural blocks of the source and target models; and These represent the sets of convolutional structure blocks in the source and target models that can be used for transfer learning, respectively. Represents the structural blocks of the source model Structural blocks of the target model A set of candidate matching pairs, To match the feasibility judgment function, used to filter structurally reasonable combinations; These are the structure block numbers of the source model and the target model, respectively. Represent the source model and the target model, respectively;

[0081] b1. Calculation Feature differences of each candidate matching pair:

[0082] ;

[0083] In the formula, Representing different structural blocks , The difference measure at the feature level is used to subsequently construct the feature matching loss and constrain the cross-structure transfer process; For the dimension mapping function of bilinear interpolation; In the source model, the first Each structural block outputs features as source features. In the target model, the first Each structural block outputs the target feature. This represents the Frobenius norm, used to construct feature matching distances;

[0084] c1. Construction of feature transfer weights and candidate matching pair transfer weights:

[0085] ;

[0086] In the formula, Indicates the first from the source model The first structural block is migrated to the target model. Feature transfer weights for each structural block; Indicates the first from the source model The first structural block is migrated to the target model. Transition weights for candidate matching pairs of each structural block; For feature transfer weight network, by Composed of fully connected neural networks, using activation functions. Used to calculate feature transfer weights; For candidate matching pairs, the transfer weight network is formed by... Composed of fully connected neural networks, using activation functions. Used to calculate the migration weights of candidate matching pairs;

[0087] d1. Construction of the adaptive transfer learning loss term:

[0088] ;

[0089] In the formula, This is the adaptive transfer learning loss term; This indicates a weighted calculation based on channel and element. Denotes the Frobenius norm; Indicates the index of the feature map element of the source model and the target model; and express and Model parameters; This represents a single input sample in the preprocessed EEG dataset; Represents the parameters of the target model;

[0090] e1. Construction of loss term based on enhanced sample contrast learning:

[0091] Contrastive learning loss constructs positive and negative sample pairs through noise enhancement. Specifically, Gaussian noise is superimposed on any sample to generate an enhanced sample, thus forming a positive sample pair semantically consistent with the original sample. This enhanced sample is then paired with samples from other categories to form a negative sample pair. The generation process of this enhanced sample is represented as follows:

[0092] ;

[0093] In the formula, Noise term; Indicates a Gaussian distribution. and Let represent the expectation and variance of the Gaussian distribution, respectively. This represents the generated augmented sample;

[0094] Based on the positive and negative sample pairs, the contrastive learning loss is calculated using the contrastive learning objective function, and the contrastive learning loss term is expressed as:

[0095] ;

[0096] In the formula, This represents the contrastive learning loss term; and Representing samples respectively and enhanced samples The feature vector output by the target model For the first Characterization of a negative sample, The number of negative samples generated; For similarity function, Temperature coefficient; Represents the natural exponential function;

[0097] f1. Construction of the overall loss term:

[0098] ;

[0099] In the formula, Represents the total loss item; The task loss function is denoted as ; when the task is diagnostic classification, the task loss function is the cross-entropy loss function; when the task is efficacy prediction regression, the task loss function is the mean squared error loss function. , which are weighting coefficients used to balance the impact of contrastive learning constraints and adaptive transfer learning constraints on the overall training objective;

[0100] g1. Internal and external dual-layer optimization strategy:

[0101] A dual-layer optimization and joint update mechanism is constructed to alternately update the target model parameters and the parameters of the transfer weight generation network in stages, so as to achieve collaborative adaptive optimization of the transfer and target tasks.

[0102] Inner layer optimization: The target model parameters are updated using joint loss, i.e., the parameter updates of the target model are driven by a joint combination of task loss, contrastive learning loss, and adaptive transfer learning loss; the inner layer optimization process is a transfer reinforcement update process, represented as:

[0103] ;

[0104] In the formula, , They represent the target model's first... The parameters are updated in the next iteration; The learning rate during the transfer phase; express and Model parameters; This indicates the current inner optimization round. This represents the total number of optimization iterations for the inner layer. Indicates the parameters of the target model The gradient;

[0105] Outer layer optimization: Update the feature transfer weight network in reverse with the final task loss. Transfer weight network with candidate matching pairs After completing the above After the migration reinforcement update, use the updated target model parameters. The parameters of the weight generation network are updated in reverse; the outer layer optimization process is represented as:

[0106] ;

[0107] In the formula , They represent the first The next iteration Model parameters; , They represent the first The next iteration Model parameters; through the above outer layer update, the transfer strength of each feature dimension and each candidate matching pair will be adaptively adjusted to achieve adaptive convergence of automatically determining the content and transfer strength of the target model from the source model.

[0108] h1. Use backpropagation to train the model and obtain a lightweight target model for intelligent diagnosis and treatment of depression.

[0109] The specific process and configuration are as follows: Based on the preprocessed EEG dataset output by the data preprocessing and quality control modules, the source model Labram and the target model Mshllownet are respectively called to perform multi-layer feature extraction on the EEG signals. The source model Labram is loaded with pre-trained parameters and is in a frozen state to provide general prior features; the target model Mshllownet is a trainable lightweight network structure used to complete the discrimination and prediction of the target task. Furthermore, a cross-structure candidate matching pair set is constructed between the source and target models, and a learnable feature transfer weight and matching pair transfer weight generation mechanism is introduced. Adaptive weighting is applied to different matching pairs and different feature channels, thereby forming adaptive transfer across structural blocks. This allows the prior features of the source model Labram to be effectively transferred to the target model Mshllownet in a selective manner, and suppresses the impact of ineffective or negative transfer on the performance of the target task.

[0110] After training, the lightweight target model Mshllownet, obtained through transfer learning, is output. It then performs data-to-output inference based on the target task type: when the target task is the diagnosis of mental illness, the target model outputs the subject's diagnostic category label; when the target task is efficacy prediction, the target model outputs the corresponding efficacy prediction score. This invention can improve the model's generalization ability and edge deployment in multi-center, small-sample scenarios, providing clinicians with objective auxiliary decision-making basis based on EEG signals, thereby improving the efficiency and consistency of diagnosis and efficacy evaluation for depression. Figure 5 This invention provides a set of diagnostic and efficacy prediction results. The hyperparameter configurations are shown in Table 1 below:

[0111]

[0112] Specifically, the disease diagnosis and treatment prediction module performs the following operations:

[0113] a2. Use the data preprocessing and quality control module to preprocess and control the quality of the EEG data of the depressed subjects to be tested, and obtain the preprocessed EEG data to be tested.

[0114] b2. Input the preprocessed EEG data to be tested into the lightweight target model obtained by the adaptive transfer learning module to perform intelligent diagnosis and prediction of depression.

[0115] Specifically, the interpretability analysis module performs the following operations:

[0116] a3. Input the preprocessed EEG data to be tested into the lightweight target model obtained by the adaptive transfer learning module to extract the deep learning feature file of the EEG data to be tested;

[0117] b3. Combine the deep learning feature file with the preprocessed EEG data to be tested, and calculate the multi-band power spectral density energy respectively.

[0118] c3. Divide the electrode channels into multiple functional zones according to the mapping relationship between brain region functions and electrode regions; calculate the Pearson correlation coefficient between brain regions based on the characteristics of multi-band power spectral density energy of each brain region and generate a correlation heatmap to characterize the functional connectivity and synergistic relationship between brain regions, thereby providing interpretable basis for the model output results.

[0119] The specific process and configuration are as follows: Based on the trained lightweight target model, inference from input to output is performed on the preprocessed EEG data to be tested. Target model features corresponding to each structural block of the lightweight target model are extracted. Power spectral density energy features are calculated for both the preprocessed EEG data to be tested and the target model features to establish a mapping relationship between target model features and spectral energy. Then, electrode channels are reordered and grouped according to the mapping relationship between brain region function and electrode region, mapping the channel set to multiple brain region functional areas. Power spectral density energy features are then converged at the brain region level to form brain region-level feature vectors, thereby constructing a brain region network representation. Subsequently, the Pearson correlation coefficient between any two brain region feature vectors is calculated to obtain the brain region functional connectivity matrix, which is output as a heatmap. Simultaneously, the power spectral density energy features of each channel or frequency band are spatially visualized using EEG signal topography. Through the above configuration, explanations of brain region connectivity and spatial distribution can be provided simultaneously with the output of diagnostic labels or efficacy prediction scores, providing traceable neurophysiological evidence for model decision-making and improving clinical interpretability.

[0120] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A diagnostic and treatment system for depression that can interpret adaptive transfer learning based on brain electrical activity, characterized in that, include: The data preprocessing and quality control module is used to perform unified processing and standardized quality control on EEG data from different data centers and different acquisition devices, so as to output target EEG data that meets unified quality standards and construct a preprocessed EEG dataset. The adaptive transfer learning module is used to build and train a lightweight target model, enabling adaptive feature transfer from the pre-trained source model to the target model of the downstream task, and automatically determining the transfer content and transfer strength, thereby steadily improving the learning effect and generalization performance of the target task in multi-center, cross-device, and cross-subject non-independent and identically distributed scenarios. The disease diagnosis and treatment prediction module uses a lightweight target model to perform intelligent diagnosis and treatment of depression based on the input EEG data. The interpretability analysis module is used to evaluate the interpretability of the output results of the disease diagnosis and treatment prediction module and analyze the results related to intelligent diagnosis and treatment of depression in order to identify key features, key channels and key brain regions that affect the prediction results, and provide interpretable basis for the model output.

2. The depression diagnosis and treatment system with interpretable brainwave adaptive transfer learning according to claim 1, characterized in that, The data preprocessing and quality control module includes a data loading module and a data preprocessing module, wherein: The data loading module is used to read the acquired EEG signals from the local machine, including BDF, SET, and MAT formats; The data preprocessing module is used to standardize and perform quality control on the collected EEG data for the target task, providing a consistent input basis for the subsequent adaptive transfer learning module. The preprocessing module performs processes including signal denoising filtering, rereference, baseline correction, artifact and abnormal segment removal, bad channel detection and repair, sample segmentation, and normalization to reduce the impact of cross-center acquisition differences and noise interference on model performance. Finally, the preprocessed EEG dataset is represented as follows: ; In the formula, This represents the preprocessed EEG dataset; Indicates the first Data sample of 1,000 subjects; They represent the first The number of slices, channels, and duration per subject Indicates the first The diagnosis and treatment labels corresponding to each subject.

3. The depression diagnosis and treatment system with interpretable brainwave adaptive transfer learning according to claim 1, characterized in that, The adaptive transfer learning module uses the preprocessed EEG dataset to train the target model. It constructs candidate matching pairs across model structural blocks and introduces a feature transfer weight network and a candidate matching pair transfer weight network to adaptively weight the feature dimension and matching relationship, so that the transfer loss is driven by both the data distribution and the task objective. Then, by jointly updating the target model, feature transfer weight network and candidate matching pair transfer weight network through inner and outer double-layer optimization, the transfer process is made to converge adaptively with training, thereby suppressing negative transfer and overfitting introduced by noisy connections and irrelevant representations, and obtaining a lightweight target model. The candidate matching pair across model blocks refers to the correspondence between the structural blocks of the source model and the structural blocks of the target model; The feature transfer weight network consists of a multi-layer fully connected neural network used to calculate feature transfer weights; The candidate matching pair transfer weight network consists of a multi-layer fully connected neural network and is used to calculate the candidate matching pair transfer weights. The aforementioned dual-layer optimization joint update refers to the process of collaboratively iteratively updating the parameters of the target model, the feature transfer weight network, and the candidate matching pair transfer weight network using a dual-layer optimization mechanism. The inner layer is used to optimize the target model, while the outer layer is used to optimize the feature transfer weight network and the candidate matching pair transfer weight network to achieve adaptive adjustment and convergence of the transfer. The source model is a large model pre-trained by EEG.

4. The depression diagnosis and treatment system with interpretable brainwave adaptive transfer learning according to claim 3, characterized in that, The adaptive transfer learning module performs the following operations: a1. Based on the structure blocks of the source model and the target model, construct candidate matching pairs between structure blocks of different models: ; In the formula, This represents candidate matching pairs between structural blocks of the source and target models; and These represent the sets of convolutional structure blocks in the source and target models that can be used for transfer learning, respectively. Represents the structural blocks of the source model Structural blocks of the target model A set of candidate matching pairs, To match the feasibility judgment function, used to filter structurally reasonable combinations; These are the structure block numbers of the source model and the target model, respectively. Represent the source model and the target model, respectively; b1. Calculation Feature differences of each candidate matching pair: ; In the formula, Representing different structural blocks , The difference measure at the feature level is used to subsequently construct the feature matching loss and constrain the cross-structure transfer process; For the dimension mapping function of bilinear interpolation; In the source model, the first Each structural block outputs features as source features. In the target model, the first Each structural block outputs the target feature. This represents the Frobenius norm, used to construct feature matching distances; c1. Construction of feature transfer weights and candidate matching pair transfer weights: ; In the formula, Indicates the first from the source model The first structural block is migrated to the target model. Feature transfer weights for each structural block; Indicates the first from the source model The first structural block is migrated to the target model. Transition weights for candidate matching pairs of each structural block; For feature transfer weight network, by Composed of fully connected neural networks, using activation functions. Used to calculate feature transfer weights; For candidate matching pairs, the transfer weight network is formed by... Composed of fully connected neural networks, using activation functions. Used to calculate the migration weights of candidate matching pairs; d1. Construction of the adaptive transfer learning loss term: ; In the formula, This is the adaptive transfer learning loss term; This indicates a weighted calculation based on channel and element. Denotes the Frobenius norm; Indicates the index of the feature map element of the source model and the target model; and express and Model parameters; This represents a single input sample in the preprocessed EEG dataset; Represents the parameters of the target model; e1. Construction of loss term based on enhanced sample contrast learning: Contrastive learning loss constructs positive and negative sample pairs through noise enhancement. Specifically, Gaussian noise is superimposed on any sample to generate an enhanced sample, thus forming a positive sample pair semantically consistent with the original sample. This enhanced sample is then paired with samples from other categories to form a negative sample pair. The generation process of this enhanced sample is represented as follows: ; In the formula, Noise term; Indicates a Gaussian distribution. and Let represent the expectation and variance of the Gaussian distribution, respectively. This represents the generated augmented sample; Based on the positive and negative sample pairs, the contrastive learning loss is calculated using the contrastive learning objective function, and the contrastive learning loss term is expressed as: ; In the formula, This represents the contrastive learning loss term; and Representing samples respectively and enhanced samples The feature vector output by the target model For the first Characterization of a negative sample, The number of negative samples generated; For similarity function, Temperature coefficient; Represents the natural exponential function; f1. Construction of the overall loss term: ; In the formula, Represents the total loss item; The task loss function is denoted as ; when the task is diagnostic classification, the task loss function is the cross-entropy loss function; when the task is efficacy prediction regression, the task loss function is the mean squared error loss function. , which are weighting coefficients used to balance the impact of contrastive learning constraints and adaptive transfer learning constraints on the overall training objective; g1. Internal and external dual-layer optimization strategy: A dual-layer optimization and joint update mechanism is constructed to alternately update the target model parameters and the parameters of the transfer weight generation network in stages, so as to achieve collaborative adaptive optimization of the transfer and target tasks. Inner layer optimization: The target model parameters are updated using joint loss, i.e., the parameter updates of the target model are driven by a joint combination of task loss, contrastive learning loss, and adaptive transfer learning loss; the inner layer optimization process is a transfer reinforcement update process, represented as: ; In the formula, , They represent the target model's first... The parameters are updated in the next iteration; The learning rate during the transfer phase; express and Model parameters; This indicates the current inner optimization round. This represents the total number of optimization iterations for the inner layer. Indicates the parameters of the target model The gradient; Outer layer optimization: Update the feature transfer weight network in reverse with the final task loss. Transfer weight network with candidate matching pairs After completing the above After the migration reinforcement update, use the updated target model parameters. The parameters of the weight generation network are updated in reverse; the outer layer optimization process is represented as: ; In the formula , They represent the first The next iteration Model parameters; , They represent the first The next iteration Model parameters; through the above outer layer update, the transfer strength of each feature dimension and each candidate matching pair will be adaptively adjusted to achieve adaptive convergence of automatically determining the content and transfer strength of the target model from the source model. h1. Use backpropagation to train the model and obtain a lightweight target model for intelligent diagnosis and treatment of depression.

5. A depression diagnosis and treatment system capable of interpreting brainwave adaptive transfer learning according to claim 1, characterized in that, The disease diagnosis and treatment prediction module performs the following operations: a2. Use the data preprocessing and quality control module to preprocess and control the quality of the EEG data of the depressed subjects to be tested, and obtain the preprocessed EEG data to be tested. b2. Input the preprocessed EEG data to be tested into the lightweight target model obtained by the adaptive transfer learning module to perform intelligent diagnosis and prediction of depression.

6. A depression diagnosis and treatment system capable of interpreting brainwave adaptive transfer learning according to claim 5, characterized in that, The interpretability analysis module performs the following operations: a3. Input the preprocessed EEG data to be tested into the lightweight target model obtained by the adaptive transfer learning module to extract the deep learning feature file of the EEG data to be tested; b3. Combine the deep learning feature file with the preprocessed EEG data to be tested, and calculate the multi-band power spectral density energy respectively. c3. Divide the electrode channels into multiple functional zones according to the mapping relationship between brain region functions and electrode regions; calculate the Pearson correlation coefficient between brain regions based on the characteristics of multi-band power spectral density energy of each brain region and generate a correlation heatmap to characterize the functional connectivity and synergistic relationship between brain regions, thereby providing interpretable basis for the model output results.