Class Relationship Embedded Learning for Source-Free Unsupervised Domain Adaptation

Yixin Zhang, Zilei Wang, Weinan HeCVPR 2023

Abstract: This work focuses on a practical knowledge transfer task defined as Source-Free Unsupervised Domain Adaptation (SFUDA), where only a well-trained source model and unlabeled target data are available. To fully utilize source knowledge, we propose to transfer the class relationship, which is domain-invariant but still under-explored in previous works. To this end, we first regard the classifier weights of the source model as class prototypes to compute class relationship, and then propose a novel probability-based similarity between target-domain samples by embedding the source-domain class relationship, resulting in Class Relationship embedded Similarity (CRS). Here the inter-class term is particularly considered in order to more accurately represent the similarity between two samples, in which the source prior of class relationship is utilized by weighting. Finally, we propose to embed CRS into contrastive learning in a unified form. Here both class-aware and instance discrimination contrastive losses are employed, which are complementary to each other. We combine the proposed method with existing representative methods to evaluate its efficacy in multiple SFUDA settings. Extensive experimental results reveal that our method can achieve state-of-the-art performance due to the transfer of domain-invariant class relationship.

Introduction

Source-Free Unsupervised Domain Adaptation (SFUDA) is a critical task in modern machine learning, addressing scenarios where a pre-trained source model must be adapted to a target domain without access to the original source data. This constraint often arises from data privacy regulations or logistical challenges in handling massive datasets.

While existing SFUDA methods typically rely on pseudo-labeling or local feature clustering, they frequently overlook a fundamental domain-invariant property: the semantic relationships between classes. For instance, the semantic proximity between a "car" and a "truck" remains consistent across different visual domains (e.g., photos vs. sketches). This paper proposes to leverage these stable class relationships to guide the adaptation process, ensuring that the semantic structure learned in the source domain is preserved and utilized in the target domain.

Methodology

The proposed framework centers on transferring domain-invariant class relationships from the source model to the target domain through a novel contrastive learning approach.

Conceptual overview of Class Relationship embedded contrastive learning and the CRS metric.

Extracting the Source Prior

The method begins by extracting a Class Relationship Matrix ($A^s$) from the source model. The weights of the final classifier layer are treated as class prototypes. By computing the cosine similarity between these weights, the model captures the inherent semantic structure of the source domain. This matrix acts as a map of how classes relate to one another, providing a domain-invariant anchor for adaptation.

Class Relationship embedded Similarity (CRS)

To better represent sample similarities in the target domain, the authors introduce Class Relationship embedded Similarity (CRS). Unlike standard similarity measures that focus solely on intra-class alignment (whether two samples share the same predicted label), CRS incorporates an inter-class term weighted by $A^s$. This allows the model to recognize that two samples are similar if their predicted probability distributions align with known class relationships (e.g., both having high probabilities for "car" and "truck").

Contrastive Learning Objectives

The CRS metric is integrated into two complementary contrastive losses:

  • Class-Aware Contrastive Loss (CR-CACo): This pulls high-confidence target samples toward their predicted class prototypes. By using the class relationship prior, it becomes more robust to the noise of incorrect pseudo-labels.
  • Instance Discrimination Contrastive Loss (CR-IDCo): This ensures that different augmented views of the same image stay close together in the feature space, using the refined CRS metric to better structure the output space.

Experimental Results

The method was evaluated on several major benchmarks, including Office-31, Office-Home, VisDA, and the large-scale DomainNet.

Performance Analysis

The proposed approach achieved state-of-the-art (SOTA) results across all benchmarks. On Office-Home, it reached an average accuracy of 75.9%, significantly outperforming the popular SHOT-IM baseline (70.5%). On the massive DomainNet dataset, it showed improvements of up to 4.1% in multi-source adaptation settings. These results demonstrate the efficacy of leveraging semantic structures for domain transfer, even in the absence of source data.

Insight: Entropy vs. Accuracy

A key finding of this work is the relationship between prediction entropy and accuracy. Traditional methods often employ entropy minimization to force confident, "one-hot" predictions. However, as shown in Figure 3, the proposed method (IM + CACo w/ $s_{cr}$) achieves higher accuracy despite having a broader entropy distribution than baselines. This suggests that maintaining some uncertainty, guided by class relationships, is more beneficial than forcing high confidence in potentially incorrect predictions.

Entropy distribution and accuracy comparison between the proposed method and baselines.

Conclusion

This work demonstrates that class relationships are a powerful, domain-invariant anchor for Source-Free Unsupervised Domain Adaptation. By embedding these relationships into a unified contrastive learning framework via the CRS metric, the proposed method achieves superior performance and robustness. While the method introduces some hyperparameter sensitivity regarding loss weights and confidence thresholds, its ability to leverage semantic structure marks a significant advancement in source-free adaptation. Future work may explore extending this semantic-aware approach to more complex vision tasks such as object detection and semantic segmentation.

Summary updated

BibTeX
@inproceedings{zhang2023class,
  author = {Yixin Zhang and Zilei Wang and Weinan He},
  title = {{Class Relationship Embedded Learning for Source-Free Unsupervised Domain Adaptation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  url = {https://openreview.net/forum?id=hjNyg3skLs},
}
Figure