Progressive passive domain adaptation method based on target domain sample division
By dividing the samples that are easy to adapt and difficult to adapt in the target domain sample, and use the training strategy of the phase first and stage two of the alternation, solve the problem of low accuracy of the medium target domain category, and achieve significant significant realization, and achieve significant significant achievements, and achieve significant significant significant. Improve the effect of the accuracy of the target domain sample classification.
Patent Information
- Application Number
- CN202411407892.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-28
AI Technical Summary
The existing passive domain adaptation method is difficult to effectively improve the classification accuracy of the model in the target domain when the data distribution of the target domain is inconsistent with the data distribution of the source domain.
By classifying and difficult -to -adapt samples in the target domain sample, the training strategy of alternating stage one and stage two is adopted by alternation. Phase I includes weighted self -training and comparative learning. Pharmaceutical two uses consistency loss and instance comparison learning to handle samples that are easy to adapt and difficult to adapt, respectively.
By weakening the negative impact of the shift of the domain, the understanding of the model's understanding of the semantic semantics significantly improves the classification accuracy of the target domain sample.
Smart Images

Figure CN119380136A_ABST
Abstract
Description
Technical Field
[0001] The invention designs a progressive passive domain adaptability method based on target domain sample division, which belongs to the field of machine learning. Background Art
[0002] With the continuous growth of data volume and the continuous enhancement of computing power, artificial intelligence represented by machine learning has made great progress and has gradually been applied to real life. Traditional machine learning assumes that data is independent and identically distributed, that is, training samples and test samples come from the same data distribution. However, in real environments, due to differences in acquisition equipment, lighting, viewing angles and other factors, the assumption of independent and identical distribution is difficult to hold, which seriously affects the performance of machine learning models and hinders their application in real scenarios.
[0003] The basic idea of transfer learning is to transfer the knowledge learned from labeled data to the target task on unlabeled data, reducing the dependence on the labeling of the target domain data while considering the changes in the environment. Unsupervised domain adaptation is an example of transfer learning, which transfers knowledge from a labeled source domain to an unlabeled target domain, where the data distribution of the source and target domains is inconsistent, reflecting the reality.
[0004] In fields such as medicine and finance that value privacy protection, source domain data is often difficult to obtain, and the only way is to adapt the source domain pre-trained model to the unlabeled target domain. This unsupervised domain adaptation under this problem setting is called passive domain adaptation. The existing mainstream passive domain adaptation method is based on pseudo-labeling. On the one hand, it improves the accuracy of pseudo-labeling, and on the other hand, it uses target domain data to optimize feature expression, but the effect still needs to be improved.
[0005] Because deep learning models will first fit clean data and learn simple patterns, and then fit noisy data and learn complex patterns, the method proposed in the present invention divides the target domain samples into easy-to-adapt samples and difficult-to-adapt samples according to the reliability of the pseudo-labels. The model training process consists of alternating stages one and two: stage one mainly includes weighted self-training and graph contrast learning, and stage two uses consistency loss and instance contrast learning to train the model on easy-to-adapt and difficult-to-adapt target samples respectively. Experiments show that this method has achieved good results and provides new ideas for passive domain adaptation methods. Summary of the invention
[0006] Without accessing the source domain data, the source domain pre-trained model is adapted to the target domain and better results are achieved. The present invention proposes a progressive passive domain adaptation method based on target domain sample partitioning.
[0007] The main contents of the present invention are as follows:
[0008] (1) Obtain commonly used public datasets for domain adaptation and perform data preprocessing.
[0009] (2) Obtain a source domain pre-trained model, including a feature extractor and a classifier.
[0010] (3) Design a target domain sample division strategy. Input the image features extracted by the feature extractor into the classifier to obtain the classification results. Perform a preliminary division of the target domain samples according to the classification confidence to obtain a candidate set of easily adaptable samples. Then, by calculating the information entropy of the samples, further select samples with lower entropy values as easily adaptable samples in the target domain, and the remaining target domain samples as difficult-to-adapt samples.
[0011] (4) Conduct training in stage one: Use a clustering strategy to update the model’s prediction of the target sample’s category, obtain the sample’s pseudo-label, and use a weighted loss function to mitigate the effects of unreliable pseudo-labels; design graph contrast learning to align difficult-to-adapt samples and easy-to-adapt samples that may have the same category, and optimize the feature expression of the target domain samples.
[0012] (5) Training for the second stage: First, strong and weak data augmentation is performed on the easily adaptable samples, and the consistency loss of the two views is calculated to enhance the model's understanding of the category semantics. At the same time, pseudo labels are used for self-training on the easily adaptable samples to improve the model's confidence in predicting the easily adaptable samples. Then, instance contrast learning is used for the difficult-to-adapt samples, and the neighboring samples of each difficult-to-adapt sample are used as positive examples of the sample, and the remaining difficult-to-adapt samples are negative examples, maximizing the similarity between the sample and the positive example, and minimizing the similarity between the sample and the negative example. In the second stage, the model performs progressive learning from easy-to-adapt samples to difficult-to-adapt samples.
[0013] (6) The above stages 1 and 2 are performed alternately until the model converges.
[0014] (7) Conduct experiments on each migration task of all datasets and record the classification accuracy of target domain samples.
[0015] (8) Conduct ablation experiments to verify the effectiveness of different modules.
[0016] The beneficial effect of the present invention is as follows: the present invention proposes a progressive passive domain adaptation method based on target domain sample division, which divides the target domain samples into easy-to-adapt samples and difficult-to-adapt samples, and adopts different processing strategies for the two samples from easy to difficult, which not only weakens the negative impact of domain shift, but also enhances the model's understanding of category semantics, and ultimately improves the classification accuracy of target domain samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 : Flowchart of data partitioning incremental learning.
[0018] Figure 2 : Flowchart of the first stage training.
[0019] Figure 3 : Flowchart of the second stage training. DETAILED DESCRIPTION
[0020] Get the Office-31, Office-Home, and VisDA datasets. Office-31 contains 3 domains, 6 migration tasks, and 31 categories; Office-Home contains 4 domains, 12 migration tasks, and 65 categories; VisDA contains 2 domains, 1 migration task, and 12 categories.
[0021] First, the image data is preprocessed, including data augmentation and normalization operations. The processed image is converted into tensor format for subsequent use.
[0022] The progressive passive domain adaptation method based on target domain sample division first divides the target domain samples according to the reliability of the pseudo-labels to obtain samples that are easy to adapt and samples that are difficult to adapt. The model training process consists of alternating stages one and two. The first stage performs self-training that is robust to noise labels and aligns samples that are difficult to adapt and samples that are easy to adapt by category; the second stage uses different strategies to train the model on target samples that are easy to adapt and target samples that are difficult to adapt in the order of easy first and difficult later. The two stages are performed alternately until the model is stable. The training process is as follows: Figure 1 shown.
[0023] In the first stage, samples are divided into easy-to-adapt samples or difficult-to-adapt samples according to the model's prediction confidence of the image. The category center is calculated based on the pseudo-label predicted by the model for the easy-to-adapt samples and the extracted features, and then the sample pseudo-label is updated to the category closest to the category center. The updated pseudo-label is used for weighted self-training of the model, and the weight is inversely proportional to the information entropy of the sample category prediction to reduce the impact of samples with unreliable pseudo-labels on model training.
[0024] In order to improve the separability of the target domain category features, graph contrast learning is used to align the features of difficult-to-adapt samples with the features of similar easy-to-adapt samples. The definition of graph contrast loss is as follows:
[0025]
[0026] Where B represents the size of each batch, and H represents the cross entropy operation. R and A are the sample category relationship graph and sample feature similarity graph, respectively. If the pseudo labels of sample i and sample j are the same, and at least one of them is an easy-to-adapt sample, then R ij The value of is 1, otherwise it is 0. ij Represents the cosine similarity between sample i and sample j.
[0027] The second stage adopts progressive learning from easy to difficult. For easily adaptable samples, first obtain the classification results after different data enhancements, and strengthen the model's discrimination ability through prediction consistency loss to learn class semantic information. At the same time, because the pseudo-labels of easily adaptable samples are more reliable, they can be directly used for self-training of the model. The pseudo-labels of difficult-to-adapt samples are unreliable, so they cannot be used for white training. This method mines and utilizes the characteristics of difficult-to-adapt samples themselves through example comparison learning. Specifically, the K nearest neighbor samples of a difficult-to-adapt sample are determined by cosine distance, and the average of their category prediction probability vectors is taken. As positive examples, the rest of the difficult-to-adapt samples are negative examples, and the category prediction vector of negative sample j is The definition of instance contrast loss is as follows:
[0028]
[0029] where p i represents the class prediction probability vector of sample i, τ is the temperature coefficient, M is the number of negative examples of sample i, and N is the number of difficult-to-adapt samples.
[0030] Aiming at the problems of unusable source domain data and distribution shift between domains in real scenarios, the progressive passive domain adaptation method based on target domain sample partitioning can improve the performance of machine learning models in the target domain, which is of great significance to promoting the application of artificial intelligence models in real environments.
[0031] It should be noted that the above is only an embodiment of the present invention, which is only to explain the present invention and does not limit the patent scope of the present invention. Any obvious changes that belong to the technical concept of the present invention are also within the protection scope of the present invention.
Claims
1. The present invention relates to a progressive passive domain adaptation method based on target domain sample division, characterized in that: The steps include: (1) Obtain commonly used domain adaptation datasets and perform data preprocessing; obtain source models for different migration tasks on each dataset; (2) Based on the prediction of the model classifier, a partitioning mechanism is designed to divide the target domain data into an easy-to-adapt sample set and a difficult-to-adapt sample set; (3) In stage 1, samples of the same potential category and their neighborhoods are brought closer together, the features of the hard-to-adapt samples are aligned to the easy-to-adapt samples, the feature distribution of the target domain samples is optimized, and the graph contrast learning loss is calculated; (4) In stage 2, different data augmentations are applied to the easily adaptable samples to minimize the consistency loss of different views in the feature space; (5) In the second stage, in the difficult-to-adapt sample set, the neighboring samples of the search sample are used as positive examples, and other samples are used as negative examples. Instance comparative learning is performed to promote the formation of compact clusters of samples of the same potential category and improve the discriminability of features; (6) The two training stages are performed alternately until the model converges, and the performance of the model is evaluated by calculating the classification accuracy of each transfer task.
2. The progressive passive domain adaptation method based on target domain sample partitioning according to claim 1, characterized in that: The easy-to-adapt sample screening mechanism in step (2) selects N samples with the highest prediction probability in each category as candidate samples based on the model's classifier prediction. The information entropy of the candidate samples is calculated, and the candidate samples of each category are arranged from low to high according to the entropy value. The first M samples are selected as the final easy-to-adapt samples, and the remaining samples are selected as difficult-to-adapt samples.
3. The progressive passive domain adaptation method based on target domain sample partitioning according to claim 1, characterized in that: The graph contrast learning loss described in step (3) takes a batch of samples as the vertices of the graph and the pseudo-labels as the categories of the vertices. If the pseudo-labels of the two vertices of an edge are the same and at least one vertex corresponds to an easily adaptable sample, the value of the edge is 1, otherwise, the value is 0, thereby constructing a sample category relationship graph; similarly, a sample feature relationship graph is constructed, with the feature similarity of the vertex samples as the edge value. The sample category relationship graph is used as the training target of the sample feature relationship graph.
4. The progressive passive domain adaptation method based on target domain sample partitioning according to claim 1, characterized in that: In step (5), the example comparison learning is to search the K neighbors closest to the sample as positive samples based on the normalized feature vector of the sample in the feature space of the difficult-to-adapt sample by cosine distance, take the average of the category prediction vectors of the neighbor samples, and calculate the inner product with the category prediction vector of the sample as the similarity between the sample and the positive example; The feature similarity between the sample and all non-neighbor samples (negative examples) is calculated to maximize the similarity between the sample and the positive example, minimize the similarity between the sample and the negative example, and promote the difficult-to-adapt samples to form compact clusters in the feature space.
5. The progressive passive domain adaptation method based on target domain sample partitioning according to claim 1, characterized in that: In step (6), the training process is transformed into two training phases that are performed alternately. Phase 1 includes the division of target domain data, pseudo-label optimization, self-training, and graph contrast learning, which aims to align the feature distribution of the target domain with the source domain distribution learned by the source model. The second training phase includes consistency learning of different data enhancements for easily adaptable samples and instance contrast learning for difficult-to-adapt samples, which aims to optimize the feature distribution of target domain samples and assist the training of phase 1. The two training phases are performed alternately until the model converges.