Domain-adaptive tinnitus classification method and classification system based on adversarial training
Through the domain adaptive method of adversarial training, the pre-trained timing Transformer model extracts tinnitus signal characteristics and performs domain adaptive training, solving the problem of data scarcity and diversity in the field of tinnitus health, and improving the generalization ability and diagnostic efficiency of the model.
Patent Information
- Application Number
- CN202510072755.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-01-17
AI Technical Summary
The data in the medical and health field are complex and diverse. Traditional analysis methods face difficulties in feature extraction, sparse data and difficulty in field migration. Especially in the tinnitus health field, data labeling is scarce and diversity leads to insufficient generalization capabilities of models.
Adversarial training-based domain adaptive method is adopted, and feature information is extracted using a pre-trained timing Transformer model, and input features are distinguished from source and target fields through adversarial training. Gradient inversion layer is used to enable feature extractors to learn common features that are not affected by the domain.
It effectively reduces the need for large-scale annotation of data and improves the diagnostic and treatment capabilities of medical intelligent systems in the classification of tinnitus.
Smart Images

Figure CN119989085B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical technology, and in particular to a domain-adaptive tinnitus classification method and classification system based on adversarial training. Background Art
[0002] With the rapid development of artificial intelligence and deep learning technologies, particularly the emergence of the Transformer architecture and large-scale pre-trained models, deep learning has achieved remarkable progress in fields such as natural language processing (NLP) and computer vision (CV). These technologies have also brought new opportunities to the healthcare sector. With the increasing abundance of healthcare data, including patient health records, medical imaging, genomic data, and laboratory test results, effectively extracting and applying knowledge from this data to aid diagnosis has become a key research focus. Leveraging the Transformer architecture for multi-task learning and cross-domain transfer learning is an effective approach to improving model performance and handling diverse data.
[0003] However, data in the healthcare sector is complex and diverse, and traditional analysis methods face challenges such as difficulty in feature extraction, data sparsity, and domain migration. Due to the domain-specific nature of medical data, cross-domain and cross-task knowledge sharing and migration have become key issues. Pre-trained downstream task technologies have become an important component of deep learning applications, especially in auxiliary diagnosis in the healthcare sector. Pre-trained models can effectively improve generalization capabilities and data utilization efficiency. Combining pre-training technology with downstream tasks can not only achieve excellent performance on limited medical data, but also provide efficient and accurate support for clinical decision-making.
[0004] Domain adaptation, as an important method of transfer learning, aims to transfer knowledge learned in the source domain (such as common disease datasets) to the target domain (such as specific patient groups or scarce disease datasets). It improves the generalization ability of the model in the target domain by reducing the distribution differences between domains. Given that medical data often have distribution differences between the source domain and the target domain, domain adaptation technology has important practical significance in the field of medical health. Adversarial training enhances the robustness of the model to uncertainty, noise and domain differences by introducing an adversarial learning process. In the adversarial training of the feature extractor and the domain discriminator, the feature extractor can learn more general features, thereby realizing knowledge transfer. Especially in the field of tinnitus health, the scarcity of data annotations and the diversity of sources enable adversarial training to effectively improve the generalization ability of the model and reduce the distribution deviation between domains, providing a solid technical background for the development of domain-adaptive tinnitus classification methods based on adversarial training. Summary of the Invention
[0005] In response to the problems of complex and diverse data in the field of tinnitus health, scarcity of medical data, and cross-domain data training, the present invention provides a domain-adaptive tinnitus classification method and classification system based on adversarial training.
[0006] In order to achieve the above-mentioned purpose, the technical solution adopted by the present invention is:
[0007] The present invention discloses a domain-adaptive tinnitus classification method based on adversarial training, comprising the following steps:
[0008] Acquire an experimental time series signal, and use a pre-trained time series Transformer model as a feature extractor to extract feature information from the experimental time series signal to capture long-range dependencies in the experimental time series signal; wherein the feature information includes time series features;
[0009] Passing the extracted feature information to a task classifier to perform downstream tasks; wherein the downstream tasks include classification of tinnitus grading tasks;
[0010] While performing downstream tasks, adversarial training is used to distinguish the input features of the source and target domains, allowing for domain-adaptive training. This allows the feature extractor to learn feature information that is not affected by the domain. The domain-adaptive training process includes a pre-training phase and an adversarial training phase.
[0011] Finally, the downstream task results are obtained through the domain adaptation framework of pre-training adversarial training.
[0012] Furthermore, a pre-trained time series Transformer model is used as a feature extractor to extract feature information from the experimental time series signal, specifically:
[0013] The input timing signal is converted into d through a linear mapping model dimensional vector, and input the original input sequence X, as a feature extractor to extract feature information from the time series signal;
[0014] The self-attention mechanism is used to calculate the relationship between each time step and all other time steps, and multiple attention heads are used to process different attention subspaces in parallel;
[0015] Assuming there are h attention heads, the output of each attention head is expressed as:
[0016]
[0017] Where A h represents the output of the h-th attention head; Q h ,K h ,V hdenote the query vector, key vector, and value vector of the h-th attention head respectively; d model Refers to the dimension of the model; T represents transposition; Attention is the attention function;
[0018] Then, the outputs of the h attention heads are concatenated and mapped back to d through a linear layer. model dimension:
[0019] MultiHead(Q,K,V)=Concat(A1,A2,···,A h )W O
[0020] Where Q, K, and V are the set of query vectors, key vectors, and value vectors, respectively; A1 is the output of the first attention head; A2 is the output of the second attention head; A h is the output of the h-th attention head; Concat represents the concatenation operation, W O is the output weight matrix, used to map the concatenated result back to d model ; MultiHead(Q,K,V) represents the overall output of the multi-attention head mechanism;
[0021] Then, two linear transformations and an activation function are input into the residual connection and layer normalization layer through the feedforward neural network to prevent the gradient from disappearing. The formula is as follows:
[0022]
[0023] Where FFN(x) is the output of the feedforward neural network; x is the vector input to the feedforward neural network;
[0024] W1, b1 are the weight and bias of the first linear transformation respectively; W2, b2 are the weight and bias of the second linear transformation respectively; X attn represents the output after the attention mechanism calculation; LayerNorm is the layer normalization function; X is the original input; MultiHead(Q,K,V) represents the overall output of the multi-attention head mechanism; X ffn is the final output after being processed by the feedforward neural network; X attn is the intermediate result after attention mechanism and layer normalization; FFN(X attn ) is for X attn Results of applying a feedforward neural network.
[0025] Furthermore, in order to enable the Transformer model to perceive the information of each position in the input sequence X, position encoding is added. Sine and cosine functions are used to define and add a vector P related to its position. The position encoding is added to the input embedding to obtain an input representation with position encoding:
[0026] X pos =X+P
[0027] Where, X pos represents the input representation after adding position encoding; X represents the original input sequence; P represents the position encoding vector, which is calculated by sine and cosine functions and corresponds to each position, and is used to add position-related information to the input.
[0028] Furthermore, the training of the temporal Transformer model is optimized by minimizing the loss function;
[0029] If the target is Y, the model output is Then the loss function is:
[0030]
[0031] Where, Represents the total loss value; N is the number of samples; i represents the sample index; Y i Represents the true target value of the i-th sample; Represents the model's predicted output for the i-th sample; c is the category index; Y i,c represents the true label of the i-th sample in category c; log is the logarithmic function; Represents the model's predicted probability for the i-th sample in category c; Represents the loss value of the i-th sample.
[0032] Furthermore, the domain adaptive training process includes:
[0033] Train the source domain task classifier: Use the source domain data to train the task classifier so that it can perform task predictions;
[0034] Training domain discriminator: Use the features of the source domain and the target domain to train the domain discriminator so that it can distinguish the features of the source domain and the target domain;
[0035] Train the feature extractor: Reverse the gradient through the gradient reversal layer so that the feature extractor is updated in the direction of maximizing the loss of the domain discriminator, thereby making the feature distributions of the source domain and the target domain closer;
[0036] Among them, both the task classifier and the feature extractor are updated according to the objectives of adversarial training.
[0037] Furthermore, the domain discriminator is combined with a gradient reversal layer to achieve domain adaptation;
[0038] Among them, the domain discriminator D d Used to determine whether the input features come from the source domain or the target domain. The input is a source domain dataset. and target domain datasets
[0039] Where D s is the source domain dataset; is the i-th data point in the source domain dataset; is the label corresponding to the i-th data point in the source domain dataset; N s is the number of samples in the source domain dataset; D t It is the target domain dataset; is the i-th data point in the target domain dataset; N t is the number of samples in the target domain dataset;
[0040] At the same time, the domain discriminator outputs a probability value P according to the feature vector z = f(x) through a binary classifier source (z) = D d (z)∈[0,1], represents the probability that the input feature belongs to the source domain s;
[0041] Where f(x) is the feature obtained by the feature extractor; z represents the feature vector; P source Denotes the probability value that the input feature vector z belongs to the source domain; D d is the output of the domain discriminator for the feature vector z.
[0042] Furthermore, during the training process, the gradient reversal layer can reverse the gradient in the back propagation, making it impossible for the feature extractor to distinguish the features of the source domain and the target domain, thereby prompting the feature extractor to learn universal features that are indistinguishable from the domain, making it adaptable to the characteristics of the target task and the target domain;
[0043] The task of the domain discriminator is to distinguish the data in the source domain from the target domain. Therefore, the domain discriminator's goal is to maximize the probability of predicting 1 on the source domain data and the probability of predicting 0 on the target domain data.
[0044] Among them, the total loss of the domain discriminator is the weighted sum of the source domain loss and the target domain loss:
[0045]
[0046] Where, is the total loss of the domain discriminator; N s is the number of samples in the source domain dataset; N tis the number of samples in the target domain dataset; i is the index of the sample; log is the logarithmic function; P source,s Indicates the probability of predicting that the source domain is 1 on the source domain data; P source,t Indicates the probability of predicting that the target domain is 0 on the target domain data;
[0047] Among them, the total loss of the feature extractor is:
[0048]
[0049] Where, is the total loss of the domain discriminator; is the total loss of the feature extractor.
[0050] Furthermore, during the adversarial training phase, a gradient reversal layer is introduced to reverse the direction of the gradient during backpropagation, so that the update of the feature extractor is opposite to the goal of the domain discriminator, allowing the feature extractor to learn consistent feature representations across domains.
[0051] The gradient reversal layer reverses the input feature vector z = f(x) and adds a hyperparameter λ to control the intensity of the gradient reversal:
[0052] GRL(z)=-λz
[0053] Where GRL(z) represents the strength of gradient reversal; λ is a hyperparameter; and z is a feature vector.
[0054] Furthermore, the goal of the anti-training stage is to minimize the loss function of the source domain task, and the loss function of the source domain task is expressed as:
[0055]
[0056] Where, represents the total loss of the source domain task; N s is the number of samples in the source domain dataset; i is the sample index; T c is the function of the task classifier; Loss function for task classification; is the i-th data point in the source domain dataset; y s i is the label corresponding to the i-th data point in the source domain dataset; f is the function of the feature extractor.
[0057] The present invention also discloses a domain-adaptive tinnitus classification system based on adversarial training. The domain-adaptive tinnitus classification system based on adversarial training includes a memory and a processor. The memory stores a domain-adaptive tinnitus classification method program based on adversarial training. When the domain-adaptive tinnitus classification method program based on adversarial training is executed by the processor, any step of the domain-adaptive tinnitus classification method based on adversarial training is implemented.
[0058] The present invention solves the technical defects existing in the background technology, and has the following beneficial effects: the experimental time series signal is passed through a pre-trained time series Transformer model, and the self-attention mechanism is used to capture the long-term dependencies and complex patterns in the signal, and the original time series signal is mapped into a high-dimensional feature representation, and the general feature information of the data is extracted, and the extracted features are passed to the task classifier for learning specific tasks; during the training process, the gradient reversal layer reverses the gradient in the back propagation, making it impossible for the feature extractor to distinguish between the features of the source domain and the target domain, thereby prompting the feature extractor to learn general features that are indistinguishable from the domain, so that it can adapt to the characteristics of the target task and the target domain. The present invention can effectively reduce the demand for large-scale labeled data and improve the diagnostic and treatment capabilities of medical intelligent systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, without paying any creative work, they can also obtain drawings of other embodiments based on these drawings.
[0060] Figure 1 This is a flowchart of the overall method for a domain-adaptive tinnitus classification method based on adversarial training;
[0061] Figure 2 This is a framework diagram of a domain-adaptive tinnitus classification method based on adversarial training;
[0062] Figure 3 This is a system block diagram of a domain-adaptive tinnitus classification system based on adversarial training. DETAILED DESCRIPTION
[0063] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0064] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.
[0065] like Figure 1 、 2 As shown, the present invention discloses a domain-adaptive tinnitus classification method based on adversarial training, comprising the following steps:
[0066] S102, obtaining an experimental time series signal, and using a pre-trained time series Transformer model as a feature extractor to extract feature information from the experimental time series signal, capturing long-distance dependencies in the experimental time series signal; wherein the feature information includes time series features;
[0067] S104, passing the extracted feature information to a task classifier to perform downstream tasks; wherein the downstream tasks include classification of tinnitus grading tasks;
[0068] S106. While performing downstream tasks, distinguish input features of the source domain and the target domain through adversarial training to perform a domain adaptive training process, so that the feature extractor learns feature information that is not affected by the domain; wherein the domain adaptive training process includes a pre-training stage and an adversarial training stage;
[0069] It should be noted that the entire domain adaptation training process is divided into two stages: pre-training and adversarial training. After pre-training, adversarial training is performed. In the adversarial training stage, the feature extractor and the domain discriminator are trained simultaneously. The goal of the feature extractor is to learn feature representations that are applicable to both the source and target domains, while the goal of the domain discriminator is to distinguish the features of the source and target domains. The feature extractor is optimized through the gradient reversal layer (GRL) so that the feature distributions of the source and target domains are closer and closer.
[0070] S108. Finally, the downstream task results are obtained through the domain adaptation framework of pre-training adversarial training.
[0071] The experimental timing signals include but are not limited to electroencephalogram signals, auditory evoked potentials, heart rate, respiratory rate, skin electrical response, reaction time and accuracy of patients in specific tasks.
[0072] It should be noted that the Transformer model is a deep learning model originally designed for natural language processing tasks. The Time Series Transformer model is a variant of the Transformer model specifically designed for processing time series data. Pretraining involves training the model on large-scale datasets, enabling it to learn rich feature representations. This model can be directly used for feature extraction because it has already learned how to capture complex patterns in the data. The role of a feature extractor is to extract useful information from time series signals, which is called features. In time series data, these features also include frequency, amplitude, waveform pattern, etc.
[0073] Long-range dependencies refer to connections between distant points in a data sequence. For example, in a speech signal, the pronunciation of a phoneme may be affected by the preceding or following phonemes. The Transformer model effectively captures these long-range dependencies through its self-attention mechanism.
[0074] Downstream tasks refer to tasks performed on specific problems after the pre-training model, such as classification, regression, etc. Here, the extracted feature information is passed to a classifier to perform the tinnitus classification task, that is, classifying tinnitus samples into different categories based on the extracted features.
[0075] Adversarial training is a machine learning technique that enhances a model's generalization ability by generating adversarial examples (input data intentionally designed to mislead the model). In the context of domain adaptation, the source domain refers to the domain for which labeled data is available, while the target domain refers to the domain for which the model is required to make predictions in real-world applications, which typically lacks labeled data. The goal of adversarial training is to enable the feature extractor to learn features that are not dependent on a specific domain, thereby improving the model's performance across different domains.
[0076] The pre-training phase trains the model on a large-scale dataset, enabling it to learn universal feature representations. The adversarial training phase builds on this pre-training phase by further optimizing the model through adversarial training, enabling it to recognize and ignore domain-specific features. Ultimately, this domain-adaptive framework, combining pre-training and adversarial training, enables the model to achieve superior results in tinnitus classification tasks, particularly when used with data from diverse domains.
[0077] In general, the core idea of this method is to use the pre-trained Transformer model to extract temporal features and perform domain adaptation through adversarial training to improve the generalization ability of the tinnitus classification model on data from different domains.
[0078] Furthermore, a pre-trained time series Transformer model is used as a feature extractor to extract feature information from the experimental time series signal, specifically:
[0079] The input timing signal is converted into d through a linear mapping model dimensional vector, and input the original input sequence X, as a feature extractor to extract feature information from the time series signal;
[0080] The self-attention mechanism is used to calculate the relationship between each time step and all other time steps, and multiple attention heads are used to process different attention subspaces in parallel;
[0081] Assuming there are h attention heads, the output of each attention head is expressed as:
[0082]
[0083] Where A h represents the output of the h-th attention head; Q h ,K h ,V h denote the query vector, key vector, and value vector of the h-th attention head respectively; d model Refers to the dimension of the model; T represents transposition; Attention is the attention function;
[0084] Then, the outputs of the h attention heads are concatenated and mapped back to d through a linear layer. model dimension:
[0085] MultiHead(Q,K,V)=Concat(A1,A2,···,A h )W O
[0086] Where Q, K, and V are the set of query vectors, key vectors, and value vectors, respectively; A1 is the output of the first attention head; A2 is the output of the second attention head; A h is the output of the h-th attention head; Concat represents the concatenation operation, W O is the output weight matrix, used to map the concatenated result back to d model ; MultiHead(Q,K,V) represents the overall output of the multi-attention head mechanism;
[0087] Then, two linear transformations and an activation function are input into the residual connection and layer normalization layer through the feedforward neural network to prevent the gradient from disappearing. The formula is as follows:
[0088]
[0089] Where FFN(x) is the output of the feedforward neural network; x is the vector input to the feedforward neural network;
[0090] W1, b1 are the weight and bias of the first linear transformation respectively; W2, b2 are the weight and bias of the second linear transformation respectively; X attn represents the output after the attention mechanism calculation; LayerNorm is the layer normalization function; X is the original input; MultiHead(Q,K,V) represents the overall output of the multi-attention head mechanism; X ffn is the final output after being processed by the feedforward neural network; X attn is the intermediate result after attention mechanism and layer normalization; FFN(X attn ) is for X attn Results of applying a feedforward neural network.
[0091] Furthermore, in order to enable the Transformer model to perceive the information of each position in the input sequence X, position encoding is added. Sine and cosine functions are used to define and add a vector P related to its position. The position encoding is added to the input embedding to obtain an input representation with position encoding:
[0092] X pos =X+P
[0093] Where, X pos represents the input representation after adding position encoding; X represents the original input sequence; P represents the position encoding vector, which is calculated by sine and cosine functions and corresponds to each position, and is used to add position-related information to the input.
[0094] Furthermore, the training of the temporal Transformer model is optimized by minimizing the loss function;
[0095] If the target is Y, the model output is Then the loss function is:
[0096]
[0097] Where, Represents the total loss value; N is the number of samples; i represents the sample index; Y i Represents the true target value of the i-th sample; Represents the model's predicted output for the i-th sample; c is the category index; Y i,c represents the true label of the i-th sample in category c; log is the logarithmic function; Represents the model's predicted probability for the i-th sample in category c; Represents the loss value of the i-th sample.
[0098] Furthermore, the domain adaptive training process includes:
[0099] Train the source domain task classifier: Use the source domain data to train the task classifier so that it can perform task predictions;
[0100] It's important to note that in this step, the task classifier is trained using data from the source domain. The source domain refers to a domain with available labeled data, typically used for initial model training. A task classifier is a supervised learning model whose purpose is to predict task-related labels based on input features, such as the tinnitus level in a tinnitus classification task. Through training, the task classifier learns how to extract useful features from the source domain data to make accurate predictions.
[0101] Training domain discriminator: Use the features of the source domain and the target domain to train the domain discriminator so that it can distinguish the features of the source domain and the target domain;
[0102] It's important to note that the domain discriminator is an unsupervised learning model designed to distinguish features from different domains. It needs to distinguish between features from the source domain and the target domain. The target domain refers to the domain the model will encounter in real-world applications and typically lacks labeled data. The domain discriminator distinguishes between the source and target domains by learning the differences in features. This process helps the model identify which features are domain-specific and which are domain-independent.
[0103] Train the feature extractor: Reverse the gradient through the gradient reversal layer so that the feature extractor is updated in the direction of maximizing the loss of the domain discriminator, thereby making the feature distributions of the source domain and the target domain closer;
[0104] It should be noted that the feature extractor is usually a deep neural network whose purpose is to extract useful features from the input data. The gradient reversal layer is a special technique used for adversarial training. In this step, the gradient of the feature extractor is reversed during backpropagation. The purpose of this is to update the feature extractor in the direction of maximizing the domain discriminator loss, that is, to allow the feature extractor to generate features that are difficult for the domain discriminator to distinguish, thereby making the feature distributions of the source domain and the target domain closer. In this way, the feature extractor is forced to learn domain-independent features that are not obvious to the domain discriminator but are useful to the task classifier.
[0105] Among them, both the task classifier and the feature extractor are updated according to the objectives of adversarial training.
[0106] It's important to note that during adversarial training, both the task classifier and the feature extractor are updated based on the adversarial training objectives. The task classifier continues to optimize its performance on the source domain task, while the feature extractor simultaneously optimizes its performance on features that are difficult for the generated domain discriminator to distinguish. This adversarial training process forces the feature extractor to learn more generalized features that are not only applicable to the source domain task but also remain effective in the target domain.
[0107] Through the above steps, the model ultimately learns features that can be used for tasks in the source domain and can also be adapted across domains to the target domain, achieving domain adaptation. This capability is crucial for processing data from different domains in real applications, as it allows the model to maintain good performance in new domains even without labeled data from the target domain.
[0108] Furthermore, the domain discriminator is combined with a gradient reversal layer to achieve domain adaptation;
[0109] Among them, the domain discriminator D d Used to determine whether the input features come from the source domain or the target domain. The input is a source domain dataset. and target domain datasets
[0110] Where D s is the source domain dataset; is the i-th data point in the source domain dataset; is the label corresponding to the i-th data point in the source domain dataset; N s is the number of samples in the source domain dataset; D t It is the target domain dataset; is the i-th data point in the target domain dataset; N t is the number of samples in the target domain dataset;
[0111] It should be noted that the goal of the model is to learn a common feature representation so that these features can be used for task classification in the source domain and can also make the features of the source domain and the target domain difficult to distinguish through adversarial training;
[0112] At the same time, the domain discriminator outputs a probability value P according to the feature vector z = f(x) through a binary classifier source (z) = D d (z)∈[0,1], represents the probability that the input feature belongs to the source domain s;
[0113] Where f(x) is the feature obtained by the feature extractor; z represents the feature vector; P source Denotes the probability value that the input feature vector z belongs to the source domain; Dd is the output of the domain discriminator for the feature vector z.
[0114] Furthermore, during the training process, the gradient reversal layer can reverse the gradient in the back propagation, making it impossible for the feature extractor to distinguish the features of the source domain and the target domain, thereby prompting the feature extractor to learn universal features that are indistinguishable from the domain, making it adaptable to the characteristics of the target task and the target domain;
[0115] The task of the domain discriminator is to distinguish the data in the source domain from the target domain. Therefore, the domain discriminator's goal is to maximize the probability of predicting 1 on the source domain data and the probability of predicting 0 on the target domain data.
[0116] Among them, the total loss of the domain discriminator is the weighted sum of the source domain loss and the target domain loss:
[0117]
[0118] Where, is the total loss of the domain discriminator; N s is the number of samples in the source domain dataset; N t is the number of samples in the target domain dataset; i is the index of the sample; log is the logarithmic function; P source,s Indicates the probability of predicting that the source domain is 1 on the source domain data; P source,t Indicates the probability of predicting that the target domain is 0 on the target domain data;
[0119] It should be noted that the task of the domain discriminator is to distinguish the data in the source domain and the target domain, so its goal is to maximize the probability of predicting 1 (source domain) on the source domain data and the probability of predicting 0 (target domain) on the target domain data.
[0120] Among them, the total loss of the feature extractor is:
[0121]
[0122] Where, is the total loss of the domain discriminator; is the total loss of the feature extractor.
[0123] It should be noted that during the adversarial training phase, the feature extractor and the domain discriminator are trained simultaneously. The feature extractor aims to learn feature representations that are applicable to both the source and target domains, while the domain discriminator aims to distinguish features from those in the source and target domains. The feature extractor is optimized using a gradient reversal layer (GRL), bringing the feature distributions of the source and target domains closer and closer.
[0124] During the adversarial training phase, the feature extractor aims to maximize the loss of the domain discriminator (by reversing the gradient) so that the domain discriminator cannot distinguish the features of the source and target domains, while the task classifier continues to minimize the classification loss.
[0125] Furthermore, during the adversarial training phase, a gradient reversal layer is introduced to reverse the direction of the gradient during backpropagation, so that the update of the feature extractor is opposite to the goal of the domain discriminator, allowing the feature extractor to learn consistent feature representations across domains.
[0126] The gradient reversal layer reverses the input feature vector z = f(x) and adds a hyperparameter λ to control the intensity of the gradient reversal:
[0127] GRL(z)=-λz
[0128] Where GRL(z) represents the strength of gradient reversal; λ is a hyperparameter; and z is a feature vector.
[0129] Furthermore, the goal of the anti-training stage is to minimize the loss function of the source domain task, and the loss function of the source domain task is expressed as:
[0130]
[0131] Where, represents the total loss of the source domain task; N s is the number of samples in the source domain dataset; i is the sample index; T c is the function of the task classifier; Loss function for task classification; is the i-th data point in the source domain dataset; is the label corresponding to the i-th data point in the source domain dataset; f is the function of the feature extractor.
[0132] It's important to note that the core of adversarial training lies in optimizing the network through a game of balancing between the feature extractor and the domain discriminator. Specifically, the feature extractor aims to prevent the domain discriminator from correctly distinguishing features from the source and target domains. In other words, the feature extractor aims to learn features from irrelevant domains, making the feature distributions of the target and source domains as similar as possible, thereby improving the model's generalization ability.
[0133] Overall, the experimental time series signal is passed through a pre-trained time series Transformer model, using a self-attention mechanism to capture long-term dependencies and complex patterns in the signal. This model maps the raw time series signal into a high-dimensional feature representation, extracting common features from the data. These extracted features are then passed to a task classifier for task-specific learning. The task classifier can perform tasks such as classification, regression, and prediction, depending on the application scenario. Domain adaptation is achieved during the fine-tuning phase by combining a domain discriminator with a gradient reversal layer (GRL). During training, GRL reverses the gradients during backpropagation, making it impossible for the feature extractor to distinguish between features in the source and target domains. This in turn forces the feature extractor to learn domain-indistinguishable common features, adapting them to the target task and domain characteristics. This model has broad applications in medical image analysis, disease prediction, personalized treatment recommendation, drug development, and other fields. In particular, in cross-domain applications, it can effectively reduce the need for large-scale annotated data and improve the diagnostic and treatment capabilities of medical intelligent systems. This technology can provide more accurate and intelligent decision support for hospitals, research institutions, and healthcare management systems.
[0134] like Figure 3 As shown, the present invention further discloses a domain-adaptive tinnitus classification system 6 based on adversarial training. The domain-adaptive tinnitus classification system based on adversarial training includes a memory 41 and a processor 52. The memory 41 stores a domain-adaptive tinnitus classification method program based on adversarial training. When the domain-adaptive tinnitus classification method program based on adversarial training is executed by the processor 52, any step of the domain-adaptive tinnitus classification method based on adversarial training is implemented.
[0135] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0136] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0137] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0138] Those skilled in the art will appreciate that all or part of the steps of the above-mentioned method embodiments may be implemented by hardware associated with program instructions, and the aforementioned program may be stored in a computer-readable storage medium. When the program is executed, the program executes the steps of the above-mentioned method embodiments. The aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0139] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0140] The above are only specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be covered by the scope of protection of the present invention.
Claims
1. A domain-adaptive tinnitus classification method based on adversarial training, characterized in that: The following steps are involved: Acquire an experimental time series signal, and use a pre-trained time series Transformer model as a feature extractor to extract feature information from the experimental time series signal to capture long-range dependencies in the experimental time series signal; wherein the feature information includes time series features; Passing the extracted feature information to a task classifier to perform downstream tasks; wherein the downstream tasks include classification of tinnitus grading tasks; While performing downstream tasks, adversarial training is used to distinguish the input features of the source and target domains, allowing for domain-adaptive training. This allows the feature extractor to learn feature information that is not affected by the domain. The domain-adaptive training process includes a pre-training phase and an adversarial training phase. Finally, through the domain adaptation framework of pre-training adversarial training, downstream task results are obtained; The pre-trained time series Transformer model is used as a feature extractor to extract feature information from the experimental time series signal, specifically: The input timing signal is converted into dimensional vector, and input the original input sequence , as a feature extractor to extract feature information from the time series signal; The self-attention mechanism is used to calculate the relationship between each time step and all other time steps, and multiple attention heads are used to process different attention subspaces in parallel; Then, two linear transformations and an activation function are input into the residual connection and layer normalization layer through the feedforward neural network to prevent the gradient from disappearing. The formula is as follows: , Where, is the output of the feedforward neural network; is the vector input to the feedforward neural network; are the weight and bias of the first linear transformation respectively; are the weight and bias of the second linear transformation respectively; is the layer normalization function; Represents the overall output of the multi-attention head mechanism; is the final output after being processed by the feedforward neural network; is the intermediate result after attention mechanism and layer normalization; For Results of applying a feedforward neural network.
2. The domain-adaptive tinnitus classification method based on adversarial training according to claim 1, characterized in that: Using a pre-trained time series Transformer model as a feature extractor to extract feature information from the experimental time series signal also includes: Assume there is attention heads, the output expression of each attention head is: , Where, Indicates the The output of an attention head; Respectively represent The query vector, key vector, and value vector of each attention head; refers to the dimensions of the model; represents transpose; is the attention function; Then, the The outputs of the attention heads are concatenated and mapped back to dimension: , Where, are the set of query vectors, the set of key vectors, and the set of value vectors respectively; is the output of the first attention head; is the output of the second attention head; For the The output of an attention head; Represents a splicing operation, Is the output weight matrix, used to map the concatenated result back to ; Represents the overall output of the multi-attention head mechanism.
3. The domain-adaptive tinnitus classification method based on adversarial training according to claim 2, characterized in that: In order to make the Transformer model aware of the original input sequence The information of each position in the , add position coding, use sine and cosine functions to define and add a vector related to its position , adding the positional encoding to the input embedding to obtain the input representation with positional encoding: , Where, Represents the input representation after adding position encoding; Represents the original input sequence; Represents the position encoding vector, which is calculated by sine and cosine functions and corresponds to each position, and is used to add position-related information to the input.
4. The domain-adaptive tinnitus classification method based on adversarial training according to claim 2, characterized in that: The training of the temporal Transformer model is optimized by minimizing the loss function; If the target is , the model output is , then the loss function is: , Where, Indicates the total loss value; is the sample size; Indicates the sample index; Indicates the The true target value of samples; Indicates the model The predicted output of samples; is the category index; Indicates the samples in the category The real label on is a logarithmic function; Indicates the model samples in the category The predicted probability of Indicates the The loss value of the sample.
5. The domain-adaptive tinnitus classification method based on adversarial training according to claim 1, characterized in that: The domain adaptation training process includes: Train the source domain task classifier: Use the source domain data to train the task classifier so that it can perform task predictions; Training domain discriminator: Use the features of the source domain and the target domain to train the domain discriminator so that it can distinguish the features of the source domain and the target domain; Train the feature extractor: Reverse the gradient through the gradient reversal layer so that the feature extractor is updated in the direction of maximizing the loss of the domain discriminator, thereby making the feature distributions of the source domain and the target domain closer; Among them, both the task classifier and the feature extractor are updated according to the objectives of adversarial training.
6. The domain-adaptive tinnitus classification method based on adversarial training according to claim 5, characterized in that: The domain discriminator is combined with a gradient reversal layer to achieve domain adaptation; Among them, the domain discriminator Used to determine whether the input features come from the source domain or the target domain. The input is a source domain dataset. and target domain datasets ; Where, is the source domain dataset; is the first data points; The source domain data set The labels corresponding to the data points; is the number of samples in the source domain dataset; It is the target domain dataset; The first data points; is the number of samples in the target domain dataset; At the same time, the domain discriminator is based on the feature vector , a binary classifier outputs a probability value , represents the probability that the input feature belongs to the source domain s; Where, is the feature obtained by the feature extractor; represents the eigenvector; Represents the input feature vector The probability value of belonging to the source domain; is the domain discriminator feature vector Output.
7. The domain-adaptive tinnitus classification method based on adversarial training according to claim 6, characterized in that: During the training process, the gradient reversal layer can reverse the gradient in the back propagation, making it impossible for the feature extractor to distinguish the features of the source domain and the target domain, thereby prompting the feature extractor to learn universal features that are indistinguishable from the domain, making it adaptable to the characteristics of the target task and the target domain; The task of the domain discriminator is to distinguish the data in the source domain from the target domain. Therefore, the domain discriminator's goal is to maximize the probability of predicting 1 on the source domain data and the probability of predicting 0 on the target domain data. Among them, the total loss of the domain discriminator is the weighted sum of the source domain loss and the target domain loss: , Where, is the total loss of the domain discriminator; is the number of samples in the source domain dataset; is the number of samples in the target domain dataset; is the index of the sample; is a logarithmic function; Indicates the probability of predicting that the source domain is 1 on the source domain data; Indicates the probability of predicting that the target domain is 0 on the target domain data; Among them, the total loss of the feature extractor is: , Where, is the total loss of the domain discriminator; is the total loss of the feature extractor.
8. The domain-adaptive tinnitus classification method based on adversarial training according to claim 6, characterized in that: During the adversarial training phase, a gradient reversal layer is introduced to reverse the direction of the gradient during backpropagation, so that the update of the feature extractor is opposite to the goal of the domain discriminator, allowing the feature extractor to learn consistent feature representations across domains. Among them, the gradient reversal layer is the input feature vector Reverse it and add a hyperparameter To control the intensity of gradient reversal: , Where, Indicates the strength of gradient reversal; is a hyperparameter; is the feature vector.
9. The domain-adaptive tinnitus classification method based on adversarial training according to claim 1, characterized in that: The goal of the anti-training stage is to minimize the loss function of the source domain task, which is expressed as: , Where, represents the total loss of the source domain task; is the number of samples in the source domain dataset; is the sample index; is the function of the task classifier; Loss function for task classification; is the first data points; The source domain data set The labels corresponding to the data points; Function of the feature extractor.
10. A domain-adaptive tinnitus classification system based on adversarial training, characterized in that: The domain-adaptive tinnitus classification system based on adversarial training includes a memory and a processor. The memory stores a domain-adaptive tinnitus classification method program based on adversarial training. When the domain-adaptive tinnitus classification method program based on adversarial training is executed by the processor, the steps of the domain-adaptive tinnitus classification method based on adversarial training are implemented.
Citation Information
Patent Citations
Unsupervised domain adaptive method combining deep attention features and conditional adversarial
CN111242157A
Self-adaptive attention method with domain adversarial training for multi-accent speech recognition
CN115273827A