Code release for Universal Domain Adaptation(CVPR 2019)

Overview

Universal Domain Adaptation

Code release for Universal Domain Adaptation(CVPR 2019)

Requirements

  • python 3.6+
  • PyTorch 1.0

pip install -r requirements.txt

Usage

  • download datasets

  • write your config file

  • python main.py --config /path/to/your/config/yaml/file

  • train (configurations in officehome-train-config.yaml are only for officehome dataset):

    python main.py --config officehome-train-config.yaml

  • test

    python main.py --config officehome-test-config.yaml

  • monitor (tensorboard required)

    tensorboard --logdir .

Checkpoints

We provide the checkpoints for officehome datasets at Google Drive.

Citation

please cite:

@InProceedings{UDA_2019_CVPR,
author = {You, Kaichao and Long, Mingsheng and Cao, Zhangjie and Wang, Jianmin and Jordan, Michael I.},
title = {Universal Domain Adaptation},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}

Contact

Comments
  • error of train

    error of train

    Thanks for your impressive work! When I run your code in my workstation, it always reports "[easydl] tensorflow not available!" And I satisfy the requirements which you mentioned in "readme". What should I do? 1

    opened by ThoamsDong 8
  • 在运行python main.py --config officehome-train-config.yaml中遇到的问题

    在运行python main.py --config officehome-train-config.yaml中遇到的问题

    您好,最近拜读Universal Domain Adaptation,对UAN算法非常感兴趣,谢谢你们分享代码!在调试代码的过程中,我遇到了几个问题,想请教一下: 1.pretrained_model可以采用离线下载的pytorch预训练模型吗?例如,通过‘https://download.pytorch.org/models/resnet50-19c8e357.pth’下载ResNet-50的预训练模型进行实验 2.在Google Colab上运行“!python main.py --config office-train-config.yaml”时,遇到了图中的报错信息,该如何解决? ab637c18669d538f4d78b51f4b45000 感谢你的阅读,期待回复!

    opened by Dayro-9 3
  • Question about your code

    Question about your code

    Hello, after reading the paper and the code, I have a few questions about them. Wish you could answer them for me :) The UAN model proposed in the paper looks like this

    TIM图片20200214122712. In my view, the feature z extracted from F is loaded into G, D, D' separately. However, the model in the code is defined as follow:

    def forward(self, x):
            f = self.feature_extractor(x)
            f, _, __, y = self.classifier(f)
            d = self.discriminator(_)
            d_0 = self.discriminator_separate(_)
            return y, d, d_0
    

    The feature f goes into classifier first but the output of the first layer of the classifier goes into the discriminator? Why?

    Besides, the training of the network can be seen as a minimax game of equation (4). However, the code just added all the loss up loss = ce + adv_loss + adv_loss_separate. How to understand this?

    Thanks

    opened by zhangzp9970 2
  • Training Details about office-31, visda 2017 and imagenet-caltech

    Training Details about office-31, visda 2017 and imagenet-caltech

    The paper and the released code miss some training details about the mentioned dataset. Could you provide the yaml files of office-31, visda 2017 and imagenet-caltech? In addition, the usage of dataset imagenet-caltech is quite different in paper SAN and PADA. Could you provide the label files of imagenet-caltech used in the paper? Thanks!

    opened by stefanxinhong 1
  • the coefficient scheduler for gradient reversal module

    the coefficient scheduler for gradient reversal module

    self.grl = GradientReverseModule(lambda step: aToBSheduler(step, 0.0, 1.0, gamma=10, max_iter=10000))

    It seems that max_iter is set as 10000.

    From the DANN paper, I thought it depends on the total iteration number during training. Is there any reason to use a fixed number?

    Thank you.

    opened by cmhungsteve 1
  • Question about threshold w_0 and hyper-paramete λ

    Question about threshold w_0 and hyper-paramete λ

    Hello, I have read the paper and code, and not found the details about how to calculate the thresholdw_0 and hyper-parameter λ.

    Specifically, w_0 is seemed to be a fixed value for every dataset in the code, which confused me.

    For different datasets, should calculate different w_0 and λ? and how to define a w_0 to help us distinguish unknown samples from others in the target domain? Or I missed some details, please help give me some suggestions. Thank you

    opened by Dayro-9 0
  • why normalize_weight need div torch.mean(x)?

    why normalize_weight need div torch.mean(x)?

    def normalize_weight(x): min_val = x.min() max_val = x.max() x = (x - min_val) / (max_val - min_val) x = x / torch.mean(x) return x.detach()

    according to paper, x in (0,1), why normalize_weight need div torch.mean(x)?

    opened by alpc91 1
  • Question about the setting of 'source share weight' (and 'target share weight').

    Question about the setting of 'source share weight' (and 'target share weight').

    Interesting work! I have read this paper and agreed with the assumption about Domain similarity and Prediction uncertainty, but I am confused about the calculation method of w^s(x) in eq.7 and w^t(x) in eq.8. What is the exact meaning of uncertainty minus similarity (eq.7)? And why are w^s(x) and w^t(x) calculated in opposite ways?

    Look forward to your reply! Thanks

    opened by freshjh 3
  • Pretraining on ImageNet

    Pretraining on ImageNet

    You had mentioned that the backbone network is ResNet-50 pretrained on Imagenet.

    https://github.com/thuml/Universal-Domain-Adaptation/blob/5d7caa95af7e3675305c542253c4e372801897d2/net.py#L37

    But in many experiments in the paper, the labels in the unsupervised target overlap with that of the supervised source labels in the ImageNet. Is it justified that you pretrain on supervised ImageNet labels?

    opened by tarun005 1
  • Question about classifier

    Question about classifier

    Shouldn't there be non-linearity between the bottleneck layers in the classifier?

    https://github.com/thuml/Universal-Domain-Adaptation/blob/5d7caa95af7e3675305c542253c4e372801897d2/net.py#L127

    opened by tarun005 1
Owner
THUML @ Tsinghua University
Machine Learning Group, School of Software, Tsinghua University
THUML @ Tsinghua University
Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021)

Transferable Semantic Augmentation for Domain Adaptation Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021) Paper

null 66 Dec 16, 2022
[CVPR 2022] CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation

CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation Prerequisite Please create and activate the following conda envrionment. To r

Qin Wang 87 Jan 8, 2023
Adversarial Adaptation with Distillation for BERT Unsupervised Domain Adaptation

Knowledge Distillation for BERT Unsupervised Domain Adaptation Official PyTorch implementation | Paper Abstract A pre-trained language model, BERT, ha

Minho Ryu 29 Nov 30, 2022
Code for CVPR2021 "Visualizing Adapted Knowledge in Domain Transfer". Visualization for domain adaptation. #explainable-ai

Visualizing Adapted Knowledge in Domain Transfer @inproceedings{hou2021visualizing, title={Visualizing Adapted Knowledge in Domain Transfer}, auth

Yunzhong Hou 80 Dec 25, 2022
CDTrans: Cross-domain Transformer for Unsupervised Domain Adaptation

CDTrans: Cross-domain Transformer for Unsupervised Domain Adaptation [arxiv] This is the official repository for CDTrans: Cross-domain Transformer for

null 238 Dec 22, 2022
CDTrans: Cross-domain Transformer for Unsupervised Domain Adaptation

[ICCV2021] TransReID: Transformer-based Object Re-Identification [pdf] The official repository for TransReID: Transformer-based Object Re-Identificati

DamoCV 569 Dec 30, 2022
A Pytorch Implementation of [Source data‐free domain adaptation of object detector through domain

A Pytorch Implementation of Source data‐free domain adaptation of object detector through domain‐specific perturbation Please follow Faster R-CNN and

null 1 Dec 25, 2021
Code release for Local Light Field Fusion at SIGGRAPH 2019

Local Light Field Fusion Project | Video | Paper Tensorflow implementation for novel view synthesis from sparse input images. Local Light Field Fusion

null 1.1k Dec 27, 2022
Code release for Local Light Field Fusion at SIGGRAPH 2019

Local Light Field Fusion Project | Video | Paper Tensorflow implementation for novel view synthesis from sparse input images. Local Light Field Fusion

null 748 Nov 27, 2021
Universal Adversarial Triggers for Attacking and Analyzing NLP (EMNLP 2019)

Universal Adversarial Triggers for Attacking and Analyzing NLP This is the official code for the EMNLP 2019 paper, Universal Adversarial Triggers for

Eric Wallace 248 Dec 17, 2022
The code release of paper 'Domain Generalization for Medical Imaging Classification with Linear-Dependency Regularization' NIPS 2020.

Domain Generalization for Medical Imaging Classification with Linear Dependency Regularization The code release of paper 'Domain Generalization for Me

Yufei Wang 56 Dec 28, 2022
CVPR 2021 Official Pytorch Code for UC2: Universal Cross-lingual Cross-modal Vision-and-Language Pre-training

UC2 UC2: Universal Cross-lingual Cross-modal Vision-and-Language Pre-training Mingyang Zhou, Luowei Zhou, Shuohang Wang, Yu Cheng, Linjie Li, Zhou Yu,

Mingyang Zhou 28 Dec 30, 2022
Code to reproduce the experiments in the paper "Transformer Based Multi-Source Domain Adaptation" (EMNLP 2020)

Transformer Based Multi-Source Domain Adaptation Dustin Wright and Isabelle Augenstein To appear in EMNLP 2020. Read the preprint: https://arxiv.org/a

CopeNLU 36 Dec 5, 2022
PyTorch code for the paper "Curriculum Graph Co-Teaching for Multi-target Domain Adaptation" (CVPR2021)

PyTorch code for the paper "Curriculum Graph Co-Teaching for Multi-target Domain Adaptation" (CVPR2021) This repo presents PyTorch implementation of M

Evgeny 79 Dec 19, 2022
code for our paper "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer"

SHOT++ Code for our TPAMI submission "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer" that is ext

null 75 Dec 16, 2022
code for ICCV 2021 paper 'Generalized Source-free Domain Adaptation'

G-SFDA Code (based on pytorch 1.3) for our ICCV 2021 paper 'Generalized Source-free Domain Adaptation'. [project] [paper]. Dataset preparing Download

Shiqi Yang 84 Dec 26, 2022
Original code for "Zero-Shot Domain Adaptation with a Physics Prior"

Zero-Shot Domain Adaptation with a Physics Prior [arXiv] [sup. material] - ICCV 2021 Oral paper, by Attila Lengyel, Sourav Garg, Michael Milford and J

Attila Lengyel 40 Dec 21, 2022
Code for our NeurIPS 2021 paper 'Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation'

Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation (NeurIPS 2021) Code for our NeurIPS 2021 paper 'Exploiting the Intri

Shiqi Yang 53 Dec 25, 2022