Coder Social home page Coder Social logo

daln's Introduction

DALN

PWC PWC PWC PWC

This repo is the official PyTorch implementation of Reusing the Task-specific Classifier as a Discriminator: Discriminator-free Adversarial Domain Adaptation.

News

2022.09.15 We are happy to announce that our new work DDB was accepted at NeurIPS2022✨

2022.09.15 Release core code on github!

Abstract

Adversarial learning has achieved remarkable performances for unsupervised domain adaptation (UDA). Existing adversarial UDA methods typically adopt an additional discriminator to play the min-max game with a feature extractor. However, most of these methods failed to effectively leverage the predicted discriminative information, and thus cause mode collapse for generator. In this work, we address this problem from a different perspective and design a simple yet effective adversarial paradigm in the form of a discriminator-free adversarial learning network (DALN), wherein the category classifier is reused as a discriminator, which achieves explicit domain alignment and category distinguishment through a unified objective, enabling the DALN to leverage the predicted discriminative information for sufficient feature alignment. Basically, we introduce a Nuclear-norm Wasserstein discrepancy (NWD) that has definite guidance meaning for performing discrimination. Such NWD can be coupled with the classifier to serve as a discriminator satisfying the K-Lipschitz constraint without the requirements of additional weight clipping or gradient penalty strategy. Without bells and whistles, DALN compares favorably against the existing state-of-the-art (SOTA) methods on a variety of public datasets. Moreover, as a plug-and-play technique, NWD can be directly used as a generic regularizer to benefit existing UDA algorithms.

Core code

from nwd import NuclearWassersteinDiscrepancy
# instantiate NWD
discrepancy = NuclearWassersteinDiscrepancy(classifier.head) # classifier is your own whole classification model
# compute output
x = torch.cat((x_s, x_t), dim=0)
y, f = classifier(x)
y_s, y_t = y.chunk(2, dim=0)

# compute cross entropy loss on source domain
cls_loss = nn.CrossEntropyLoss(y_s, labels_s)
# compute nuclear-norm wasserstein discrepancy between domains
# for adversarial classifier, minimize negative nwd is equal to maximize nwd
discrepancy_loss = -discrepancy(f)
transfer_loss = discrepancy_loss * trade_off_lambda # multiply the lambda to trade off the loss term
loss = cls_loss + transfer_loss

Citation

If you find our work useful and use the code or models for your research, please cite our work as follows:

@inproceedings{chen2022reusing,
  title={Reusing the Task-specific Classifier as a Discriminator: Discriminator-free Adversarial Domain Adaptation},
  author={Chen, Lin and Chen, Huaian and Wei, Zhixiang and Jin, Xin and Tan, Xiao and Jin, Yi and Chen, Enhong},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={7181--7190},
  year={2022}
}

Acknowledgment

Our implementation is mainly based on following repositories. Thanks for their authors.

daln's People

Contributors

xiaoachen98 avatar

Stargazers

YuLongZJU avatar  avatar ltl avatar Yuna Park avatar 1emonX avatar Kevin Hong avatar mr_menand avatar forest avatar Haotian Liu avatar WmIwd avatar  avatar  avatar zyf avatar YinZiQi avatar Fujun Han avatar  avatar  avatar 若流风之回雪 avatar  avatar  avatar  avatar Aryan Pandey avatar Sohail Ahmed Khan avatar Jose Sosa avatar  avatar ChenJunzhe avatar  avatar wuzhy avatar  avatar  avatar  avatar  avatar  avatar Usheng L avatar icecream-Tnak avatar 洪郡辰 avatar Sovin avatar HTX avatar Jack Liu avatar zzb avatar Hongru Hu avatar 陈东 avatar Marcelo Morales avatar Dongjun Hwang avatar xiaocaiji avatar ethan avatar Andy Jingqian Xue avatar Boshen Xu avatar  avatar Yue Zhang avatar justin avatar  avatar  avatar Jinxin Zhuo avatar Amrin Kareem avatar 慢半拍 avatar Cishi avatar  avatar  avatar QinghaoLi avatar Jonas avatar  avatar JiaweiPeng avatar An-zhi WANG avatar Erhu Liu avatar ThrQ avatar 卞子豪 avatar WEI, ZHIXIANG avatar Gloria avatar loveSnowBest avatar Tasks With Code avatar  avatar Zhimin_Yuan avatar  avatar Haoyang_Li616 avatar Wuyang LI avatar Bingxin Ke avatar  avatar

Watchers

Bingxin Ke avatar  avatar Wuyang LI avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.