An instance-class contrastive learning unsupervised domain adaptation image classification method based on strong enhancement
By employing strong enhancement and instance-class contrastive learning methods, the problem of feature confusion in unsupervised adaptive image classification is solved, achieving accurate feature alignment and efficient classification between the source and target domains.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2025-10-31
- Publication Date
- 2026-08-04
AI Technical Summary
Existing unsupervised domain adaptive image classification methods neglect complex semantic information, especially category information, during the feature alignment process between the source and target domains, leading to feature confusion and decreased classification accuracy. Furthermore, relying on sophisticated data augmentation strategies fails to provide the most discriminative features.
We employ a strong augmentation-based instance-class contrastive learning method. By performing strong and weak data augmentation on the source and target domain data, and combining instance-level and class-level contrastive learning, we utilize class contrastive learning and autocorrelation loss to learn more discriminative features and achieve feature alignment between the source and target domains.
Higher classification accuracy was achieved in the target domain. By introducing latent class information and reasonably dividing positive and negative sample pairs, the similar features were brought closer together and the different features were moved away, thus improving the performance of unsupervised adaptive classification.
Smart Images

Figure CN121482454B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image classification technology of transfer learning, and particularly relates to an unsupervised domain adaptive image classification method based on strong enhancement instance-class contrastive learning. Background Technology
[0002] Over the past few years, deep learning (DL) has been successfully applied to numerous applications and fields due to the availability of vast amounts of labeled data, such as computer vision and image processing, signal processing, autonomous driving, agri-food technology, and medical imaging. Most applications of DL, such as those mentioned above, involve supervised learning, which requires manually labeled datasets—a very time-consuming, cumbersome, and expensive process—leading to the widespread use of certain datasets (such as ImageNet) for model pre-training. Since unlabeled data is largely available and less prone to labeling bias, it tends to provide visual information independent of domain-specific styles. Today, self-supervised visual representation learning has largely closed the gap with supervised learning methods, and in some cases even surpassed them. Contrastive learning is a prominent and increasingly popular self-supervised visual representation learning technique that aims to learn the embedding space by contrasting semantically positive and negative sample pairs.
[0003] However, whether these self-supervised visual representation learning techniques can be effectively applied to domain adaptation has not been satisfactorily explored. When a well-performing model learned from a source training set is applied to different but related target test sets, it is usually assumed that both sets of data come from the same distribution. When this assumption is violated, the DL model trained on the source domain data will not generalize well to the target domain due to the distributional differences between the source and target domains (called domain shift). Learning a discriminative model in the presence of domain shift between the source and target datasets is called domain adaptation.
[0004] Previous unsupervised domain adaptation methods for image classification, while achieving some progress based on contrastive learning, often focused only on the alignment of overall feature distributions between the source and target domains, neglecting the complex semantics inherent in the data, especially the category information of the features. This can lead to feature confusion between different categories, resulting in incorrect alignment of features from different categories in the source and target domains. As shown in Figure 1, squares and triangles represent different categories, and blue and orange represent data augmented from the source and target domains, respectively. Previous methods might incorrectly align squares in the source domain with triangles in the target domain, misclassifying them as the same category and reducing the accuracy of target domain classification. Meanwhile, existing methods often rely on sophisticated data augmentation strategies to maintain instance labels, but these augmentation strategies may not provide the most discriminative features for the domain adaptation classification task, thus limiting the performance of target domain classification. Even if good alignment is achieved between the features of the source and target domains (e.g., ...), the data may still be misaligned. Figure 1 (Triangular classes in the source and target domains) Due to the lack of sufficient discriminative power in the target domain features, classification errors are still unavoidable.
[0005] The main challenges of this task are twofold: (1) In complex datasets, complex semantic information, especially category information, is difficult for the model to recognize, which makes it extremely difficult to mine inherent and transferable knowledge; (2) The learned features are relatively shallow, and the feature level mined by the feature extractor may not be particularly friendly to the classification of the target domain. Summary of the Invention
[0006] To address the aforementioned technical problems, this invention proposes an unsupervised domain adaptive image classification method based on strong augmentation-based instance-class contrastive learning. First, this invention performs strong and weak data augmentation on the source and target domains respectively, using weak data augmentation to constrain strong data augmentation and thus learn more discriminative features. Then, considering that ordinary instance-level contrastive learning cannot learn complex semantic information, this method uses class-level contrastive learning. Based on the idea of label representation, the augmented data samples are projected into a space with dimensions equal to the number of classes. The element can be interpreted as the sample belonging to the th element. The probability of a class allows the feature vector to be regarded as a soft label of the sample; through class contrast learning, instance contrast learning and autocorrelation loss, the currently trained model can efficiently learn more semantic information, and the learned features are more suitable for target domain classification.
[0007] To achieve the above objectives, this invention provides an unsupervised domain adaptive image classification method based on strongly enhanced instance-class contrastive learning, comprising: Step 1: Obtain the source domain data and target domain data of the urban landscape dataset; Step 2: Perform strong data augmentation and weak data augmentation on the source domain data and target domain data respectively. Obtain the instance-level contrast loss and class-level contrast loss of the source domain data and target domain data respectively through the feature extractor. Obtain the cross-entropy loss of the source domain data through the classifier. Step 3: Optimize the source domain instance-level contrast loss, source domain class-level contrast loss, target domain instance-level contrast loss, target domain class-level contrast loss, and source domain cross-entropy loss to obtain a feature extractor that completes feature alignment between the source domain data and the target domain data; Step 4: Based on the feature extractor after feature alignment, share weight parameters to obtain the trained feature extractor and classifier; Step 5: Based on the trained feature extractor and classifier, construct a target domain adaptive image classification model, and use the target domain adaptive image classification model to classify the target domain data to obtain the category information of the target domain image.
[0008] Optionally, performing strong data augmentation and weak data augmentation on the source domain data and target domain data respectively includes: The strong data augmentation adopts an Auto-Augmented augmentation method; The weak data augmentation uses random cropping, random flipping, angle rotation, color change, or Gaussian blur enhancement methods.
[0009] Optionally, the instance-level contrastive loss and class-level contrastive loss of the source domain data obtained through the feature extractor include: The source domain data after strong data augmentation is input into the feature extractor to obtain the first source domain feature, and the source domain data after weak data augmentation is input into the feature extractor to obtain the second source domain feature. The source domain instance-level contrastive loss is calculated based on the first source domain features and the instance-level contrastive learning head. The source domain class-level contrast loss is calculated based on the second source domain features and the class-level contrast learning head.
[0010] Optionally, the instance-level contrastive loss and class-level contrastive loss obtained through the feature extractor for the target domain data include: The target domain data after strong data augmentation is input into the feature extractor to obtain the first target domain feature, and the target domain data after weak data augmentation is input into the feature extractor to obtain the second target domain feature. Calculate the target domain instance-level contrastive loss based on the first target domain features and the instance-level contrastive learning head; The target domain class-level contrastive loss is calculated based on the features of the second target domain and the class-level contrastive learning head.
[0011] Optionally, the cross-entropy loss obtained from the source domain data through the classifier includes: in, For source domain cross-entropy loss, For real labels, To predict probabilities, This represents the number of categories.
[0012] Optionally, optimizations can be made to the source domain instance-level contrast loss, source domain class-level contrast loss, target domain instance-level contrast loss, target domain class-level contrast loss, and source domain cross-entropy loss, including: ; in, The total loss after optimization. For source domain instance-level comparison loss, For source domain class-level comparison loss, For instance-level contrast loss in the target domain, For target domain class-level contrast loss, The source domain cross-entropy loss is used. Optionally, obtaining the trained feature extractor and classifier includes: Repeat steps two to three until the training rounds reach the preset N rounds, and obtain the trained feature extractor and classifier.
[0013] Optionally, the target domain adaptive image classification model includes: a feature extraction module and a classification module; The feature extraction module uses convolutional layers of ResNet-50, and the classification module uses three fully connected layers. The output of the classification module is the probability of each category corresponding to the target domain data, and the category corresponding to the maximum probability is selected as the predicted category of the target domain image.
[0014] Compared with the prior art, the present invention has the following advantages and technical effects: This invention, based on achieving overall alignment of features between the source and target domains, explores and utilizes implicit category information introduced during data augmentation. By rationally dividing positive and negative sample pairs, it constructs a category-level contrastive learning framework, successfully bringing similar features closer together and distancing features from different classes, thus achieving precise category alignment between source and target domain features. To obtain discriminative features suitable for unsupervised adaptive classification, this invention employs a more aggressive data augmentation strategy to reveal more potential semantic information and proposes removing features detrimental to classification by minimizing the distribution difference between weakly and strongly augmented image features. Attached Figure Description
[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 These are comparison diagrams showing the effects of the background technology of this invention; Figure 2 This is a flowchart of an unsupervised domain adaptive image classification method based on strongly enhanced instance-class contrastive learning according to an embodiment of the present invention. Detailed Implementation
[0016] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0017] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0018] The effectiveness of deep networks for image classification is attributed to two fundamental assumptions: first, training and testing samples come from a common dataset or different datasets with similar distributions; second, the training phase has a massive amount of labeled samples. However, these assumptions are difficult to meet in most practical situations. Since domain differences mainly stem from the differences in background between the source and target domains, when the image styles and data distributions of the target and source domains differ significantly, a classification model trained on the source domain will struggle to generalize to the target domain. Secondly, since supervised samples in image classification tasks require labeling object categories, this becomes extremely labor-intensive or even impossible when there are many object types. Furthermore, the lack of a unified standard for manual labeling inevitably introduces human bias.
[0019] Traditional unsupervised domain adaptation, as a branch of transfer learning, is usually limited to category information in image classification. The learned model has low recognition accuracy in complex scenes and cannot be extended to all use cases.
[0020] Using this setup, the learning process is expected to fully leverage the discriminative features exposed by strong data augmentation, while using category information to drive the clustering of features belonging to the same category and the dispersion of features from different categories, achieving high recognition accuracy in the target domain. This setup has significant value in practical applications. For example, in autonomous driving, a model is expected to operate in real-world environments with varying lighting, weather, and urban landscapes, making it difficult to collect annotated data for all environments. Similarly, in the automatic detection of hazardous behaviors in industrial scenarios, the significant differences in industrial production environments make it difficult to use a model trained in a specific scenario to infer and predict hazardous operations in different scenarios. Therefore, unsupervised domain adaptation has great application value in real-world production and daily life.
[0021] To achieve the above objectives, this embodiment proposes an unsupervised domain adaptive image classification method based on strongly enhanced instance-class contrastive learning, such as... Figure 2 As shown, the specific steps include: Step 1: Obtain the source domain data and target domain data of the urban landscape dataset; Step 2: Perform strong data augmentation and weak data augmentation on the source domain data and target domain data respectively. Obtain the instance-level contrast loss and class-level contrast loss of the source domain data and target domain data respectively through the feature extractor. Obtain the cross-entropy loss of the source domain data through the classifier. Step 3: Optimize the source domain instance-level contrast loss, source domain class-level contrast loss, target domain instance-level contrast loss, target domain class-level contrast loss, and source domain cross-entropy loss to obtain a feature extractor that completes feature alignment between the source domain data and the target domain data; Step 4: Based on the feature extractor after feature alignment, share weight parameters to obtain the trained feature extractor and classifier; Step 5: Based on the trained feature extractor and classifier, construct a target domain adaptive image classification model, and use the target domain adaptive image classification model to classify the target domain data and obtain the category information of the target domain image.
[0022] Specifically, strong data augmentation helps the feature extractor learn more discriminative features, while weak data augmentation guides the features to avoid large shifts, thus better serving classification tasks. Using a feature extractor, we obtain the instance contrast loss and class contrast loss of the source domain data and the target domain data respectively, and using classifier C, we obtain the cross-entropy loss of the source domain data. Optimize the contrast loss and cross-entropy loss to align the source domain data and the target domain data; Based on the aligned feature extractor, the weight parameters are shared to obtain the trained feature extractor and classifier C. Based on the trained feature extractor and classifier C, a classification model for single-source target domain adaptive image classification that guarantees classification performance is constructed, and the target domain is classified based on the classification model.
[0023] Furthermore, strong data augmentation and weak data augmentation are performed on the source domain data and target domain data respectively, including: Strong data augmentation uses an auto-Augmented augmentation method; Weak data augmentation uses random cropping, random flipping, angle rotation, color change, or Gaussian blur enhancement methods.
[0024] Specifically, strong data enhancement is used to expose discriminative features, and then instance contrast loss and class contrast loss are obtained for source domain data and target domain data respectively, including: Two contrast learning heads are set up; the two contrast learning heads have different output dimensions. The first contrast learning head ICH is used for instance-level contrast learning and has an output dimension of 128, while the second contrast learning head CCH is used for class-level contrast learning and has an output dimension of the number of classes. Strong data augmentation and weak data augmentation are performed on the source domain data and target domain data respectively. The guidance of weak data augmentation is used to ensure that strong data augmentation can obtain discriminative features while ensuring that the features are not too aggressive. The augmented data is input into the feature extractor G, and the two-class contrast loss of the source domain data and the target domain data are calculated respectively.
[0025] Furthermore, the instance-level contrastive loss and class-level contrastive loss of the source domain data obtained through the feature extractor include: The source domain data after strong data augmentation is input into the feature extractor to obtain the first source domain feature, and the source domain data after weak data augmentation is input into the feature extractor to obtain the second source domain feature. The source domain instance-level contrastive loss is calculated based on the first source domain features and the instance-level contrastive learning head. The source domain class-level contrast loss is calculated based on the second source domain features and the class-level contrast learning head.
[0026] Furthermore, the instance-level contrastive loss and class-level contrastive loss for the target domain data obtained through the feature extractor include: The target domain data after strong data augmentation is input into the feature extractor to obtain the first target domain feature, and the target domain data after weak data augmentation is input into the feature extractor to obtain the second target domain feature. Calculate the target domain instance-level contrastive loss based on the first target domain features and the instance-level contrastive learning head; The target domain class-level contrastive loss is calculated based on the features of the second target domain and the class-level contrastive learning head.
[0027] Specifically, the comparative loss is: in, Indicates comparative loss, and These represent positive sample pairs from the source domain instance comparison learning. and These represent positive sample pairs from source domain class-level contrastive learning; and These represent positive sample pairs in the target domain instance comparison learning. and These represent positive sample pairs in the target domain class-level contrastive learning.
[0028] Furthermore, the cross-entropy loss obtained from the source domain data through the classifier includes: in, For source domain cross-entropy loss, For real labels, To predict probabilities, This represents the number of categories.
[0029] Furthermore, optimizations are made to the source domain instance-level contrast loss, source domain class-level contrast loss, target domain instance-level contrast loss, target domain class-level contrast loss, and source domain cross-entropy loss, including: ; in, The total loss after optimization. For source domain instance-level comparison loss, For source domain class-level comparison loss, For instance-level contrast loss in the target domain, For target domain class-level contrast loss, This represents the source domain cross-entropy loss.
[0030] Furthermore, obtaining the trained feature extractor and classifier includes: Repeat steps two to three until the training reaches the preset N epochs, and obtain the trained feature extractor and classifier.
[0031] Specifically, obtaining the trained feature extractor G and classifier C includes: (1) Perform strong and weak data augmentation on the source domain data and target domain data, and input the augmented source domain data into the feature extractor G to obtain features. and And calculate and obtain two contrast losses. and ; (2) Similarly, the enhanced source domain data is input into the feature extractor G to obtain features. and And calculate and obtain two contrast losses. and ; (3) Input the source domain data into classifier C and obtain the cross-entropy loss. ; (4) Optimize the above five losses Align the source and target domains, and ensure that the semantic information of the source domain is not lost during training; (5) Repeat (1) to (4) until N epochs have been learned, and obtain the trained feature extractor and classifier.
[0032] Furthermore, the target domain adaptive image classification model includes: a feature extraction module and a classification module; The feature extraction module uses convolutional layers from ResNet-50, and the classification module uses three fully connected layers. The output of the classification module is the probability of each category corresponding to the target domain data. The category with the highest probability is selected as the predicted category of the target domain image.
[0033] The following is combined Figure 2 This embodiment will be described in detail: Step 1: Feed the labeled source domain data S and target domain data T into the feature extractor. Use two different data augmentation schemes: use strong data augmentation to expose more discriminative features, and use weak data augmentation to provide corresponding guidance to avoid features being too biased.
[0034] Step 1-1: Set up two different data augmentations. One is ordinary data augmentation, which simply changes the image. This invention calls it weak data augmentation. The other is Auto-Augmented, which can change the style of the image. This invention calls it strong data augmentation. Steps 1-2: Perform the above two data augmentation techniques on the source domain samples and the target domain samples respectively, to obtain... , and , ;in , These represent samples from the source domain data after strong and weak data augmentation, respectively. , These represent samples of the target domain data after strong data augmentation and weak data augmentation, respectively.
[0035] Step 2: Through the instance comparison learning module and the class-level comparison learning module, learn the features of fine-grained alignment between the source domain and the target domain, and complete the training of the model; Step 2-1: Feed the source domain samples into classifier C, calculate and obtain the cross-entropy loss. ; Step 2-2: Feed the source domain enhancement samples completed in the previous step into the feature extractor G to obtain the features. and .
[0036] Steps 2-3: Feed the target domain enhancement samples completed in the previous step into the feature extractor G to obtain the features. and .
[0037] Steps 2-4: Calculate instance-level contrastive loss and class-level contrastive loss for the augmented samples in the source domain: , ; Steps 2-5: Calculate instance-level contrastive loss and class-level contrastive loss for the augmented samples in the target domain: , ; Steps 2-6: Optimize the above five losses Align the source and target domains, and ensure that the semantic information of the source domain is not lost during training; Step 3: Repeat steps 2-1 to 2-6 until N epochs of training have been completed; Step 4: Save the final trained feature extractor G and classifier C, which gives us a model (G+C) for unsupervised adaptive image classification that guarantees classification performance. This model can achieve effective classification results in the target domain.
[0038] Classification models are used to accurately classify target domains, such as various vehicle, pedestrian, and traffic light categories in the field of autonomous driving. By adopting unsupervised domain adaptation methods, classification models can achieve high classification accuracy across multiple unlabeled target domains (approaching the accuracy of labeled self-supervised training).
[0039] In this embodiment, the detailed implementation steps are as follows: S1. Labeled source domain data S (e.g., urban landscape dataset under normal weather conditions required for autonomous driving) and target domain data T1 (e.g., urban landscape dataset under rainy weather conditions) are fed into the feature extractor G, which is optimized using instance-level contrastive loss. The goal of instance-level contrastive learning is to maximize the similarity between positive pairs and minimize the similarity between negative pairs. A mini-batch of N random urban landscape images is selected. Each anchored image x is applied with two types of data augmentation: the first weak data augmentation includes random cropping, random flipping, rotation by a certain angle, color changes, Gaussian blur, etc., and the second strong data augmentation is Auto-Augmented, creating identical samples. and Two views are used to obtain 2N urban landscape images, and the other 2(N-1) augmented image samples are treated as negative pairs. The contrast loss is defined as follows: in, This is an indicator function; its value is 0 when k=i. Representing hidden representations and The cosine similarity between them, where N is the batch size and t is the temperature parameter. and The representation vector of a pair of positive samples ( and Obtained through feature extractor and projection and ).
[0040] S2. Apply class-level contrastive learning to the augmented samples from the source domain. Based on the idea of label representation, we project the data samples into a space with a dimension equal to the number of classes, and the feature vector... The element can be interpreted as the sample belonging to the th element. The probability of a class allows the feature vector to be viewed as a soft label for a sample. Formally, let... For the output of category contrast learning under weak data augmentation, ( (Output under strong enhancement). It can be understood as The nth row and mth column represent the sample Belongs to class The probability of, where For batch size, This represents the number of categories for the item images. Since each sample belongs to only one class, ideally... Each row should approximate a one-hot vector. From this perspective, The The column can be regarded as the first The representation of classes should be used, and all columns should be kept as distinct as possible. This invention uses a two-layer nonlinear multilayer perceptron: To project the features into an M-dimensional space, represented as ,in ( The (row) represents a sample Soft tags. For clarity, let's set... for The Column, representing the first The representation of the class under the first data augmentation, we compare it with (That is, the representation of this class under the second enhancement) combined with the positive class pair And other Each class pair is retained as a negative sample pair. The comparative loss is as follows: in, This is an indicator function; its value is 0 when k=i. Representing hidden representations and The cosine similarity between them, where M is the number of categories and t is the temperature parameter. and The representation vector of a pair of positive samples ( and Obtained through feature extractor and projection and ).
[0041] S2. In this embodiment, contrastive learning is applied to both the source and target domains. The contrastive learning loss within the two domains is defined as follows: in, Indicates comparative loss, and These represent positive sample pairs from the source domain instance comparison learning. and These represent positive sample pairs from source domain class-level contrastive learning; and These represent positive sample pairs in the target domain instance comparison learning. and These represent positive sample pairs in the target domain class-level contrastive learning.
[0042] S3. Feed the source domain samples into classifier C and calculate and obtain the cross-entropy loss. ; The optimized loss function at this point is: In this embodiment, the classification model selects the convolutional layer of ResNet-50 as the feature extractor C. The classifier C uses a three-layer fully connected layer, and its output is the probability of each class corresponding to the sample. The class with the highest probability is selected as the predicted class. Here, "sample" refers to the data in the target domain currently being trained, because the source domain has labels and there is no need to predict the class.
[0043] In this embodiment, positive samples are obtained by data augmentation of samples within each domain, and other samples are negative samples. The source domain and target domain are brought closer by minimizing the contrastive learning loss.
[0044] In this embodiment, positive samples are obtained by performing strong and weak data augmentation on samples within each domain, while other samples are negative samples. By minimizing instance-level contrastive learning loss and class-level contrastive learning loss, the source domain and target domain are brought closer together in a fine-grained manner, ensuring the accuracy of target domain classification.
[0045] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A strong augmentation based instance-class contrastive learning unsupervised domain adaptation image classification method, characterized in that, include: Step 1: Obtain the source domain data and target domain data of the urban landscape dataset; Step 2: Perform strong data augmentation and weak data augmentation on the source domain data and target domain data respectively. Obtain the instance-level contrast loss and class-level contrast loss of the source domain data and target domain data respectively through the feature extractor. Obtain the cross-entropy loss of the source domain data through the classifier. The strong data augmentation and weak data augmentation performed on the source domain data and target domain data respectively include: The strong data augmentation adopts an Auto-Augmented augmentation method; The weak data augmentation uses random cropping, random flipping, angle rotation, color change, or Gaussian blur enhancement methods. The instance-level contrastive loss and class-level contrastive loss obtained from the source domain data through the feature extractor include: The source domain data after strong data augmentation is input into the feature extractor to obtain the first source domain feature, and the source domain data after weak data augmentation is input into the feature extractor to obtain the second source domain feature. The source domain instance-level contrastive loss is calculated based on the first source domain features and the instance-level contrastive learning head. The source domain class-level contrastive loss is calculated based on the second source domain features and the class-level contrastive learning head. The instance-level contrastive loss and class-level contrastive loss obtained by the feature extractor for the target domain data include: The target domain data after strong data augmentation is input into the feature extractor to obtain the first target domain feature, and the target domain data after weak data augmentation is input into the feature extractor to obtain the second target domain feature. Calculate the target domain instance-level contrastive loss based on the first target domain features and the instance-level contrastive learning head; Calculate the target domain class-level contrastive loss based on the second target domain features and the class-level contrastive learning head; Step 3: Optimize the source domain instance-level contrast loss, source domain class-level contrast loss, target domain instance-level contrast loss, target domain class-level contrast loss, and source domain cross-entropy loss to obtain a feature extractor that completes feature alignment between the source domain data and the target domain data; Step 4: Based on the feature extractor after feature alignment, share weight parameters to obtain the trained feature extractor and classifier; Step 5: Based on the trained feature extractor and classifier, construct a target domain adaptive image classification model, and use the target domain adaptive image classification model to classify the target domain data and obtain the category information of the target domain image.
2. The strong augmentation based instance-class contrastive learning unsupervised domain adaptive image classification method according to claim 1, characterized in that, The cross-entropy loss obtained by the classifier from the source domain data includes: wherein, is the source domain cross-entropy loss, is the true label, is the predicted probability, is the number of classes.
3. The strong augmentation based instance-class contrastive learning unsupervised domain adaptive image classification method according to claim 1, characterized in that, Optimizations were made to the source domain instance-level contrast loss, source domain class-level contrast loss, target domain instance-level contrast loss, target domain class-level contrast loss, and source domain cross-entropy loss, including: in, The total loss after optimization. For source domain instance-level comparison loss, For source domain class-level comparison loss, For instance-level contrast loss in the target domain, For target domain class-level contrast loss, This represents the source domain cross-entropy loss.
4. The strong augmentation based instance-class contrastive learning unsupervised domain adaptive image classification method according to claim 1, characterized in that, Obtaining the trained feature extractor and classifier includes: Repeat steps two to three until the training rounds reach the preset N rounds, and obtain the trained feature extractor and classifier.
5. The strong augmentation based instance-class contrastive learning unsupervised domain adaptive image classification method according to claim 1, characterized in that, The target domain adaptive image classification model includes: a feature extraction module and a classification module; The feature extraction module uses convolutional layers of ResNet-50, and the classification module uses three fully connected layers. The output of the classification module is the probability of each category corresponding to the target domain data, and the category corresponding to the maximum probability is selected as the predicted category of the target domain image.