An unsupervised adaptation method of linked contrastive learning and computer readable medium

CN117972445BActive Publication Date: 2026-10-20WUHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410007803.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-02
Publication Date
2026-10-20
Estimated Expiration
2044-01-02

AI Technical Summary

Technical Problem

[0008]为了解决上述技术问题,本发明提出了一种链接对比学习的无监督自适应方法及计算机可读介质,通过原型对比学习和域内基于链接的对比学习,从大量无标签的目标域样本中挖掘判别信息,并通过域间基于链接的对比学习,提升域间数据分布不均衡的情况下跨域匹配的准确性

Benefits of technology

[0067]与现有技术相比,本发明针对源域仅由来自每个类别的一个样本组成,目标域包含大量未标记样本的跨域场景,体现了更优的性能,具体而言:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117972445B_ABST
    Figure CN117972445B_ABST
Patent Text Reader

Abstract

The present application is directed to the problem that each category of the source domain only contains a single sample, and the target domain contains a large number of samples to be identified, and proposes an unsupervised adaptive method of link contrast learning and a computer readable medium. On the basis of constructing a contrast learning loss between samples and clustering centers in the target domain, the present application directly constructs links between pairs of samples according to the clustering results, and constructs a contrast learning loss based on the intra-domain links, so that discriminative information can be obtained using a large number of unlabeled target domain samples in the case of lack of source domain supervision information. At the same time, according to the mutual matching relationship between the source domain category cluster and the target domain category cluster, the present application constructs links between the source domain samples and the target domain clustering centers, and between the target domain samples and the source domain clustering centers, and constructs a contrast learning loss based on the inter-domain links, so that accurate semantic matching can be achieved in the case of large differences in the amount of data between domains.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to domain adaptation technology, and more particularly to an unsupervised adaptive method for link-contrast learning and a computer-readable medium. Background Technology

[0002] Domain adaptation aims to solve the problem of knowledge transfer from one domain to another, enabling deep learning models to adapt to data from different domains. Domain adaptation techniques have wide applications in areas such as object recognition and tracking in computer vision, medical image processing, and natural language processing. Link-based contrastive learning is a machine learning technique used to improve data representation and feature learning. Its core idea is to define relationships between samples by constructing links, thereby emphasizing similarities and differences during the learning process.

[0003] In domain adaptation techniques, unsupervised domain adaptation methods aim to solve the domain shift problem. The basic idea is to learn knowledge from a labeled source domain and transfer this knowledge to an unlabeled target domain, achieving adaptation by adjusting the data distribution. However, in some practical applications, obtaining sufficient source domain data is difficult, hindering the application of existing unsupervised domain adaptation methods. To address this issue, a series of new research directions have emerged, including:

[0004] Few-sample unsupervised domain adaptation: This method studies the case where the number of labeled source samples is very limited, but there is still a large amount of unlabeled source data available;

[0005] Domain adaptation without source domain data: This method investigates the case where the adaptation process can only access a large amount of unlabeled target data and a model pre-trained from fully labeled source data.

[0006] This invention investigates a more realistic and challenging situation called single-sample unsupervised domain adaptation, in which the source domain consists of only one sample from each class, and the target domain contains a large number of unlabeled samples.

[0007] Taking a real-world surveillance video face recognition task as an example, each person has only one clear, frontal registered image, and the task is to identify faces at different blurred angles, captured by surveillance cameras installed at high locations (target domain). Due to privacy concerns, it is difficult to obtain additional high-quality images to meet the large amount of unlabeled source data required for few-shot unsupervised domain adaptation, or to learn the pre-trained model required for domain adaptation without source domain data. Therefore, single-shot unsupervised domain adaptation faces a more severe dual challenge: the scarcity of source samples hinders discriminative feature learning; and the quantitative gap between source and target data makes it difficult to align domain distributions. These challenges prevent the direct application of existing methods in single-shot unsupervised domain adaptation environments, thus prompting us to explore tailored solutions for new problems. Summary of the Invention

[0008] To address the aforementioned technical problems, this invention proposes an unsupervised adaptive method for link-based contrastive learning and a computer-readable medium. By using prototype contrastive learning and intra-domain link-based contrastive learning, discriminative information is mined from a large number of unlabeled target domain samples. Furthermore, by using inter-domain link-based contrastive learning, the accuracy of cross-domain matching is improved in cases of uneven data distribution between domains.

[0009] The technical solution adopted in this invention is an unsupervised adaptive method of link contrastive learning, characterized by:

[0010] Collect clear, frontal, face-registered images of each person and label each sample in the source domain to construct the source domain; collect a large number of blurry, multi-angle images of the same group of people through surveillance cameras to construct the target domain;

[0011] Using a shared feature encoder, normalized features are extracted from the source domain. Similarly, using the same feature encoder, normalized features are extracted from the target domain. A source domain memory library is built in the source domain, and a target domain memory library is built in the target domain to store the value of each sample feature and initialize it.

[0012] Based on the target domain features stored in the target domain memory, multiple clusters are obtained through K-means clustering.

[0013] Perform prototype-based contrastive learning on the target domain and link-based contrastive learning on both the source and target domains;

[0014] Obtain the label of the source domain feature corresponding to each sample in the target domain in order to perform a classification task in the target domain;

[0015] The method of the present invention specifically includes the following steps:

[0016] Step 1: Collect clear, frontal face registration images of each person as samples in the source domain, and label each sample in the source domain to construct the source domain; collect a large number of blurry, multi-angle images of the same group of people through surveillance cameras to form the target domain;

[0017] Step 2: Extract the h-th sample from the source domain using a shared feature encoder F. Normalization characteristics Similarly, using the same feature encoder F, the i-th sample is extracted from the target domain. Normalization characteristics And build the source domain memory library in the source domain Build the target domain memory library in the target domain This is used to store the value of each sample feature and initialize it;

[0018] Step 3: Based on the target domain features stored in the target domain memory, obtain K clusters through K-means clustering.

[0019] Step 4: Perform prototype contrastive learning on the target domain and link-based contrastive learning on the source and target domains;

[0020] Step 5: Determine if the overall loss function of the model has converged. If not, update the model weights and use the features f extracted by the model in this step. i , with v i ←λv i +(1-λ)f i The two memory banks are updated using momentum λ∈[0,1], and then the process jumps to step 3; otherwise, step 6 is executed.

[0021] Among them, f i v represents the feature vector of the i-th sample extracted from the source or target domain. i This represents the feature vector stored in the memory database corresponding to the i-th sample in the source or target domain.

[0022] Step 6: Through calculation To obtain the i-th sample in the target domain The corresponding source domain feature labels are used to perform classification tasks in the target domain and identify the identity of face images in the target domain;

[0023] Step 6 Represents the i-th sample in the target domain Corresponding features This represents the feature vector stored in the source domain memory corresponding to the h-th sample in the source domain. Indicates when The value of j when it reaches its maximum value.

[0024] Preferably, the source domain in step 1 is defined as:

[0025]

[0026] Where, N s This indicates the number of different samples in the source domain. Let h represent the h-th sample in the source domain, where h∈[1,N]. s ], Indicates sample Category tags, Represents the set of source domain samples and labels;

[0027] The target domain mentioned in step 1 is defined as:

[0028]

[0029] Where, N t This indicates the number of target domain samples that share the same set of categories as the source domain. This represents the i-th sample in the target domain. Represents the set of samples in the target domain;

[0030] Where, N t >>N s ;

[0031] Preferably, in step 2, when initializing the memory library, the h-th feature vector in the source domain memory library... By extracting the features of the h-th sample in the source domain Perform initialization, that is Similarly, the i-th feature vector in the target domain memory library By extracting the features of the i-th sample in the target domain Perform initialization, that is

[0032] Preferably, the K clusters mentioned in step 3 are defined as follows:

[0033] Where K should take the value of N s Multiples of;

[0034] Among them, the j-th cluster in the K clusters of the target domain The cluster center is defined as These cluster centers are also known as the prototypes of the corresponding categories;

[0035] Since there is only one sample for each category in the source domain, we can directly treat each category as a cluster in the source domain, that is, the h-th cluster in the source domain. Simultaneously, based on the source domain features stored in the source domain memory library, the unique sample features in each cluster are regarded as the prototype of that category, i.e.

[0036] Preferably, step 4 involves performing prototype contrastive learning on the target domain and link-based contrastive learning on both the source and target domains, as detailed below:

[0037] Step 4.1: Perform prototype contrastive learning in the target domain, indirectly aggregating semantically similar samples through prototypes of corresponding categories to learn discriminative features;

[0038] The loss function for prototype-contrastive learning is as follows:

[0039]

[0040] Where, p ij Represents the i-th sample in the target domain Does it belong to the j-th cluster in the target domain? That is, when the conditions are met At that time, p ij =1, otherwise p ij =0;

[0041] Step 4.2: Based on the prototype contrastive learning, perform link-based contrastive learning in the target domain to make the samples in the same cluster more closely connected, while expanding the differences between samples in different clusters.

[0042] First, construct the link q between the i-th sample and the j-th sample in the target domain. ij The target sample pair The link between q ij The formula is as follows:

[0043]

[0044] Among them, P t (i) represents the i-th sample in the target domain. The index of the cluster to which P belongs t (j) represents the j-th sample in the target domain. The index of the cluster to which it belongs, q ij =+1 indicates that the i-th sample and the j-th sample in the target domain belong to the same cluster, q ij =-1 indicates that the i-th sample and the j-th sample in the target domain belong to different clusters. and Let i and j represent the i-th sample and the j-th sample in the target domain, respectively, where i ∈ [1, N]. t ],j∈[1,N t], and i≠j;

[0045] Based on the above link q ij A loss function for intra-domain contrastive learning is constructed, and the intra-domain contrastive learning loss function is as follows:

[0046]

[0047] Where, N t q represents the number of target domain samples that share the same set of categories as the source domain. ih Represents the i-th sample in the target domain and the j-th sample Do they belong to the same cluster? Represents the i-th sample in the target domain Corresponding features Represents the j-th sample in the target domain. The corresponding feature, the first term is through q ih =+1 brings samples in the same cluster closer together, and the second term is passed through q. ij =-1 pushes samples from different clusters apart;

[0048] Step 4.3: Perform inter-domain link-based contrastive learning between the source and target domains to align semantically consistent clusters between the two domains;

[0049] First, tag matching is performed between cross-domain clusters in the source and target domains to build matching links between the source and target domains. The prototype-level measurement method is used in the specific matching process.

[0050] The cross-domain cluster refers to a cluster that is in the source domain and another cluster that is in the target domain;

[0051] Preferably, in step 4.3, if the following conditions are met simultaneously:

[0052] and This indicates cluster pairs They are mutually matched;

[0053] in, This represents the m-th cluster in the source domain. This represents the nth cluster in the target domain;

[0054] Where, sim(C m C n ) indicates from cluster C n To cluster C m The similarity is calculated using a prototype-level measurement method, as shown in the following formula:

[0055]

[0056] in, This represents the prototype of the nth cluster in the target domain. This represents the prototype of the m-th cluster in the source domain. This represents the prototype of the m-th cluster in the source domain. This represents the feature vector stored in the target domain memory corresponding to the k-th sample in the target domain, k∈{l|P t (l)=n},P t (l) represents the l-th sample in the target domain. The index of the cluster to which it belongs;

[0057] Subsequently, source domain clusters are constructed based on the results of mutual matching. and target domain cluster Links between r hj and r jh And based on this link, construct a loss function for inter-domain contrastive learning;

[0058] Preferably, in step 4.3, the features of the h-th sample in the source domain... and the prototype of the j-th cluster in the target domain Links between r hj The formula is as follows:

[0059]

[0060] Among them, R s→t (·) Returns the cluster index in the target domain that matches the given source domain cluster index. If the given source domain cluster does not match any cluster in the target domain, the semantics of the given source domain cluster are said to be uncertain. Let R... s→t (·) returns -1; r hj =+1 indicates a given source domain cluster and target domain cluster They are mutually matched, r hj =-1 indicates a given source domain cluster and target domain cluster They are not mutually matched, and r hj =0 indicates a given source domain cluster and target domain cluster There is no link between them, meaning the source domain cluster is semantically uncertain. Based on this link, a contrastive learning loss from the source domain to the target domain can be constructed:

[0061]

[0062] Where s→t represents the loss function constructed based on the links between the features of samples in the source domain and the cluster prototypes in the target domain, r hj Represents a given source domain cluster and target domain cluster Are they a good match? Represents the h-th sample in the source domain Corresponding features Let represent the prototype of the j-th cluster in the target domain, where the first term is obtained through r. hj =+1 brings the samples and prototypes in matching clusters in the source and target domains closer together; the second term, through r... hj =-1 pushes away samples and prototypes in clusters that do not match in the source and target domains.

[0063] Similarly, the link between the target domain sample and the source domain prototype can be constructed using the method described above, and a contrastive learning loss from the target domain to the source domain can be constructed based on this link. The loss functions in both directions are combined to obtain the total loss function for inter-domain link-based contrastive learning.

[0064] Finally, combining the above three sub-steps, we obtain the overall loss function of the model:

[0065]

[0066] The present invention also provides a computer-readable medium storing a computer program executed by an electronic device, wherein when the computer program is run on the electronic device, it performs the steps of the link contrast learning unsupervised adaptive method.

[0067] Compared with existing technologies, this invention demonstrates superior performance in cross-domain scenarios where the source domain consists of only one sample from each category, and the target domain contains a large number of unlabeled samples. Specifically:

[0068] Intra-domain: Based on prototype contrastive learning, links between target sample pairs are generated, and intra-domain link-based contrastive learning is performed, which improves the efficiency of discriminative feature learning;

[0069] Inter-domain: Mutual matching is performed between the source and target domains, and the similarity between clusters is measured using a prototype-level measurement method. Cross-domain links are constructed based on the results of mutual matching, and semantically consistent cross-domain clusters are aligned through contrastive learning based on inter-domain links, which effectively improves the accuracy of domain alignment. Attached Figure Description

[0070] Figure 1 : Flowchart of the method for implementing this invention. Specific implementation methods

[0071] 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.

[0072] In specific implementation, the method proposed in the technical solution of this invention can be automatically executed by those skilled in the art using computer software technology. System devices for implementing the method, such as computer-readable storage media storing the corresponding computer program of the technical solution of this invention and computer equipment including the computer program running the corresponding computer program, should also be within the protection scope of this invention.

[0073] This invention utilizes the Python platform to conduct simulation experiments on a surveillance video face recognition dataset.

[0074] The following is combined Figure 1 The present invention specifically describes an unsupervised adaptive method for link-contrast learning, and the specific implementation steps are as follows:

[0075] This invention provides an unsupervised adaptive method based on link contrastive learning, addressing the unsupervised domain adaptation problem in scenarios where the source domain consists of only one sample from each class, while the target domain contains a large number of unlabeled samples. It solves the domain offset problem by generating intra-domain links for discriminative feature learning and constructing cross-domain links for domain alignment.

[0076] See Figure 1 The process of the embodiment includes the following steps:

[0077] Step 1: Acquire clear, frontal, face-registered images of each person as samples in the source domain, and label each sample in the source domain to construct the source domain; then, acquire a large number of blurry, multi-angle images of the same group of people using surveillance cameras to form the target domain. Subsequently, images are generated from the source domain... Get N s 100 samples, each from a different category, and from the target domain. Obtain N from t N unlabeled samples that share the same set of categories as the source domain, where N s =46, N t =3803, N t >>N s ;

[0078] Step 2: Extract the h-th sample from the source domain using a shared feature encoder F. Normalization characteristics Similarly, using the same feature encoder F, the i-th sample is extracted from the target domain. Normalization characteristics And build the source domain memory library in the source domain Build the target domain memory library in the target domain This is used to store the value of each sample feature and initialize it;

[0079] When initializing the memory library, the h-th feature vector in the source domain memory library By extracting the features of the h-th sample in the source domain Perform initialization, that is Similarly, the i-th feature vector in the target domain memory library By extracting the features of the i-th sample in the target domain Perform initialization, that is

[0080] Step 3: Within the target domain, perform K-means clustering based on the target domain features stored in the target domain memory to obtain K clusters. Take K / N s =2, where clusters The cluster center is defined as These cluster centers are also called the prototypes of the corresponding categories; and since there is only one sample for each category in the source domain, each category is directly regarded as a cluster in the source domain, that is, the h-th cluster in the source domain. Simultaneously, based on the source domain features stored in the source domain memory library, the unique sample features in each cluster are regarded as the prototype of that category, i.e.

[0081] Step 4, perform prototype contrastive learning on the target domain and link-based contrastive learning on the source and target domains, including the following sub-steps;

[0082] Step 4.1: Perform prototype contrastive learning in the target domain. By indirectly aggregating semantically similar samples through prototypes of corresponding categories, discriminative features are learned. The contrastive learning loss function is as follows:

[0083]

[0084] Where p ij Indicates sample Does it belong to a cluster? That is, when the conditions are met At that time, p ij =1, otherwise p ij =0.

[0085] Step 4.2: Based on the prototype contrastive learning, perform link-based contrastive learning in the target domain to make the samples in the same cluster more closely connected, while expanding the differences between samples in different clusters.

[0086] First, construct the link q between the i-th sample and the j-th sample in the target domain. ij The target sample pair The link between q ij The formula is as follows:

[0087]

[0088] Among them, P t (i) represents the i-th sample in the target domain. The index of the cluster to which P belongs t (j) represents the j-th sample in the target domain. The index of the cluster to which it belongs, q ij =+1 indicates that the i-th sample and the j-th sample in the target domain belong to the same cluster, q ij =-1 indicates that the i-th sample and the j-th sample in the target domain belong to different clusters. and Let i and j represent the i-th sample and the j-th sample in the target domain, respectively, where i ∈ [1, N]. t ],j∈[1,N t ], and i≠j;

[0089] Based on the above link q ij A loss function for intra-domain contrastive learning is constructed, and the intra-domain contrastive learning loss function is as follows:

[0090]

[0091] Where, N t q represents the number of target domain samples that share the same set of categories as the source domain. ij Represents the i-th sample in the target domain and the j-th sample Do they belong to the same cluster? Represents the i-th sample in the target domain Corresponding features Represents the j-th sample in the target domain. The corresponding feature, the first term is through q ij =+1 brings samples in the same cluster closer together, and the second term is passed through q. ij =-1 pushes samples from different clusters apart;

[0092] Step 4.3: Perform inter-domain link-based contrastive learning between the source and target domains to align semantically consistent clusters between the two domains;

[0093] First, tag matching is performed between cross-domain clusters in the source and target domains to build mutually matching links between the source and target domains. The specific matching process is as follows:

[0094] If all conditions are met: and This indicates cluster pairs They are mutually matched, where sim(C) m C n ) indicates from cluster C n To cluster C m The similarity is calculated using a prototype-level measurement method, as shown in the following formula:

[0095]

[0096] Subsequently, source domain clusters are constructed based on the results of mutual matching. and target domain cluster Links between r hj and r jh And based on this link, construct a loss function for inter-domain contrastive learning. Features of the h-th sample in the source domain. and the prototype of the j-th cluster in the target domain Links between r hj The formula is as follows:

[0097]

[0098] Among them, R s→t (·) Returns the cluster index in the target domain that matches the given source domain cluster index. If the given source domain cluster does not match any cluster in the target domain, the semantics of the given source domain cluster are said to be uncertain. Let R... s→t (·) returns -1; r hj =+1 indicates a given source domain cluster and target domain cluster They are mutually matched, r hj =-1 indicates a given source domain cluster and target domain cluster They are not mutually matched, and r hj =0 indicates a given source domain cluster and target domain cluster There is no link between them, meaning the source domain cluster is semantically uncertain. Based on this link, a contrastive learning loss from the source domain to the target domain can be constructed:

[0099]

[0100] Where s→t represents the loss function constructed based on the links between the features of samples in the source domain and the cluster prototypes in the target domain, r hj Represents a given source domain cluster and target domain cluster Are they a good match? Represents the h-th sample in the source domain Corresponding features Let represent the prototype of the j-th cluster in the target domain, where the first term is obtained through r. hj =+1 brings the samples and prototypes in matching clusters in the source and target domains closer together; the second term, through r... hj =-1 pushes away samples and prototypes in clusters that do not match in the source and target domains.

[0101] Similarly, the link between the target domain sample and the source domain prototype can be constructed using the method described above, and a contrastive learning loss from the target domain to the source domain can be constructed based on this link. Finally, the loss functions in both directions are combined to obtain the total loss function for inter-domain link-based contrastive learning;

[0102] Finally, combining the above three sub-steps, we obtain the overall loss function of the model:

[0103]

[0104] Step 5: Determine if the overall loss function of the model has converged. If not, update the model weights and use the features f extracted by the model in this step. i , with v i ←λv i +(1-λ)f i The method involves using momentum λ∈[0,1], taking λ=0.5, updating the two memory banks, and jumping to step 3; otherwise, proceeding to step 6.

[0105] Among them, f i v represents the feature vector of the i-th sample extracted from the source or target domain. i This represents the feature vector stored in the memory database corresponding to the i-th sample in the source or target domain.

[0106] Step 6, through calculation To obtain the i-th sample in the target domain The corresponding source domain feature labels are used to perform classification tasks in the target domain and identify the identity of face images in the target domain;

[0107] in, Represents the i-th sample in the target domain Corresponding features This represents the feature vector stored in the source domain memory corresponding to the h-th sample in the source domain. Indicates when The value of h when the maximum value is obtained.

[0108] This invention uses link-based contrastive learning to generate intra-domain links for discriminative feature learning and construct cross-domain links for domain alignment, providing a solution for the unsupervised domain adaptation problem in single-sample unsupervised domain adaptation scenarios.

[0109] To verify the feasibility of the invention in a real-world single-sample unsupervised adaptive domain scenario, this invention combines the data processing method with various face recognition backbones (including SphereFace, CosFace, ArcFace, VPL, adface, and PartialFC), compares their face recognition accuracy on the aforementioned surveillance video face recognition dataset, and reports the average classification accuracy of all faces. The results are also compared with direct baselines and some existing methods, as shown in Table 1 above.

[0110] Table 1: Facial recognition performance of different backbones on a face recognition dataset in this invention.

[0111]

[0112] In this context, SphereFace, CosFace, ArcFace, VPL, face, and PartialFC represent six different face recognition backbones, Direct represents the direct baseline, CAN, PCS, UCDIR, SDAT, and CAF represent some existing domain adaptation methods that do not require source domain data, NRC, AaD, SFDA-DE, BMD, and GPUE represent some existing few-sample unsupervised domain adaptation methods, and LCL-P represents the method proposed in this invention.

[0113] As shown in the table, this invention achieves a significant performance improvement compared to the direct baseline. Furthermore, it significantly outperforms the existing best baseline method, PCS. These results not only validate the effectiveness of this invention in real-world single-sample unsupervised adaptive scenarios but also highlight its robustness under the synergistic effects of multiple backbone mechanisms.

[0114] The computer-readable medium is a server workstation;

[0115] The server workstation stores a computer program executed by the electronic device. When the computer program runs on the electronic device, it causes the electronic device to perform the steps of the link contrast learning unsupervised adaptive method according to the embodiments of the present invention.

[0116] It should be understood that any parts not described in detail in this specification belong to the prior art.

[0117] It should be understood that the above description of the embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art can make substitutions or modifications under the guidance of this invention without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.

Claims

1. An unsupervised adaptive method for link contrast learning, characterized in that: Collect clear, frontal, face-registered images of each person and label each sample in the source domain to construct the source domain; collect a large number of blurry, multi-angle images of the same group of people through surveillance cameras to construct the target domain; Using a shared feature encoder, normalized features are extracted from the source domain. Similarly, using the same feature encoder, normalized features are extracted from the target domain. A source domain memory library is built in the source domain, and a target domain memory library is built in the target domain to store the value of each sample feature and initialize it. Based on the target domain features stored in the target domain memory library, through... K -means clustering yields multiple clusters. Perform prototype-based contrastive learning on the target domain and link-based contrastive learning on both the source and target domains; Obtain the label of the source domain feature corresponding to each sample in the target domain in order to perform a classification task in the target domain; The specific steps for performing prototype contrastive learning on the target domain and link-based contrastive learning on the source and target domains are as follows: Step 4.1: Perform prototype contrastive learning in the target domain to indirectly aggregate semantically similar samples through prototypes of corresponding categories; The loss function for prototype-contrastive learning is as follows: in, Indicates the first in the target domain Sample Does it belong to the first in the target domain? Clusters , , That is, when the condition is met hour, ,otherwise ; Step 4.2: Perform link-based contrastive learning within the target domain to further bring samples belonging to the same cluster closer together and push away samples belonging to different clusters. First, construct the first [then] in the target domain. The first sample and the first Links between samples Among them, target sample pairs Links between The formula is as follows: in, Indicates the first in the target domain Sample The index of the cluster to which it belongs. Indicates the first in the target domain Sample The index of the cluster to which it belongs. Represents the first element in the target domain. The nth sample, the nth target domain Each sample belongs to the same cluster. Represents the first element in the target domain. The nth sample, the nth target domain The samples belong to different clusters and They represent the first in the target domain, respectively. The nth sample, the nth target domain One sample, , ,and ; Based on the above links A loss function for intra-domain contrastive learning is constructed, and the intra-domain contrastive learning loss function is as follows: in, This indicates the number of target domain samples that share the same set of categories as the source domain. Indicates the first in the target domain Sample and the Sample Do they belong to the same cluster? Indicates the first in the target domain Sample Corresponding features Indicates the first in the target domain Sample The corresponding feature, the first one is passed By bringing samples within the same cluster closer together, the second item... Push the samples from different clusters apart; Step 4.3: Perform inter-domain link-based contrastive learning between the source and target domains to align semantically consistent clusters between the two domains; First, tag matching is performed between cross-domain clusters in the source and target domains to build matching links between the source and target domains. The prototype-level measurement method is used in the specific matching process. The cross-domain cluster refers to a cluster that is in the source domain and another cluster that is in the target domain.

2. The unsupervised adaptive method for link contrast learning according to claim 1, characterized in that: Step 1: Collect clear, frontal face registration images of each person as samples in the source domain, and label each sample in the source domain to construct the source domain; collect a large number of blurry, multi-angle images of the same group of people through surveillance cameras to form the target domain; Step 2: Utilize a shared feature encoder Extract the first from the source domain Sample Normalization characteristics Similarly, this feature encoder is used. Extract the first from the target domain Sample Normalization characteristics and build a source domain memory library in the source domain. Build the target domain memory library in the target domain This is used to store the value of each sample feature and initialize it; Step 3: Based on the target domain features stored in the target domain memory library, through... K -means clustering K One cluster; Step 4: Perform prototype contrastive learning on the target domain and link-based contrastive learning on the source and target domains; Step 5: Determine if the overall loss function of the model has converged. If not, update the model weights and use the features extracted by the model in this iteration. ,by Through momentum Update both memory libraries and proceed to step 3; otherwise, proceed to step 6. in, Indicates the first digit extracted from the source domain or the target domain. The feature vector of each sample Represents the first term in the source or target domain. The feature vectors stored in the memory bank corresponding to each sample; Step 6: Through calculation To obtain the first in the target domain Sample Labels of corresponding source domain features To perform classification tasks in the target domain and identify the identity of face images in the target domain; Step 6 Indicates the first in the target domain Sample Corresponding features Indicates the first in the source domain The feature vectors stored in the source domain memory for each sample Indicates when When the maximum value is obtained The value of .

3. The unsupervised adaptive method for link contrast learning according to claim 2, characterized in that: The source domain mentioned in step 1 is defined as: in, This indicates the number of different samples in the source domain. Indicates the first in the source domain One sample, , Indicates sample Category tags, Represents the set of source domain samples and labels; The target domain mentioned in step 1 is defined as: in, This indicates the number of target domain samples that share the same set of categories as the source domain. Indicates the first in the target domain One sample, Represents the set of samples in the target domain; in, .

4. The unsupervised adaptive method for link contrast learning according to claim 3, characterized in that: In step 2, during the initialization of the memory library, the first [unclear] in the source domain memory library eigenvectors By extracting the first from the source domain Features of a sample Perform initialization, that is ; Similarly, the first in the target domain memory library eigenvectors By extracting the first target domain Features of a sample Perform initialization, that is .

5. The unsupervised adaptive method for link contrast learning according to claim 4, characterized in that: Step 3 K Each cluster is defined as: ; in, K The value should be Multiples of; Among them, the target domain K The first cluster in the cluster Clusters , The cluster center is defined as These cluster centers are also referred to as the prototypes of the corresponding categories; Since there is only one sample for each category in the source domain, we can directly treat each category as a cluster in the source domain, that is, the first cluster in the source domain. Clusters , Simultaneously, based on the source domain features stored in the source domain memory library, the unique sample features in each cluster are regarded as the prototype of that category, i.e. .

6. The unsupervised adaptive method for link contrast learning according to claim 5, characterized in that: In step 4.3, if the following conditions are met simultaneously: and This indicates that the cluster pairs They are mutually matched; in, Indicates the first in the source domain A cluster, Indicates the first in the target domain One cluster; in, Indicates from cluster to cluster The similarity is calculated using a prototype-level measurement method, as shown in the following formula: in, Indicates the first in the target domain A prototype of a cluster, Indicates the first in the source domain A prototype of a cluster, Indicates the first in the source domain A prototype of a cluster, Indicates the first in the target domain The feature vectors stored in the target domain memory for each sample. , Indicates the first in the target domain Sample The index of the cluster to which it belongs; Subsequently, source domain clusters are constructed based on the results of mutual matching. and target domain cluster Links between and And based on this link, a loss function for inter-domain contrastive learning is constructed.

7. The unsupervised adaptive method for link contrast learning according to claim 6, characterized in that: In step 4.3, the first in the source domain Features of a sample and the first in the target domain A cluster prototype Links between The formula is as follows: in, Returns the cluster indexes in the target domain that match the given source domain cluster indexes. If the given source domain clusters do not match any clusters in the target domain, the semantics of the given source domain clusters are said to be undefined. Returns -1; Represents a given source domain cluster and target domain cluster They are mutually matched. This indicates the given source domain cluster. and target domain cluster They are not a perfect match, but Represents a given source domain cluster and target domain cluster There are no links between them, meaning the source domain clusters are semantically uncertain; based on this link, a contrastive learning loss from the source domain to the target domain can be constructed: in, This means that the loss function is constructed based on the links between the features of samples in the source domain and the cluster prototypes in the target domain. Represents a given source domain cluster and target domain cluster Are they a good match? Indicates the first in the source domain Sample Corresponding features This indicates the first term in the target domain. The prototype of a cluster, the first item through The second term brings the samples and prototypes in matching clusters in the source and target domains closer together. Push away samples and prototypes from clusters in the source and target domains that do not match. Similarly, the link between the target domain sample and the source domain prototype can be constructed using the method described above, and a contrastive learning loss from the target domain to the source domain can be constructed based on this link. The loss functions in both directions are combined to obtain the total loss function for inter-domain link-based contrastive learning; Finally, combining the above three sub-steps, we obtain the overall loss function of the model: 。 8. A computer-readable medium, characterized in that, It stores a computer program executed by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the method as described in any one of claims 1-7.