论文信息

论文标题:Cross-domain Contrastive Learning for Unsupervised Domain Adaptation
论文作者:Rui Wang, Zuxuan Wu, Zejia Weng, Jingjing Chen, Guo-Jun Qi, Yu-Gang Jiang
论文来源:aRxiv 2022
论文地址:download 
论文代码:download

1 Introduction

  无监督域自适应(UDA)的目的是将从一个完全标记的源域学习到的知识转移到一个不同的未标记的目标域。 大多数现有的 UDA 方法通过最小化域间的特征距离来学习域不变的特征表示。

  UDA 研究方向:

    • discrepancy-based methods:最小化不同域之间的差异;  
    • adversarial-based methods:为域鉴别器设计一个对抗性优化目标,并通过对抗性学习获得域不变表示;
    • domain-adaptive dictionary learning;
    • multi-modality representation learning;
    • feature disentanglement;
  Source Data-free UDA:近年来,由于UDA方法在实际应用中对源数据隐私性的关注,提出了无源数据的 UDA 方法。无源数据 UDA 的主要挑战是,在源域上的预先训练好的模型应该适应于目标域,而无需访问源数据。
  在训练过程中,UDA 假设可以访问源域中的所有标记样本以及来自目标域的未标记图像。
  Given a fully-labeled source domain dataset with  $N_{s}$  image and label pairs  $D_{s}=   \left(\mathcal{X}_{s}, \mathcal{Y}_{s}\right)=\left\{\left(x_{s}^{i}, y_{s}^{i}\right)\right\}_{i=1}^{N_{s}}$ , and an unlabeled dataset in a target domain with  $N_{t}$  images  $D_{t}=X_{t}=\left\{x_{t}^{i}\right\}_{i=1}^{N_{t}}$ , both  $\left\{x_{s}^{i}\right\}$  and  $\left\{x_{t}^{i}\right\}$  belong to the same set of  $M$  predefined categories. We use  $y_{s}^{i} \in\{0,1, \ldots, M-1\}$  to represent the label of the  $i-\text{th}$ source sample while the labels of target samples are unknown during training. UDA aims to predict labels of testing samples in the target domain using a model  $f_{t}: \mathcal{X}_{t} \rightarrow \mathcal{Y}_{t}$  trained on  $D_{s} \cup D_{t}$ . The model, parameterized by  $\theta$  consists of a feature encoder  $g: X_{t} \rightarrow \mathbb{R}^{d}$  and a classifier  $h: \mathbb{R}^{d} \rightarrow \mathbb{R}^{M}$ , where  $d$  is the dimension of features produced by the encoder.

  我们的目标是通过对比自监督学习来调整源域和目标域之间的特征分布。

2 方法

A. Contrastive Learning with InfoNCE

NT-Xent loss

    $\mathcal{L}=-\sum\limits _{\boldsymbol{v}^{+} \in V^{+}} \log \frac{\exp \left(\boldsymbol{u}^{\top} \boldsymbol{v}^{+} / \boldsymbol{\tau}\right)}{\exp \left(\boldsymbol{u}^{\top} \boldsymbol{v}^{+} / \boldsymbol{\tau}\right)+\sum\limits_{\boldsymbol{v}^{-} \in V^{-}} \exp \left(\boldsymbol{u}^{\top} \boldsymbol{v}^{-} / \boldsymbol{\tau}\right)}  \quad\quad\quad(1)$

B. Cross-domain Contrastive Learning

  考虑目标域样本$\boldsymbol{x}_{t}^{i}$ 的 $\ell_{2}\text{-normalized}$ 特征 $\boldsymbol{z}_{t}^{i}$ 作为锚,它的正样本为同一类的源域样本,其特征表示为 $\boldsymbol{z}_{s}^{p}$,那么跨域对比损失:

    $\mathcal{L}_{C D C}^{t, i}=-\frac{1}{\left|P_{s}\left(\hat{y}_{t}^{i}\right)\right|} \sum\limits _{p \in P_{s}\left(\hat{y}_{t}^{i}\right)} \log \frac{\exp \left(\boldsymbol{z}_{t}^{i^{\top}} \boldsymbol{z}_{s}^{p} / \tau\right)}{\sum\limits_{j \in I_{s}} \exp \left(\boldsymbol{z}_{t}^{i^{\top}} \boldsymbol{z}_{s}^{j} / \tau\right)} \quad\quad\quad(2)$

  其中,$I_{S}$ 代表一个 mini-batch 中的源域样本集合,$P_{s}\left(\hat{y}_{t}^{i}\right)=\left\{k \mid y_{s}^{k}=\hat{y}_{t}^{i}\right\}$ 代表源域和目标域样本 $x_{t}^{i}$ 有相同标签;

  同理也可以使用源域样本作为锚,公式类似上面,交叉域对比损失如下:

    $\mathcal{L}_{C D C}=\sum\limits _{i=1}^{N_{s}} \mathcal{L}_{C D C}^{s, i}+\sum\limits_{i=1}^{N_{t}} \mathcal{L}_{C D C}^{t, i} \quad\quad\quad(3)$

  最后,结合跨域对比损失与在源域上强制执行的标准跨熵损失 $\mathcal{L}_{C E}$,我们得到了最终的训练目标函数:

    $\underset{\boldsymbol{\theta}}{\operatorname{minimize}} \quad \mathcal{L}_{C E}\left(\boldsymbol{\theta} ; D_{s}\right)+\lambda \mathcal{L}_{C D C}\left(\boldsymbol{\theta} ; D_{s}, D_{t}\right) \quad\quad\quad(4)$

C. Pseudo Labels for the Target Domain

  在训练过程中,没有来自目标域的真实标签,因此利用 k-means 聚类产生伪标签。由于 K-means 对初始化很敏感,因此使用随机生成的集群不能保证与预定义类别相关的相关语义。为缓解这个问题,将簇的数量设置为类 $M$ 的数量,并使用来自源域的类原型作为初始簇。

  初始化集群中心与类原型的好处是双重的: (i) 源原型可以被视为目标原型的近似,因为使用的特性是高级和包含语义信息(ii)CDCL 的对齐相同类别的样本,这种近似将更准确的训练的继续。更正式地说,首先计算每个类别中源样本的质心作为相应的类原型,并将第 $m$ 类的初始簇中心 $O_{t}^{m}$ 定义为:

    $O_{t}^{m} \leftarrow O_{s}^{m}=\mathbb{E}_{i \sim D_{s}\;, \; y_{s}^{i}=m} z_{s}^{i} \quad\quad\quad(5)$

   即:源域同一类的嵌入平均作为初始质心。 

D. Source Data-free UDA

  Source data-free setting:提供了在源域上训练的模型,但由于数据安全的问题,源域数据是不能用的。形式上,目标是学习一个模型 $f_{t}: X_{t} \rightarrow Y_{t}$ 并使用目标域无标签数据 $D_{t}$ 和源域上的预训练模型  $f_{s}: X_{s} \rightarrow Y_{s}$ 去预测 $\left\{y_{t}^{i}\right\}_{i=1}^{N_{t}}$。

  Note:预训练模型 $f_{s}$ 是上文提到的通过交叉熵优化得到的。

  许多标准的 UDA 设置,假设在源域和目标域上共享相同的特征编码器,然而由于特征编码器不能同时在源域和目标域上训练,所以 Source Data-free UDA 无法实现。本文的 CDCL 在缺少源域数据的情况下面临的挑战是 :(1) form positive and negative pairs and (2) to compute source class prototypes。

  本文通过用训练模型 $_$ 的分类器权值替换源样本来解决这个问题。直觉是,预先训练模型的分类器层的权向量可以看作是在源域上学习到的每个类的原型特征。特别地,我们首先消除了全连通层的 bias ,并对分类器进行了归一化处理。假设 $\boldsymbol{w}_{s}^{m}\in \boldsymbol{W}_{s}=\left[\boldsymbol{w}_{s}^{1}, \ldots, \boldsymbol{w}_{s}^{M}\right]$ 代表从源域学到的 $M$ 分类器的权重向量,由于权值是规范化的,所以我们将它们用作类原型。当适应目标域时,冻结分类器层的参数,以保持源原型,并且只训练特征编码器。通过用源原型替换源样本,在源数据自由设置下的跨域对比损失可以写为:

    $\mathcal{L}_{S D F-C D C}^{t, i}=-\sum\limits_{m=1}^{M} \mathbf{1}_{\hat{y}_{t}^{i}=m} \log \frac{\exp \left(\boldsymbol{z}_{t}^{i^{\top}} \boldsymbol{w}_{s}^{m} / \tau\right)}{\sum\limits _{j=1}^{M} \exp \left(\boldsymbol{z}_{t}^{i^{\top}} \boldsymbol{w}_{S}^{j} / \tau\right)} \quad\quad\quad(6)$

  类似地,通过聚类来估计目标域内样本的标签。然而,使用样本计算类原型是不可行了。相反,采用类权值向量做为类原型:
    $O_{t}^{m} \leftarrow O_{s}^{m}=w_{s}^{m} \quad\quad\quad(7)$

  source data-free UDA 的最终目标是:

    $\operatorname{minimize} \sum\limits _{i=1}^{N_{t}} \mathcal{L}_{S D F-C D C}^{t, i} \quad\quad\quad(8)$

算法概述:

论文解读(CDCL)《Cross-domain Contrastive Learning for Unsupervised Domain Adaptation》的更多相关文章

  1. 论文解读(PCL)《Prototypical Contrastive Learning of Unsupervised Representations》

    论文标题:Prototypical Contrastive Learning of Unsupervised Representations 论文方向:图像领域,提出原型对比学习,效果远超MoCo和S ...

  2. 论文解读(LG2AR)《Learning Graph Augmentations to Learn Graph Representations》

    论文信息 论文标题:Learning Graph Augmentations to Learn Graph Representations论文作者:Kaveh Hassani, Amir Hosein ...

  3. 论文解读(MVGRL)Contrastive Multi-View Representation Learning on Graphs

    Paper Information 论文标题:Contrastive Multi-View Representation Learning on Graphs论文作者:Kaveh Hassani .A ...

  4. 论文解读(ARVGA)《Learning Graph Embedding with Adversarial Training Methods》

    论文信息 论文标题:Learning Graph Embedding with Adversarial Training Methods论文作者:Shirui Pan, Ruiqi Hu, Sai-f ...

  5. 论文解读(gCooL)《Graph Communal Contrastive Learning》

    论文信息 论文标题:Graph Communal Contrastive Learning论文作者:Bolian Li, Baoyu Jing, Hanghang Tong论文来源:2022, WWW ...

  6. 论文解读(SimGRACE)《SimGRACE: A Simple Framework for Graph Contrastive Learning without Data Augmentation》

    论文信息 论文标题:SimGRACE: A Simple Framework for Graph Contrastive Learning without Data Augmentation论文作者: ...

  7. 论文解读(SimCLR)《A Simple Framework for Contrastive Learning of Visual Representations》

    1 题目 <A Simple Framework for Contrastive Learning of Visual Representations> 作者: Ting Chen, Si ...

  8. 论文解读(GRACE)《Deep Graph Contrastive Representation Learning》

    Paper Information 论文标题:Deep Graph Contrastive Representation Learning论文作者:Yanqiao Zhu, Yichen Xu, Fe ...

  9. 论文解读(S^3-CL)《Structural and Semantic Contrastive Learning for Self-supervised Node Representation Learning》

    论文信息 论文标题:Structural and Semantic Contrastive Learning for Self-supervised Node Representation Learn ...

  10. 论文解读(MLGCL)《Multi-Level Graph Contrastive Learning》

    论文信息 论文标题:Structural and Semantic Contrastive Learning for Self-supervised Node Representation Learn ...

随机推荐

  1. Memlab,一款分析 JavaScript 堆并查找浏览器和 Node.js 中内存泄漏的开源框架

    Memlab 是一款 E2E 测试和分析框架,用于发现 JavaScript 内存泄漏和优化机会. Memlab 是 JavaScript 的内存测试框架.它支持定义一个测试场景(使用 Puppete ...

  2. fastapi教程进阶

    一个简单的栗子 from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return ...

  3. 阿里云下配置keepalive,利用HAVIP实现HA

    注:这篇文章参考网络,有些称呼都变了,比如阿里云上的现在是弹性ip 包括阿里云在内的很多云环境,因为不支持浮动IP广受诟病.目前阿里云在VPC网络下发布了HAVIP,能够实现arp宣告IP.这样也就让 ...

  4. k8s更换网络插件:从flannel更换成calico

    卸载flannel 查看已安装的flannel的信息 # 查看CNI插件,可以得知使用的是flannel # cat /etc/cni/net.d/10-flannel.conflist { &quo ...

  5. 几篇关于MySQL数据同步到Elasticsearch的文章---第五篇:logstash-input-jdbc实现mysql 与elasticsearch实时同步深入详解

    文章转载自: https://blog.csdn.net/laoyang360/article/details/51747266 引言: elasticsearch 的出现使得我们的存储.检索数据更快 ...

  6. 《HelloGitHub》第 78 期

    兴趣是最好的老师,HelloGitHub 让你对编程感兴趣! 简介 HelloGitHub 分享 GitHub 上有趣.入门级的开源项目. https://github.com/521xueweiha ...

  7. 对vue中的data进行数据初始化

    this.$data:是表示当前的改变后的this中的数据 this.$options.data():是表示没有赋值前的this中的数据,表示 初始化的data 一般可以使用Object.assign ...

  8. [s905l3]性价比神机mgv3000全网首拆,刷armbian实现更多价值!

    最近花55淘了一台mgv3000,s905l3,2+16G带蓝牙,真的性价比没得说 S905L3 工艺28nm差于s905l3a 主频1.9Ghz,超频可以达到2Ghz,GPU是Mail450,当服务 ...

  9. ubuntu安装及使用

    ubuntu教程 一. Ubuntu简介 Ubuntu(乌班图)是一个基于Debian的以桌面应用为主的Linux操作系统,据说其名称来自非洲南部祖鲁语或科萨语的"ubuntu"一 ...

  10. 嵌入式-C语言基础:字符串strlen和sizeof的区别

    strlen表示的实际的字符串长度,不会把字符串结束符'\0'计算进去,而sizeof则不是实际的字符串长度,它会把字符串的结束标识符'\0'也包含进去. #include<stdio.h> ...