Active domain adaptation method and system based on dirichlet uncertainty and contrastive structure learning

By employing Dirichlet uncertainty and contrastive structure learning, the problems of overconfidence and neglect of local structure in active domain adaptation are addressed. Through pseudo-label and anchor set optimization, the model's adaptation performance and classification accuracy in the target domain are improved.

CN122433947APending Publication Date: 2026-07-21NANJING UNIV OF POSTS & TELECOMM +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING UNIV OF POSTS & TELECOMM
Filing Date
2026-04-24
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing active domain adaptation methods suffer from overconfident but unreliable predictions when faced with domain shifts, and they ignore local contextual relationships, resulting in low sample selection quality and domain adaptation performance, especially with insufficient utilization of fine-grained category structure in the target domain.

Method used

By employing the Dirichlet uncertainty and contrastive structure learning approach, pseudo-labels are generated and positive and negative anchor sets are divided by calculating the category and data uncertainty measure of the target samples. The model parameters are optimized by combining the Dirichlet distribution, and hybrid augmentation and sample reuse are performed to improve the model's adaptability in the target domain.

Benefits of technology

It significantly improves the model's classification performance and robustness in the target domain, achieving fast domain adaptation and excellent classification results, especially with a limited annotation budget.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122433947A_ABST
    Figure CN122433947A_ABST
Patent Text Reader

Abstract

The application discloses an active domain adaptation method and system based on Dirichlet uncertainty and contrast structure learning, relates to the technical field of artificial intelligence and machine learning, and comprises the following steps: receiving data from a labeled source domain and an unlabeled target domain, modeling prediction uncertainty through Dirichlet distribution, measuring class uncertainty, identifying high-value samples located near the decision boundary by calculating the local distance relationship between the target samples and their neighbor samples, utilizing a contrast learning mechanism to construct a positive and negative anchor set, narrowing the distance between similar samples and widening the distance between different samples, enhancing the compactness within the class and the separability between classes, combining a sample reuse strategy to perform mixed enhancement on high-confidence pseudo-labeled target samples, generating new samples and using the new samples for model training, in each active learning round, first screening candidate samples according to class uncertainty, then selecting final samples based on data uncertainty, and labeling the selected samples for model iterative optimization, and significantly improving the sample selection quality and domain adaptation performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and machine learning, specifically to an active domain adaptation method and system based on Dirichlet uncertainty and contrastive structure learning. Background Technology

[0002] In real-world applications, while deep neural networks perform exceptionally well on similarly distributed data, their performance often degrades significantly when faced with domain shifts. Domain adaptation methods aim to address this issue by transferring knowledge from a labeled source domain to an unlabeled or sparsely labeled target domain. Unsupervised domain adaptation has been extensively studied over the past decade, but in real-world scenarios, it's often possible to significantly improve model performance on the target domain using minimal labeling resources. Therefore, proactive domain adaptation methods have emerged. Their core principle is to actively select and label a subset of high-value target samples during training to more efficiently enhance the model's adaptability to the target domain.

[0003] However, existing active domain adaptation methods have two major limitations: First, most methods rely on softmax-based point estimation for prediction, which can easily lead to overconfident but unreliable predictions when there are large distribution differences, resulting in distorted uncertainty assessment. Second, traditional methods typically assess uncertainty at the single-sample level, ignoring local contextual relationships, making it easy to select noisy or outlier samples, thus hindering model optimization. Furthermore, current methods do not adequately utilize the fine-grained category structure in the target domain and lack further exploration of inter-category structures. This results in low sample selection quality and low domain adaptation performance. Summary of the Invention

[0004] To address the shortcomings mentioned in the background art, the present invention aims to provide an active domain adaptation method and system based on Dirichlet uncertainty and contrastive structure learning.

[0005] Firstly, the objective of this invention can be achieved through the following technical solution: an active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning, the method comprising the following steps: It receives labeled source domain data and unlabeled target domain data, calculates the local distance relationship between the target domain sample and its nearest neighbor sample, generates pseudo-labels based on the nearest neighbor relationship of the features of the unlabeled target domain data in the feature space, and determines the category uncertainty measure of the target sample based on the pseudo-labels and the local distance relationship. The target samples are divided into positive and negative anchor sets based on pseudo-labels and local distance relationships; the contrastive structure learning loss is calculated based on the positive and negative anchor sets; and the data uncertainty measure of the target domain samples is obtained based on the Dirichlet distribution. Based on a preset threshold, high-confidence target samples in unlabeled target domain data are mixed and enhanced to obtain new mixed target samples and corresponding mixed pseudo-labels. Based on the new mixed target samples and corresponding mixed pseudo-labels, cross-entropy loss is calculated to obtain sample reuse loss. The preset threshold is calculated based on pseudo-labels. Candidate samples within the unlabeled target domain data are filtered based on the category uncertainty measure of the target samples. These candidate samples are then labeled based on the data uncertainty measure of the target data, resulting in labeled target domain data. The negative marginal log-likelihood loss is calculated based on the labeled target domain data and the labeled source domain data. KL Divergence loss; Compared with structure learning loss, sample reuse loss, negative marginal log-likelihood loss and KL The divergence loss is used as the objective function to train a pre-established classification model, and the output is the trained classification model. The active domain adaptation performance is improved based on the trained classification model.

[0006] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process of generating pseudo-labels based on the nearest neighbor relationships of features of target samples within unlabeled target domain data in the feature space, comprising: Define 3 memory banks: Used to store features of target domain samples Store all target prediction probability vectors. Used to store neighborhood information between samples for subsequent calculations; For each target sample Search -Nearest neighbor. The formula for obtaining the pseudo-predicted probability vector of a sample is as follows: in Representative sample of Nearest neighbor index, It is a memory bank The first in The nth value represents the nth... The pseudo-predicted probability vector of each target sample; And obtain the target sample The pseudo-tags are defined by the following formula: in This represents the index function.

[0007] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process of determining the category uncertainty measure of the target sample based on the pseudo-label and local distance relationship, as follows: The formula for defining local information between samples is as follows: in Indicates the closest sample of Samples of target domains from different categories Indicates the closest sample of Samples of the same target domain, and Represents memory bank In and sample Characteristics of the nearest neighbors Dimensions representing features; The calculated Store in memory In, and according to Calculate the class uncertainty, which serves as a measure of the class uncertainty of the target sample: The preset threshold is calculated based on the pseudo-labels as follows: in, and They are the same type and different sets.

[0008] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process of dividing the target samples based on pseudo-labels and local distance relationships to obtain a set of positive anchor points and a set of negative anchor points, as follows: set up As a set of positive anchor points As the set of negative anchor points, the set of positive anchor points and the set of negative anchor points are defined as follows: The process of generating a contrastive structure learning loss based on the positive anchor set and the negative anchor set: Based on the distance between sample features and anchor features, the positive anchor point set is sorted in descending order, and the negative anchor point set is sorted in ascending order. The top-ranked anchor points are then selected based on the distance-based ranking. A number of positive and negative samples are formed. and For anchor points in the target domain Define contrastive structure learning loss : The batch-weighted comparison loss is: in Indicates the batch size.

[0009] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process of processing the category uncertainty measure of the target sample based on the Dirichlet distribution to obtain the data uncertainty measure of the target data, including: The Dirichlet evidence model was adopted, which assumes a prediction probability vector. Follows the Dirichle distribution: in Represents the number of categories, Indicates sample The parameters of the Dirichlet distribution, It is the Gamma function. express The unit simplex is used to determine the category to which a sample belongs, based on the formula. The probability of is given by the following formula: Given sample and model parameters To address data uncertainty Quantified as the expected entropy of all reasonable predictions: in, Represents Dirichlet strength. Represents Shannon entropy. It is the digamma function; An evidence model generating a highly concentrated Dirichlet distribution was trained. During training, the model parameters were tuned by jointly optimizing two objectives: the negative marginal log-likelihood. and KL divergence , The calculation formula is as follows: in It is a sample A hot tag vector The One element, This indicates the number of annotated data items in the target domain. Minimize to ensure the accuracy of the prediction; Represented as: in and It is element-wise multiplication. Evidence of ground truth classes was removed; The formula for measuring the uncertainty of the target data is: in This indicates the number of unlabeled data in the target domain.

[0010] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process of performing hybrid enhancement on high-confidence target samples within the unlabeled target domain data based on a preset threshold, comprising: Based on a preset threshold, high-confidence target domain samples are selected for sample reuse. Where b represents the batch size, using the Mixup strategy, in Two target samples are randomly mixed. and and their pseudo-labels and : in , obtain the set , .

[0011] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process of filtering candidate samples within the unlabeled target domain data based on the category uncertainty measure of the target samples, and labeling the candidate samples based on the data uncertainty measure of the target data to obtain labeled target domain data, as follows: The calculated category uncertainty measure for the target sample is selected as 2. B Samples from the target domain are entered into the candidate set as candidate samples. Samples with higher category uncertainty are placed at the decision boundary. The data uncertainty measure of the target domain is used to select the target domain samples. B Each sample is labeled to obtain labeled target domain data, where... B This represents the budget for each round of active sampling.

[0012] Secondly, in order to achieve the above objectives, this invention discloses an active domain adaptation system based on Dirichlet uncertainty and contrastive structure learning, comprising: The category uncertainty module receives labeled source domain data and unlabeled target domain data, calculates the local distance relationship between the target domain sample and its nearest neighbor sample, generates pseudo-labels based on the nearest neighbor relationship of the features of the unlabeled target domain data in the feature space, and determines the category uncertainty measure of the target sample based on the pseudo-labels and the local distance relationship. The data uncertainty module is used to partition target samples based on pseudo-labels and local distance relationships, obtaining a set of positive anchor points and a set of negative anchor points; calculate the contrastive structure learning loss based on the positive anchor points and negative anchor points; and obtain a data uncertainty measure for the target domain samples based on the Dirichlet distribution. The hybrid enhancement module is used to perform hybrid enhancement on high-confidence target samples in unlabeled target domain data based on a preset threshold, to obtain new hybrid target samples and corresponding hybrid pseudo-labels. The sample reuse loss is calculated based on the new hybrid target samples and corresponding hybrid pseudo-labels. The preset threshold is calculated based on the pseudo-labels. The sample labeling module is used to filter candidate samples within the unlabeled target domain data based on the category uncertainty measure of the target samples, and to label the candidate samples based on the data uncertainty measure of the target data, thus obtaining labeled target domain data. The negative marginal log-likelihood loss is calculated based on the labeled target domain data and the labeled source domain data. KL Divergence loss; Active domain adaptation module is used to learn loss by contrasting structure, sample reuse loss, negative marginal log-likelihood loss, and KL The divergence loss is used as the objective function to train a pre-established classification model, and the output is the trained classification model. The active domain adaptation performance is improved based on the trained classification model.

[0013] In another aspect of the present invention, in order to achieve the above-mentioned objective, a terminal device is disclosed, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores the computer program capable of running on the processor. When the processor loads and executes the computer program, it employs the active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning as described above.

[0014] In another aspect of the present invention, in order to achieve the above-mentioned objective, a computer-readable storage medium is disclosed, wherein a computer program is stored in the computer program, and when the computer program is loaded and executed by a processor, it employs the active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning as described above.

[0015] The beneficial effects of this invention are: This invention models prediction uncertainty using the Dirichlet distribution, transforming traditional point estimation into a complete probability distribution, effectively addressing the problem of model overconfidence under domain shift. Building upon this, it innovatively combines a dual evaluation mechanism of class uncertainty and data uncertainty, accurately identifying high-value samples near the decision boundary by analyzing local neighborhood relationships and global distribution characteristics. Simultaneously, it introduces a contrastive learning strategy to construct a set of positive and negative anchor points to optimize the feature space structure, significantly enhancing intra-class compactness and inter-class separability. Furthermore, a sample reuse mechanism is employed to perform hybrid enhancement on high-confidence target samples, improving training efficiency and model robustness. This method significantly outperforms existing state-of-the-art methods on multiple benchmark datasets, achieving fast domain adaptation and superior classification performance with a limited annotation budget. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Figure 1 This is a schematic diagram of the method flow of the present invention; Figure 2 This is a schematic diagram of the active domain adaptation method framework based on Dirichlet uncertainty and contrastive structure learning of the present invention; Figure 3 This is a schematic diagram of the system structure of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Example 1: like Figure 1 As shown, the active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning includes the following steps: S101: Receive labeled source domain data and unlabeled target domain data, calculate the local distance relationship between the target domain sample and its nearest neighbor sample, generate pseudo-labels based on the nearest neighbor relationship of the features of the unlabeled target domain data in the feature space, and determine the category uncertainty measure of the target sample based on the pseudo-labels and the local distance relationship; Given source domain data with labels and unlabeled target domain data ,in Indicates the number of source samples. This indicates the number of target samples. These two fields share a size of [size missing]. The label space exists, but follows a different distribution. The target domain has been labeled. It is initialized to an empty set.

[0019] This invention defines three memory banks. Used to store features of target domain samples Store all target prediction probability vectors. It is used to store neighborhood information between samples for subsequent calculations.

[0020] To better predict the labels of target domain samples, this invention provides a method for each target sample. Search -Nearest neighbor. The formula for obtaining the pseudo-predicted probability vector of a sample is as follows: in Representative sample of Nearest neighbor index, It is a memory bank The first in The nth value represents the nth... The present invention generates a pseudo-predicted probability vector for each target sample. Then, the present invention can directly obtain the target sample. The pseudo-tags are defined by the following formula: in This represents the index function.

[0021] The process of generating pseudo-labels based on the nearest neighbor relationships in the feature space of target samples within unlabeled target domain data includes: By predicting neighboring samples, this invention can obtain more accurate pseudo-labels, thereby better acquiring local information between samples. The formula for defining local information between samples is as follows: in Indicates the closest sample of Samples of target domains from different categories Indicates the closest sample of Samples of the same target domain, and Represents memory bank In and sample Characteristics of the nearest neighbors. This represents the dimension of the feature. Then, the invention will calculate the... Store in memory The value is used to calculate the category uncertainty. S102: The target samples are divided based on pseudo-labels and local distance relationships to obtain a set of positive anchor points and a set of negative anchor points; the contrastive structure learning loss is calculated based on the set of positive anchor points and the set of negative anchor points; the data uncertainty measure of the target domain samples is obtained based on the Dirichlet distribution; To achieve clustering of samples in the target domain, this invention uses threshold filtering to select samples with high training potential. Then, this invention sets... As a set of positive anchor points As a set of negative anchor points. The positive / negative anchor point set is defined as follows: Then, based on the distance between sample features and anchor features, the present invention sorts the positive anchor point set in descending order and the negative anchor point set in ascending order. Based on the distance-based ranking, the present invention selects the top... A number of positive and negative samples are formed. and For anchor points in the target domain This invention defines : The batch-weighted comparison loss is: in This indicates the batch size. This invention considers the corresponding components in the prediction probability vector. If this component value is relatively large, the present invention believes that... A high confidence level indicates confidence; otherwise, a low confidence level indicates confidence. A low confidence level may reflect... Unreliable pseudo-labels generated by the nearest neighbor strategy. Through... By multiplying by the confidence level, the model can focus more on samples with higher confidence and higher training potential.

[0022] The process of processing the class uncertainty measure of the target sample based on the Dirichlet distribution to obtain the data uncertainty measure of the target data includes: To obtain a reliable uncertainty estimate, this invention employs an evidence model based on Dirichlet.

[0023] For image classification tasks, ResNet-50 (pre-trained on ImageNet) was used as the backbone network. ResNet-50 has a mature structure, its pre-trained weights are easy to obtain, and it serves as a strong baseline for classification tasks, facilitating fair comparisons. Simultaneously, by introducing Dirichlet priors, the predictions are transformed from "point estimates" of deterministic models into probability distributions, thus simultaneously addressing the problems of insufficient uncertainty calibration and low sample selection value.

[0024] The model uses a ResNet-50 pre-trained on ImageNet as the backbone network, with an additional fully connected layer as the classifier. Input images are uniformly resized to 256×256 pixels. Following standard ADA settings, the total annotation budget is 5% of the target domain samples, evenly distributed across 5 rounds of selection (1% per round). Label queries are performed in rounds 10, 12, 14, 16, and 18. The optimizer uses mini-batch SGD with a batch size of 32 and a momentum of 0.9. The learning rate is set to 0.005 for Office-Home and miniDomainNet, and 0.001 for Office-31 and VisDA-2017. Hyperparameters such as the number of nearest neighbors K=5 and the weight factor λ=0.05 are used, and the model is trained for 50 rounds.

[0025] The Dirichlet evidence model assumes a predictive probability vector. Following the Dirichlet distribution: in Represents the number of categories, Indicates sample The parameters of the Dirichlet distribution, It is the Gamma function. express The unit simplex. Based on this formula, we can determine which category a sample belongs to. The probability of is given by the following formula: Based on the Dirichlet evidence model, classification prediction It is interpreted as a distribution, rather than a single-point estimate, representing all possible predictions. Specifically, given a sample... and model parameters This invention addresses data uncertainty. Quantified as the expected entropy of all reasonable predictions: in, It represents the intensity of Dirichlet. Represents Shannon entropy. It is the digamma function. Unlike confidence based on softmax, which is prone to calibration errors under domain offset, Dirichlet modeling provides a distributional view of prediction uncertainty, thus enabling more robust and reliable active sample selection.

[0026] To obtain stable and consistent predictions from labeled data, this invention trains an evidence model capable of generating highly concentrated Dirichlet distributions. During training, this invention adjusts the model parameters by jointly optimizing two objectives: the negative marginal log-likelihood (NMR) and the negative marginal log-likelihood. ) and KL divergence ( By forcing the distribution to concentrate at the corners of the simplex, this invention enhances the model's determinism regarding labeled data. The calculation formula is as follows: in It is a sample A hot tag vector The One element, This indicates the number of annotated data items in the target domain. Minimize it to ensure the accuracy of the prediction. As for... It is represented as: in and It is element-wise multiplication. This can be seen as evidence of the removal of ground truth classes. By minimizing... This model tends to reduce redundant categories while suppressing the accumulation of misleading evidence, thereby improving the distinguishability of classification boundaries. Furthermore, this invention improves the distinguishability of classification boundaries by adjusting the number of categories. KL The differences are normalized to balance the bias caused by the size differences between different categories.

[0027] During training, this invention not only optimizes the model using labeled data, but also minimizes the uncertainty loss of unlabeled target data, explicitly reducing the data uncertainty of unlabeled target data, as shown in the formula: in This indicates the number of unlabeled data in the target domain.

[0028] S103: Based on a preset threshold, high-confidence target samples in unlabeled target domain data are mixed and enhanced to obtain new mixed target samples and corresponding mixed pseudo-labels. Based on the new mixed target samples and corresponding mixed pseudo-labels, cross-entropy loss is calculated to obtain sample reuse loss. The preset threshold is calculated based on pseudo-labels. The preset threshold is calculated based on the pseudo-labels as follows: in, and They are the same type and different sets.

[0029] By using a preset threshold, this invention can select high-confidence target domain samples for sample reuse. Where b represents the batch size. Utilizing the Mixup strategy, this invention... Two target samples are randomly mixed. and and their pseudo-labels and : in This invention yields a set. , Then, this invention uses these newly obtained samples for training using cross-entropy.

[0030] S104: Candidate samples within the unlabeled target domain data are filtered based on the category uncertainty measure of the target samples. These candidate samples are then labeled based on the data uncertainty measure of the target data, resulting in labeled target domain data. The negative marginal log-likelihood loss is calculated based on the labeled target domain data and the labeled source domain data. KL Divergence loss; Firstly, this invention is obtained through calculation. Option 2 B Samples from the target domain enter the candidate set, and samples with high class uncertainty are at the decision boundary. Subsequently, this invention calculates... choose B These samples, which exhibit high data uncertainty, can have their performance significantly improved by actively labeling them. B This represents the budget for each round of active sampling.

[0031] S105: Compare the structure learning loss, sample reuse loss, negative marginal log-likelihood loss, and... KL The divergence loss is used as the objective function to train a pre-established classification model, and the output is the trained classification model. The active domain adaptation performance is improved based on the trained classification model.

[0032] The final loss function formula for the model is as follows: Specifically, the present invention will be further illustrated below through embodiments: Dataset comparison experiments: As shown in Tables 1, 2 and 3, the performance of the method of this invention was compared with the baseline method on four datasets. The active learning annotation budget was set to 5% for all datasets. The accuracy of the method of this invention was better than that of the other baseline methods.

[0033] Table 1 shows the performance on the Office-Home dataset. Table 2 shows the performance on the VisDA-2017 and Office-31 datasets. Table 3 shows the performance on the miniDomainNet dataset. Example 2: To achieve the above objective, such as Figure 3 As shown, based on Embodiment 1, this invention discloses an active domain adaptation system based on Dirichlet uncertainty and contrastive structure learning, comprising: The category uncertainty module 11 is used to receive labeled source domain data and unlabeled target domain data, calculate the local distance relationship between the target domain sample and its nearest neighbor sample, generate pseudo labels based on the nearest neighbor relationship of the features of the unlabeled target domain data in the feature space, and determine the category uncertainty measure of the target sample based on the pseudo labels and the local distance relationship. The data uncertainty module 12 is used to divide the target samples based on pseudo-labels and local distance relationships to obtain a set of positive anchor points and a set of negative anchor points; calculate the contrastive structure learning loss based on the set of positive anchor points and the set of negative anchor points; and obtain the data uncertainty measure of the target domain samples based on the Dirichlet distribution. Hybrid enhancement module 13 is used to perform hybrid enhancement on high-confidence target samples in unlabeled target domain data based on a preset threshold, to obtain new hybrid target samples and corresponding hybrid pseudo-labels, and to calculate sample reuse loss based on cross-entropy loss of the new hybrid target samples and corresponding hybrid pseudo-labels, wherein the preset threshold is calculated based on pseudo-labels; The sample labeling module 14 is used to filter candidate samples within the unlabeled target domain data based on the category uncertainty measure of the target samples, and to label the candidate samples based on the data uncertainty measure of the target data to obtain labeled target domain data; the negative marginal log-likelihood loss is calculated based on the labeled target domain data and the labeled source domain data. KL Divergence loss; Active domain adaptation module 15 is used to compare structure learning loss, sample reuse loss, negative marginal log-likelihood loss, and KL The divergence loss is used as the objective function to train a pre-established classification model, and the output is the trained classification model. The active domain adaptation performance is improved based on the trained classification model.

[0034] Based on the same inventive concept, this invention also provides a computer device, comprising: one or more processors, and a memory for storing one or more computer programs; the programs include program instructions, and the processor executes the program instructions stored in the memory. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, used to implement one or more instructions, specifically for loading and executing one or more instructions stored in a computer storage medium to implement the above-described method.

[0035] It should be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, performs the above-described method. This storage medium can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0036] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0037] The foregoing has shown and described the basic principles, main features, and advantages of this disclosure. Those skilled in the art should understand that this disclosure is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of this disclosure. Various changes and modifications can be made to this disclosure without departing from its spirit and scope, and all such changes and modifications fall within the scope of this disclosure as claimed.

Claims

1. An active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning, characterized in that, The method includes the following steps: It receives labeled source domain data and unlabeled target domain data, calculates the local distance relationship between the target domain sample and its nearest neighbor sample, generates pseudo-labels based on the nearest neighbor relationship of the features of the unlabeled target domain data in the feature space, and determines the category uncertainty measure of the target sample based on the pseudo-labels and the local distance relationship. The target samples are divided based on pseudo-labels and local distance relationships to obtain a set of positive anchor points and a set of negative anchor points; The comparative structure learning loss is calculated based on the positive anchor set and the negative anchor set; The data uncertainty measure of the target domain samples is obtained based on the Dirichlet distribution; Based on a preset threshold, high-confidence target samples in unlabeled target domain data are mixed and enhanced to obtain new mixed target samples and corresponding mixed pseudo-labels. Based on the new mixed target samples and corresponding mixed pseudo-labels, cross-entropy loss is calculated to obtain sample reuse loss. The preset threshold is calculated based on pseudo-labels. Candidate samples within the unlabeled target domain data are filtered based on the category uncertainty measure of the target samples, and the candidate samples are labeled based on the data uncertainty measure of the target data to obtain labeled target domain data; The negative marginal log-likelihood loss and [other losses] are calculated based on labeled target domain data and labeled source domain data. KL Divergence loss; Compared with structure learning loss, sample reuse loss, negative marginal log-likelihood loss and KL The divergence loss is used as the objective function to train a pre-established classification model, and the output is the trained classification model. The active domain adaptation performance is improved based on the trained classification model.

2. The active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning according to claim 1, characterized in that, The process of generating pseudo-labels based on the nearest neighbor relationships of features of target samples within unlabeled target domain data in the feature space includes: Define 3 memory banks: Used to store features of target domain samples Store all target prediction probability vectors. Used to store neighborhood information between samples for subsequent calculations; For each target sample Search -Nearest neighbor. The formula for obtaining the pseudo-predicted probability vector of a sample is as follows: in Representative sample of Nearest neighbor index, It is a memory bank The first in The nth value represents the nth... The pseudo-predicted probability vector of each target sample; And obtain the target sample The pseudo-tags are defined by the following formula: in This represents the index function.

3. The active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning according to claim 1, characterized in that, The process of determining the category uncertainty measure of the target sample based on pseudo-labels and local distance relationships is as follows: The formula for defining local information between samples is as follows: in Indicates the closest sample of Samples of target domains from different categories Indicates the closest sample of Samples of the same target domain, and Represents memory bank In and sample Characteristics of the nearest neighbors Dimensions representing features; The calculated Store in memory In, and according to Calculate the class uncertainty, which serves as a measure of the class uncertainty of the target sample: The preset threshold is calculated based on the pseudo-labels as follows: in, and They are the same type and different sets.

4. The active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning according to claim 1, characterized in that, The process of dividing the target samples based on pseudo-labels and local distance relationships to obtain the positive anchor set and the negative anchor set is as follows: set up As a set of positive anchor points As the set of negative anchor points, the set of positive anchor points and the set of negative anchor points are defined as follows: The process of generating a contrastive structure learning loss based on the positive anchor set and the negative anchor set: Based on the distance between sample features and anchor features, the positive anchor point set is sorted in descending order, and the negative anchor point set is sorted in ascending order. The top-ranked anchor points are then selected based on the distance-based ranking. A number of positive and negative samples are formed. and For anchor points in the target domain Define contrastive structure learning loss : The batch-weighted comparison loss is: in Indicates the batch size.

5. The active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning according to claim 1, characterized in that, The process of processing the category uncertainty measure of the target sample based on the Dirichlet distribution to obtain the data uncertainty measure of the target data includes: The Dirichlet evidence model was adopted, which assumes a prediction probability vector. Follows the Dirichle distribution: in Represents the number of categories, Indicates sample The parameters of the Dirichlet distribution, It is the Gamma function. express The unit simplex is used to determine the category to which a sample belongs, based on the formula. The probability of is given by the following formula: Given sample and model parameters To address data uncertainty Quantified as the expected entropy of all reasonable predictions: in, Represents Dirichlet strength. Represents Shannon entropy. It is the digamma function; An evidence model generating a highly concentrated Dirichlet distribution was trained. During training, the model parameters were tuned by jointly optimizing two objectives: the negative marginal log-likelihood. and KL divergence , The calculation formula is as follows: in It is a sample A hot tag vector The One element, This indicates the number of annotated data items in the target domain. Minimize to ensure the accuracy of the prediction; Represented as: in and It is element-wise multiplication. Evidence of ground truth classes was removed; The formula for measuring the uncertainty of the target data is: in This indicates the number of unlabeled data in the target domain.

6. The active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning according to claim 1, characterized in that, The process of performing blending enhancement on high-confidence target samples within unlabeled target domain data based on a preset threshold includes: Based on a preset threshold, high-confidence target domain samples are selected for sample reuse. Where b represents the batch size, using the Mixup strategy, in Two target samples are randomly mixed. and and their pseudo-labels and : in , obtain the set , .

7. The active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning according to claim 1, characterized in that, The process of filtering candidate samples within the unlabeled target domain data based on the category uncertainty measure of the target samples, and labeling the candidate samples based on the data uncertainty measure of the target data to obtain labeled target domain data is as follows: The calculated category uncertainty measure for the target sample is selected as 2. B Samples from the target domain are entered into the candidate set as candidate samples. Samples with higher category uncertainty are placed at the decision boundary. The data uncertainty measure of the target domain is used to select the target domain samples. B Each sample is labeled to obtain labeled target domain data, where... B This represents the budget for each round of active sampling.

8. An active domain adaptation system based on Dirichlet uncertainty and contrastive structure learning, employing the active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning as described in any one of claims 1 to 7, characterized in that, include: The category uncertainty module receives labeled source domain data and unlabeled target domain data, calculates the local distance relationship between the target domain sample and its nearest neighbor sample, generates pseudo-labels based on the nearest neighbor relationship of the features of the unlabeled target domain data in the feature space, and determines the category uncertainty measure of the target sample based on the pseudo-labels and the local distance relationship. The data uncertainty module is used to divide the target samples based on pseudo-labels and local distance relationships, resulting in a set of positive anchor points and a set of negative anchor points. The comparative structure learning loss is calculated based on the positive anchor set and the negative anchor set; The data uncertainty measure of the target domain samples is obtained based on the Dirichlet distribution; The hybrid enhancement module is used to perform hybrid enhancement on high-confidence target samples in unlabeled target domain data based on a preset threshold, to obtain new hybrid target samples and corresponding hybrid pseudo-labels. The sample reuse loss is calculated based on the new hybrid target samples and corresponding hybrid pseudo-labels. The preset threshold is calculated based on the pseudo-labels. The sample labeling module is used to filter candidate samples within the unlabeled target domain data based on the category uncertainty measure of the target sample, and to label the candidate samples based on the data uncertainty measure of the target data to obtain labeled target domain data. The negative marginal log-likelihood loss and [other losses] are calculated based on labeled target domain data and labeled source domain data. KL Divergence loss; Active domain adaptation module is used to learn loss by contrasting structure, sample reuse loss, negative marginal log-likelihood loss, and KL The divergence loss is used as the objective function to train a pre-established classification model, and the output is the trained classification model. The active domain adaptation performance is improved based on the trained classification model.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, The memory stores a computer program that can run on the processor. When the processor loads and executes the computer program, it employs the active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is loaded and executed by the processor, it employs the active domain adaptation method based on Dirichlet uncertainty and contrastive structure learning as described in any one of claims 1 to 7.