Passive Unsupervised Domain Adaptation Method Based on Meta-Enhanced Contrastive Learning

By using the meta-enhanced contrastive learning method based on teacher-student network in passive unsupervised domain adaptation, combined with spatial and semantic contrastive learning, the problem of pseudo-label noise in passive domain adaptation is solved, and the adaptation effect of the target domain model is significantly improved. and performance.

CN117689946BActive Publication Date: 2024-09-20UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202311704518.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-12
Publication Date
2024-09-20
Estimated Expiration
2043-12-12

AI Technical Summary

Technical Problem

Existing unsupervised domain adaptation technology is difficult to effectively adapt to the target domain without source, and relies on pseudo-labels, which leads to noise problems. Moreover, existing contrastive learning methods fail to fully consider the noise problem of pseudo-labels, which affects the adaptation effect of the model.

Method used

The meta-enhanced contrastive learning method based on the teacher-student network is used to construct a meta-enhanced contrastive learning model by combining spatial contrastive learning and semantic contrastive learning. The meta-feature enhancer and contrastive learning feature library are used to optimize the student model to improve the adaptability of the target domain model. Effect.

Benefits of technology

Under the condition of passive and unsupervised, it improves the adaptation effect of the target domain model, alleviates the influence of pseudo label noise, significantly improves the performance and feature discrimination ability of the model, and protects the privacy of source domain data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117689946B
    Figure CN117689946B
Patent Text Reader

Abstract

The present invention discloses a passive unsupervised domain adaptation method based on meta-enhanced contrastive learning, constructs a teacher-student network consisting of a teacher model and a student model, sets a meta-feature enhancer between the teacher model encoder and the classifier to form a meta-enhanced contrastive learning model, constructs a contrastive learning feature library including a positive sample, a negative sample feature library and a spatial feature library and initializes it, then trains the meta-enhanced contrastive learning model based on spatial contrastive learning and semantic contrastive learning, and extracts the student model from the final meta-learning model as a target domain model. The present invention constructs a meta-enhanced contrastive learning model based on the teacher-student network and the meta-feature enhancer, and trains it through spatial contrastive learning and semantic contrastive learning, thereby improving the adaptation effect of the obtained target domain model on the target domain under passive and unsupervised conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and more specifically, relates to a passive unsupervised domain adaptation method based on meta-enhanced contrast learning. Background Art

[0002] Benefiting from a large amount of labeled training data, deep learning models are very successful in learning tasks in the field of vision and image processing when the training and test data follow the same distribution. However, their ability to generalize to data with inconsistent distribution is severely affected in the presence of domain shift. In order to solve the problem of domain shift, various unsupervised domain adaptation (UDA) algorithms have been developed in recent years. The goal is to transfer knowledge from labeled source domain data to new but related target domain data. Most UDA techniques require access to labeled source domain data during training, which limits their application in many real-world scenarios. For example, when the source domain data is image data related to patient diseases in a hospital, existing UDA techniques may fail when such source domain data cannot be obtained due to restrictions such as privacy ethics. The above problems have prompted people to study passive unsupervised domain adaptation methods (SFDA) which are more closely related to the above problem settings. The main difference between passive unsupervised domain adaptation methods (SFDA) and unsupervised domain adaptation (UDA) algorithms is that when training the target domain model, the labeled source data is no longer accessible, but a pre-trained model in the source domain is provided. This is a more practical problem.

[0003] The main difficulty of passive unsupervised domain adaptation methods is how to learn the feature representation of target domain data without the help of real semantic label information and how to use the source domain model as the proxy knowledge of the source domain to train the target domain model. To address these difficulties, existing works have made use of source domain images, feature generation methods, class centroid clustering, entropy minimization, self-training or pseudo-labeling methods to achieve good results. However, it is worth noting that the disadvantage of the generative model is that a lot of computing power is required to generate images / features in the target style. For class prototype-based methods, features formulated based on clustering structures may be seriously misleading in the early stages of adaptation; entropy minimization-based methods have been competitive, but the direct optimization of entropy destroys the model calibration of the target domain. Pseudo-labeling methods have shown promising results, but their performance may be affected by noisy pseudo-labels. Recently, some methods have adopted self-supervised contrastive learning techniques to promote target feature learning, but existing contrastive learning-based methods simply rely on pseudo-labels to distinguish positive and negative sample pairs, and do not fully consider the noise problem of pseudo-labels; in addition, simple random enhancement of data cannot promote contrastive learning to learn sufficient distinguishable information. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a passive unsupervised domain adaptation method based on meta-enhanced contrastive learning, construct a meta-enhanced contrastive learning model based on a teacher-student network and a meta-feature enhancer, and train it through spatial contrastive learning and semantic contrastive learning, so as to improve the adaptation effect of the obtained target domain model on the target domain in a passive and unsupervised situation.

[0005] In order to achieve the above-mentioned object of the invention, the passive unsupervised domain adaptation method based on meta-enhanced contrastive learning of the present invention comprises the following steps:

[0006] S1: Collect M image samples of the target domain according to actual needs to form a meta-training dataset X;

[0007] S2: Determine the source domain encoder and source domain classifier according to actual needs, extract the parameters to initialize the parameters of the encoder and classifier in the target domain model, copy the initial target domain model as the teacher model and student model to form a teacher-student network; set a meta-feature enhancer between the encoder and classifier of the teacher model to enhance the feature map extracted by the encoder, and randomly initialize the meta-feature enhancer parameters to form a meta-enhancement contrastive learning model;

[0008] S3: Initialize the contrastive learning feature library, including the positive sample, negative sample feature library and spatial feature library. The specific steps include:

[0009] S3.1: For each image sample x in the meta-training dataset X i Random enhancement is performed respectively to obtain enhanced samples A(x i ) and are input to the encoder of the teacher model respectively. and the encoder of the student model Get Features in, d represents the dimension of the feature, i = 1, 2, ..., M, w, θ represent the parameters of the teacher model and the student model respectively;

[0010] The teacher model encoder The obtained feature representation Input into the meta-feature enhancer and output enhanced features

[0011] The characteristics and The classifiers input into the teacher model and the student model respectively obtain the corresponding probability distribution Represents the image samples x obtained by the classifiers in the teacher model and the student model respectively i The probability of belonging to category c, c = 1, 2, ..., C, C represents the number of categories;

[0012] S3.2: Determine the image sample x using the following formula i The pseudo label y i :

[0013]

[0014] S3.3: Use the following formula to calculate the centroid of each category c as a positive sample:

[0015]

[0016] in, represents the centroid of category c, I(y i =c) represents a binary function, when y i =c when I(y i =c) = 1, otherwise I(y i =c)=0;

[0017] S3.4: Construct a negative sample feature library N sem , negative sample feature library N sem It is a list of C queues of length M, and the negative sample queue corresponding to category c is N sem (c), traverse each image sample x i , if its pseudo label y i =c, 0≤υ≤τ≤1 represents the threshold parameter, then the corresponding enhanced feature Add negative sample queue N of category c sem (c) Otherwise, no action is taken;

[0018] S3.5: For each image sample x in the meta-training dataset X i , the corresponding features are obtained through the student model encoder and filled into the spatial feature library in order middle;

[0019] S4: Use meta-learning to optimize the meta-feature enhancer and the student model simultaneously, so as to complete the training of the meta-enhanced contrastive learning model. The specific method is as follows:

[0020] S4.1: Let the number of iterations t = 1;

[0021] S4.2: Randomly select B image samples from the meta-training dataset X as the training dataset X for the current batch B ;

[0022] S4.3: Take the model training loss of the student model in the meta-enhanced contrastive learning model as the lower-level task, take the model training loss of the meta-feature enhancer as the upper-level task, and use the current batch of training dataset X BFor the meta-enhanced contrastive learning model, the upper-level tasks and the lower-level tasks are iteratively updated alternately to complete the training of the meta-learning model; among them, the lower-level task loss The calculation formula is:

[0023]

[0024] Among them, θ represents the parameters of the student model, represents the parameter of the meta-feature enhancer, λ represents a non-negative tuning factor, Represents the semantic contrast loss and spatial feature contrast learning loss of the student model respectively; semantic contrast loss Based on the semantic negative sample library, the calculation formula is as follows:

[0025]

[0026] in, represents the training samples in the current batch, Represents the feature extraction of the student model for training samples The extracted features, c j Represents the student model for training samples The predicted category, Represents the predicted category c j The corresponding positive sample, N sem (c j ) indicates the predicted category c j The corresponding negative sample feature queue, p - represents negative samples, || represents the number of samples in the set, and d() represents the distance;

[0027] Spatial feature contrastive learning loss The calculation method is:

[0028] 1) Use K nearest neighbor algorithm to extract the spatial feature library N spa Select and image sample Features The most similar K features are represented as positive samples, thus obtaining a positive sample set

[0029] 2) The current batch of training data set X B Remove image samples Other image samples other than are taken as negative samples, thus obtaining a negative sample set

[0030] 3) Use the following formula to calculate the feature contrast learning loss

[0031]

[0032] Among them, q k Represents the positive sample set The characteristics of Represents the encoder set of negative samples in the student model Image samples in The extracted features;

[0033] Upper task loss The calculation formula is:

[0034]

[0035] Among them, A() represents random enhancement of image samples. Respectively represent the encoder in the student model for image samples And enhanced image samples The extracted features, represents the consistency loss, Represents an image sample The entropy value of

[0036] S4.4: Determine whether t < t max , t max Indicates the maximum number of iterations predicted. If yes, go to step S4.5, otherwise the training is completed;

[0037] S4.5: update the parameters of the teacher model using the parameters of the current student model;

[0038] S4.6: Use the data of this batch to update the comparative learning feature library. The specific method is as follows:

[0039] S4.6.1: For the current batch of training data set X B Each image sample Use the method in step S3.1 to obtain the image samples from the classifiers in the teacher model and the student model. The randomly enhanced samples get probability distribution Represents the image samples obtained by the classifiers in the teacher model and the student model respectively The probability of belonging to category c and extracting the encoder pair image sample in the student model Features extracted from randomly enhanced samples And the enhanced features obtained by the meta-feature enhancer

[0040] S4.6.2: Determine the image sample using the following formula: The pseudo label y j :

[0041]

[0042] S4.6.3: Update the positive sample p of each category using the following formula c :

[0043]

[0044] Among them, η∈(0,1) represents the preset weight;

[0045] S4.6.4: Iterate over each image sample If its pseudo label y j =c, Then the corresponding enhanced features According to the first-in-first-out principle, the negative sample queue N of category c is sem (c) Update, otherwise do nothing;

[0046] S4.6.5: For the current batch of training data set X B Each image sample The current student model encoder is used to extract the corresponding features, and the spatial feature library N is sorted according to the first-in-first-out principle. spa Make updates;

[0047] S4.7: Let t = t + 1, and return to step S4.2;

[0048] S5: Extract the student model from the trained meta-enhanced contrastive learning model as the target domain model.

[0049] The present invention is a passive unsupervised domain adaptation method based on meta-enhanced contrastive learning, constructs a teacher-student network consisting of a teacher model and a student model, sets a meta-feature enhancer between the teacher model encoder and the classifier to form a meta-enhanced contrastive learning model, constructs a contrastive learning feature library including a positive sample, a negative sample feature library and a spatial feature library and initializes it, then trains the meta-enhanced contrastive learning model based on spatial contrastive learning and semantic contrastive learning, and extracts the student model from the final meta-learning model as the target domain model.

[0050] The present invention has the following beneficial effects:

[0051] 1) The present invention can classify unlabeled target domain images by relying on the pre-trained model in the source domain when the source domain data cannot be accessed, which not only protects the privacy of the source domain data but also solves the problems of large-scale source domain data transmission speed and storage, and improves the adaptability of the target domain model to the target domain in a passive and unsupervised manner;

[0052] 2) The present invention combines spatial contrastive learning and semantic contrastive learning. The two contrastive learning methods complement each other and alleviate the influence of pseudo-label noise on contrastive learning methods to a certain extent.

[0053] 3) The present invention enhances meta-features to force the enhanced features to be on the decision boundary, accurately pushes away feature representations of different classes, and prompts the model to learn distinguishable information, thereby significantly improving the performance of the target domain model. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 It is a flowchart of a specific implementation method of the passive unsupervised domain adaptation method based on meta-enhanced contrastive learning of the present invention;

[0055] Figure 2 It is a flow chart of initializing the comparative learning feature library in the present invention;

[0056] Figure 3 is a schematic diagram of unreliable pseudo-label features in the present invention;

[0057] Figure 4 is a schematic diagram of meta-reinforcement learning in the present invention;

[0058] Figure 5 It is a flow chart of the training of the meta-enhanced contrastive learning model in the present invention;

[0059] Figure 6 It is a flow chart of updating the comparative learning feature library in the present invention. DETAILED DESCRIPTION

[0060] The specific implementation of the present invention is described below in conjunction with the accompanying drawings so that those skilled in the art can better understand the present invention. It should be noted that in the following description, when the detailed description of known functions and designs may dilute the main content of the present invention, these descriptions will be omitted here.

[0061] Example

[0062] Figure 1 1 is a flowchart of a specific implementation of the passive unsupervised domain adaptation method based on meta-enhanced contrastive learning of the present invention. Figure 1 As shown, the specific steps of the passive unsupervised domain adaptation method based on meta-enhanced contrastive learning of the present invention include:

[0063] S101: Build meta-training and meta-testing datasets:

[0064] According to actual needs, M image samples of the target domain are collected to form the meta-training dataset X.

[0065] S102: Initialize the meta-enhanced contrastive learning model:

[0066] The source domain encoder and source domain classifier are determined according to actual needs, and the parameters are extracted to initialize the parameters of the encoder and classifier in the target domain model. The initial target domain model is copied as a teacher model and a student model to form a teacher-student network. A meta-feature enhancer is set between the encoder and the classifier of the teacher model to enhance the feature map extracted by the encoder, and the meta-feature enhancer parameters are randomly initialized to form a meta-enhancement contrastive learning model.

[0067] The specific structure of the meta-feature enhancer can be set according to actual conditions. In this embodiment, the meta-feature enhancer adopts a multi-layer perceptron (MLP).

[0068] S103: Initialize the contrastive learning feature library:

[0069] The present invention considers both semantic-level contrastive learning and spatial-feature-level contrastive learning, exploring the complementary information of the target domain data from two perspectives, thereby improving the encoder's ability to learn data discriminative features without label information. Therefore, it is necessary to initialize the contrastive learning feature library first, including the negative sample feature library and the spatial-feature-level feature library.

[0070] Figure 2 This is a flow chart of initializing the comparative learning feature library in the present invention. Figure 2 As shown, the specific steps of initializing the contrast learning feature library in the present invention include:

[0071] S201: Determine the probability distribution of image samples:

[0072] For each image sample x in the meta-training dataset X i Random enhancement is performed respectively to obtain enhanced samples A(x i ) and are input to the encoder of the teacher model respectively. and the encoder of the student model Get Features in, d represents the dimension of the feature, i=1,2,…,M, w,θ represent the parameters of the teacher model and the student model respectively.

[0073] The teacher model encoder The obtained feature representation Input into the meta-feature enhancer and output enhanced features

[0074] The characteristics and The classifiers input into the teacher model and the student model respectively obtain the corresponding probability distribution Represents the image samples x obtained by the classifiers in the teacher model and the student model respectively i The probability of belonging to category c, c = 1, 2, ..., C, C represents the number of categories.

[0075] S202: Determine the pseudo label of the image sample:

[0076] Different from the existing methods that discard or disregard unreliable pseudo labels, the present invention proposes a pseudo label acquisition method that can provide better distinguishing information through analysis. Figure 3 It is a schematic diagram of unreliable pseudo-label features in the present invention. Figure 3 As shown in the figure, the feature representation close to the decision boundary in category 1 provides strong negative sample information for category 2, and the prototype of category 2 is pulled away from the feature of the decision boundary, which can effectively distinguish category 1 from category 2. Therefore, the present invention uses the following formula to determine the image sample x i The pseudo label y i :

[0077]

[0078] That is to say, the image sample x obtained by the classifier in the teacher model and the student model in the present invention is i The average of the probabilities belonging to category c is then taken, and the maximum of the C averages is selected and its corresponding category is used as the pseudo label.

[0079] S203: Determine positive samples:

[0080] Contrastive learning simply means to bring the image sample x closer i The same type of samples (positive samples) are pushed away from different types of samples (negative samples), which promotes the encoder to represent the same type of samples similarly, while different types of samples are as dissimilar as possible. The difficulty lies in how to construct the sample x i The present invention proposes a new comparative learning method. For the selection of positive samples, the centroids of different classes can be simply obtained according to the semantic information of pseudo labels. That is, the present invention uses the following formula to calculate each category c as a positive sample:

[0081]

[0082] in, represents the centroid of category c, I(y i =c) represents a binary function, when y i =c when I(y i =c) = 1, otherwise I(y i =c)=0.

[0083] S204: Determine the negative sample feature library:

[0084] Construct a negative sample feature library N sem , negative sample feature library N sem It is a list of C queues of length M, and the negative sample queue corresponding to category c is N sem (c) Then, by collecting features provided by unreliable pseudo labels, the semantic negative sample feature library N is filled by category. sem , that is, traverse each image sample x i , if its pseudo label y i =c, 0≤υ≤τ≤1 represents the threshold parameter, then the corresponding enhanced feature Add negative sample queue N of category c sem (c), otherwise no operation is performed. The process can be expressed by the following formula:

[0085]

[0086] S205: Build spatial feature library:

[0087] The spatial information feature library is similar to the classical contrastive learning. First, a feature library N containing all meta-training data sets is constructed. spa In the present invention, for each image sample x in the meta-training dataset X i , the corresponding features are obtained through the student model encoder and filled into the spatial feature library in order middle.

[0088] S104: Training Meta-Enhanced Contrastive Learning Model:

[0089] In the present invention, a meta-learning method is adopted to simultaneously optimize the meta-feature enhancer and the student model, thereby completing the training of the meta-enhanced contrastive learning model. Figure 4 It is a schematic diagram of meta-enhancement learning in the present invention. Figure 4 As shown, the present invention introduces two contrastive learning methods to promote the learning of target features and significantly improve the classification performance of the target domain model: spatial contrastive learning does not rely on pseudo-label information, but instead brings similar samples closer through the neighbor relationship between spatial features; in addition, semantic contrastive learning, when selecting reliable pseudo-labels, forces the enhanced features to be on the decision boundary through meta-feature enhancement, which prompts the model to learn distinguishable representations and more accurately push samples between different classes.

[0090] Based on the above analysis, the specific method of the meta-enhanced contrastive learning model in the present invention can be obtained. Figure 5 Flowchart of the training of the meta-enhanced contrastive learning model in the present invention. Figure 5 As shown, the specific steps of training the meta-enhanced contrastive learning model in the present invention include:

[0091] S501: Set the number of iterations t=1.

[0092] S502: Select the current batch training data set:

[0093] Randomly select B image samples from the meta-training dataset X as the training dataset X for the current batch B .

[0094] S503: Training Meta-enhanced Contrastive Learning Model:

[0095] The model training loss of the student model in the meta-enhanced contrastive learning model is used as the lower-level task, and the model training loss of the meta-feature enhancer is used as the upper-level task. The training dataset X of the current batch is used. B For the meta-enhanced contrastive learning model, the upper-level tasks and the lower-level tasks are iteratively updated alternately to complete the training of the meta-learning model.

[0096] As for the lower-level tasks of the meta-enhanced contrastive learning model, its parameter update can be expressed as follows:

[0097]

[0098] represents the lower-level task loss, and its calculation formula is:

[0099]

[0100] Among them, θ represents the parameters of the student model, represents the parameter of the meta-feature enhancer, λ represents a non-negative tuning factor, They represent the semantic contrastive loss and spatial feature contrastive learning loss of the student model respectively.

[0101] In the present invention, semantic contrast loss Based on the semantic negative sample library, the calculation formula is as follows:

[0102]

[0103] in, represents the training samples in the current batch, Represents the feature extraction of the student model for training samples The extracted features, c j Represents the student model for training samples The predicted category, Represents the predicted category c j The corresponding positive sample, N sem (c j ) indicates the predicted category c j The corresponding negative sample feature queue, p- represents negative samples, || represents the number of samples in the set, and d() represents the distance.

[0104] Considering that semantic contrastive learning is very dependent on the accuracy of pseudo labels, when pseudo labels are very accurate, the semantic contrast loss In order to learn very good distinguishing information, in order to supplement the information of semantic information contrast learning, the present invention does not rely on semantic label information, and constructs contrast learning from feature space. Calculating spatial feature contrast learning loss The specific method is:

[0105] 1) Use K nearest neighbor algorithm to extract the spatial feature library N spa Select and image sample Features The most similar K features are represented as positive samples, thus obtaining a positive sample set The K value is selected according to the size of the data set and is generally set to 2-4.

[0106] 2) The current batch of training data set X B Remove image samples Other image samples other than are taken as negative samples, thus obtaining a negative sample set

[0107] 3) Use the following formula to calculate the feature contrast learning loss

[0108]

[0109] Among them, q k Represents the positive sample set The characteristics of Represents the encoder set of negative samples in the student model Image samples in The extracted features.

[0110] As for the upper-level tasks of the meta-enhanced contrastive learning model, it can be expressed as follows:

[0111]

[0112] in, Represents the upper-level task loss, and the calculation formula is:

[0113]

[0114] Among them, A() represents random enhancement of image samples. Respectively represent the encoder in the student model for image samples And enhanced image samples The extracted features, Indicates the consistency loss. In this embodiment, KL divergence is used to measure the consistency loss. Represents an image sample The entropy value of increases the uncertainty of the image samples. Since the optimization is to find the minimum value, a negative sign is added in front.

[0115] S504: Determine whether t<t max , t max Indicates the maximum number of iterations predicted. If yes, go to step S505, otherwise the training is completed.

[0116] S505: Update teacher model parameters:

[0117] The parameters of the teacher model are updated using the parameters of the current student model. In this embodiment, the teacher model parameter w is updated by the student model parameter θ through the exponential moving average (EMA) method, and the update formula is:

[0118] w=γ×w+(1-γ)θ

[0119] Among them, γ∈(0,1) represents the preset weight.

[0120] S506: Update the comparative learning feature library:

[0121] Next, the data of this batch is used to update the comparative learning feature library. Figure 6 This is a flow chart of updating the comparative learning feature library in the present invention. Figure 6 As shown, the specific steps of updating the comparative learning feature library in the present invention include:

[0122] S601: Determine the probability distribution of image samples:

[0123] For the current batch of training data set X B Each image sample The method in step S201 is used to obtain the image samples from the classifiers in the teacher model and the student model. The randomly enhanced samples get probability distribution Represents the image samples obtained by the classifiers in the teacher model and the student model respectively The probability of belonging to category c and extracting the encoder pair image sample in the student model Features extracted from randomly enhanced samples And the enhanced features obtained by the meta-feature enhancer

[0124] S602: Determine the pseudo label of the image sample:

[0125] The image sample is determined using the following formula The pseudo label y j :

[0126]

[0127] S603: Update positive samples:

[0128] Use the following formula to update the positive sample p of each category c :

[0129]

[0130] Among them, η∈(0,1) represents the preset weight;

[0131] S604: Update negative sample feature library:

[0132] Iterate through each image sample If the pseudo label is satisfied Then the corresponding enhanced features According to the first-in-first-out principle, the negative sample queue N of category c is sem (c) Update, otherwise do nothing.

[0133] S605: Update spatial feature library:

[0134] For the current batch of training data set X B Each image sample The current student model encoder is used to extract the corresponding features, and the spatial feature library N is sorted according to the first-in-first-out principle. spa to update.

[0135] S507: Let t=t+1, and return to step S502.

[0136] S105: Extracting target domain model:

[0137] The student model is extracted from the trained meta-enhanced contrastive learning model as the target domain model.

[0138] In order to better illustrate the technical effect of the present invention, a specific example is used to experimentally verify the present invention. In this experimental verification, the conventional test basic data set Office-31 in the field of passive domain adaptation is used, which consists of three different domains, including the image domain (Amazon) collected by the online e-commerce Amazon, which contains 2,817 images with a single image background; the image domain (Webcam) collected by the webcam contains 795 images, and the images show obvious noise; and the image domain (DSLR) collected by the high-definition single-lens reflex camera contains 498 images, 5 objects in each category. The dataset contains 31 categories of common daily objects, such as laptops, bicycles, keyboards, helmets, etc., with a total of 4652 images. In order to fully reflect the advantages of the present invention, six passive domain adaptation tasks are designed, namely Amazon→DSLR, Amazon→Webcam, DSLR→Webcam, Webcam→DSLR, DSLR→Amazon, Webcam→Amazon.

[0139] In this experimental verification, four comparison methods were set up, namely ResNet50, BCDM (Bi-Classifier Determinacy Maximization), HCL (Model adaptation: Historical contrastive learning) and SHOT++ (Source Hypothesis Transfer and Labeling Transfer).

[0140] The present invention is implemented by PyTorch and trained on NVIDIA RTX3090 GPU. The backbone network used in the present invention adopts ResNet50 network, and the meta-feature enhancer adopts a three-layer MLP network. Table 1 is a statistical table of classification accuracy of the present invention and the comparative method under different tasks in this embodiment.

[0141]

[0142] Table 1

[0143] As shown in Table 1, it can be seen from the results in Table 1 that the present invention achieves the best results in the six adaptive tasks of the Office-31 dataset, thereby verifying the effectiveness of the present invention.

[0144] Although the above describes the illustrative specific embodiments of the present invention to facilitate those skilled in the art to understand the present invention, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.

Claims

1. A passive unsupervised domain adaptation method based on meta-enhanced contrastive learning, It is characterized in that The following steps are involved: S1: Collect M image samples of the target domain according to actual needs to form a meta-training dataset X; S2: Determine the source domain encoder and source domain classifier according to actual needs, extract the parameters to initialize the parameters of the encoder and classifier in the target domain model, copy the initial target domain model as the teacher model and student model to form a teacher-student network; set a meta-feature enhancer between the encoder and classifier of the teacher model to enhance the feature map extracted by the encoder, and randomly initialize the meta-feature enhancer parameters to form a meta-enhancement contrastive learning model; S3: Initialize the contrastive learning feature library, including the positive sample, negative sample feature library and spatial feature library. The specific steps include: S3.1: For each image sample x in the meta-training dataset X i Random enhancement is performed respectively to obtain enhanced samples A(x i ) and are input to the encoder of the teacher model respectively. and the encoder of the student model Get Features in, d represents the dimension of the feature, i = 1, 2, ..., M, w, θ represent the parameters of the teacher model and the student model respectively; The teacher model encoder The obtained feature representation Input into the meta-feature enhancer and output enhanced features The characteristics and The classifiers input into the teacher model and the student model respectively obtain the corresponding probability distribution Represents the image samples x obtained by the classifiers in the teacher model and the student model respectively i The probability of belonging to category c, c = 1, 2, ..., C, C represents the number of categories; S3.2: Determine the image sample x using the following formula i The pseudo label y i : S3.3: Use the following formula to calculate the centroid of each category c as a positive sample: in, represents the centroid of category c, I(y i =c) represents a binary function, when y i =c when I(y i =c) = 1, otherwise I(y i =c)=0; S3.4: Construct a negative sample feature library N sem , negative sample feature library N sem It is a list of C queues of length M, and the negative sample queue corresponding to category c is N sem (c), traverse each image sample x i , if its pseudo label y i =c, 0≤υ≤τ≤1 represents the threshold parameter, then the corresponding enhanced feature Add negative sample queue N of category c sem (c) Otherwise, no action is taken; S3.5: For each image sample x in the meta-training dataset X i , the corresponding features are obtained through the student model encoder and filled into the spatial feature library in order middle; S4: Use meta-learning to optimize the meta-feature enhancer and the student model simultaneously, so as to complete the training of the meta-enhanced contrastive learning model. The specific method is as follows: S4.1: Let the number of iterations t = 1; S4.2: Randomly select B image samples from the meta-training dataset X as the training dataset X for the current batch B ; S4.3: Take the model training loss of the student model in the meta-enhanced contrastive learning model as the lower-level task, take the model training loss of the meta-feature enhancer as the upper-level task, and use the current batch of training dataset X B For the meta-enhanced contrastive learning model, the upper-level tasks and the lower-level tasks are iteratively updated alternately to complete the training of the meta-learning model; among them, the lower-level task loss The calculation formula is: Among them, θ represents the parameters of the student model, represents the parameter of the meta-feature enhancer, λ represents a non-negative tuning factor, Represents the semantic contrast loss and spatial feature contrast learning loss of the student model respectively; semantic contrast loss Based on the semantic negative sample library, the calculation formula is as follows: in, represents the training samples in the current batch, Represents the feature extraction of the student model for training samples The extracted features, c j Represents the student model for training samples The predicted category, Represents the predicted category c j The corresponding positive sample, N sem (c j ) indicates the predicted category c j The corresponding negative sample feature queue, p - represents negative samples, | | represents the number of samples in the set, and d( ) represents the distance; Spatial feature contrastive learning loss The calculation method is: 1) Use K nearest neighbor algorithm to extract the spatial feature library N spa Select and image sample Features The most similar K features are represented as positive samples, thus obtaining a positive sample set 2) The training data set X of the current batch B Remove image samples Other image samples other than are taken as negative samples, thus obtaining a negative sample set 3) Use the following formula to calculate the feature contrast learning loss Among them, q k Represents the positive sample set The characteristics of Represents the encoder set of negative samples in the student model Image samples in The extracted features; Upper task loss The calculation formula is: Among them, A() represents random enhancement of image samples. Respectively represent the encoder in the student model for image samples And enhanced image samples The extracted features, represents the consistency loss, Represents an image sample The entropy value of S4.4: Determine whether t < t max , t max Indicates the maximum number of iterations predicted. If yes, go to step S4.5, otherwise the training is completed; S4.5: update the parameters of the teacher model using the parameters of the current student model; S4.6: Use the data of this batch to update the comparative learning feature library. The specific method is as follows: S4.6.1: For the current batch of training data set X B Each image sample Use the method in step S3.1 to obtain the image samples from the classifiers in the teacher model and the student model. The randomly enhanced samples get probability distribution Represents the image samples obtained by the classifiers in the teacher model and the student model respectively The probability of belonging to category c and extracting the encoder pair image sample in the student model Features extracted from randomly enhanced samples And the enhanced features obtained by the meta-feature enhancer S4.6.2: Determine the image sample using the following formula: The pseudo label y j : S4.6.3: Update the positive sample p of each category using the following formula c : Among them, η∈(0,1) represents the preset weight; S4.6.4: Iterate over each image sample If the pseudo label is satisfied Then the corresponding enhanced features According to the first-in-first-out principle, the negative sample queue N of category c is sem (c) Update, otherwise do nothing; S4.6.5: For the current batch of training data set X B Each image sample The current student model encoder is used to extract the corresponding features, and the spatial feature library N is sorted according to the first-in-first-out principle. spa Make updates; S4.7: Let t = t + 1, and return to step S4.2; S5: Extract the student model from the trained meta-enhanced contrastive learning model as the target domain model.

2. The passive unsupervised domain adaptation method according to claim 1, It is characterized in that The meta-feature enhancer in step S2 adopts a multi-layer perceptron.

3. The passive unsupervised domain adaptation method according to claim 1, It is characterized in that The consistency loss in step S4 KL divergence is used for calculation.

4. The passive unsupervised domain adaptation method according to claim 1, It is characterized in that In step S4.5, the teacher model parameter w is updated by the student model parameter θ through exponential moving average, and the update formula is: w=γ×w+(1-γ)θ Among them, γ∈(0,1) represents the preset weight.

Citation Information

Patent Citations

  • Zero-sample image classification method of adversarial network based on meta-learning

    CN112364894A

  • Small sample fine-grained entity classification method based on relational graph convolutional network

    CN113051399A

  • Multi-cross-domain few-sample classification method based on knowledge distillation

    CN113610173A

  • Robust learning method based on class labels with noise and imbalance

    CN115331088A

  • Unsupervised cross-domain pedestrian re-identification method based on clustering and multi-scale learning

    CN115641613A