Code Monkey home page Code Monkey logo

atdoc's Introduction

Official implementation for ATDOC

[CVPR-2021] Domain Adaptation with Auxiliary Target Domain-Oriented Classifier

[Update @ Nov 23 2021]

  1. [For Office, please change the max-epoch to 100; for VISDA-C, change the max-epoch to 1 and change the net to resnet101]
  2. Add the code associated with SSDA, change the max-epoch to 20 for DomainNet-126
  3. Thank @lyxok1 for pointing out the typo in Eq.(6), we have corrected it in the new verison of this paper.

Below is the demo for ATDOC on a UDA task of Office-Home [max_epoch to 50]:

  1. installing packages

    python == 3.6.8 pytorch ==1.1.0 torchvision == 0.3.0 numpy, scipy, sklearn, PIL, argparse, tqdm

  2. download the Office-Home dataset

    mkdir dataset

    cd dataset

    pip install gdown

    gdown https://drive.google.com/u/0/uc?id=0B81rNlvomiwed0V1YUxQdC1uOTg&export=download

    unzip OfficeHomeDataset_10072016.zip

    mv ./OfficeHomeDataset_10072016/Real\ World ./OfficeHomeDataset_10072016/RealWorld

    cd ../

  3. run the main file with 'Source-model-only'

    python demo_uda.py --pl none --dset office-home --max_epoch 50 --s 0 --t 1 --gpu_id 0 --method srconly --output logs/uda/run1/

  4. run the main file with 'ATDOC-NC'

    python demo_uda.py --pl atdoc_nc --tar_par 0.1 --dset office-home --max_epoch 50 --s 0 --t 1 --gpu_id 0 --method srconly --output logs/uda/run1/

  5. run the main file with 'ATDOC-NA'

    python demo_uda.py --pl atdoc_na --tar_par 0.2 --dset office-home --max_epoch 50 --s 0 --t 1 --gpu_id 0 --method srconly --output logs/uda/run1/

  6. run the main file with 'ATDOC-NA' combined with 'CDAN+E'

    python demo_uda.py --pl atdoc_na --tar_par 0.2 --dset office-home --max_epoch 50 --s 0 --t 1 --gpu_id 0 --method CDANE --output logs/uda/run1/

  7. run the main file with 'ATDOC-NA' combined with 'MixMatch'

    python demo_mixmatch.py --pl none --dset office-home --max_epoch 50 --s 0 --t 1 --gpu_id 0 --output logs/uda/run1/

  8. run the main file with 'ATDOC-NA' combined with 'MixMatch'

    python demo_mixmatch.py --pl atdoc_na --dset office-home --max_epoch 50 --s 0 --t 1 --gpu_id 0 --output logs/uda/run1/

Citation

If you find this code useful for your research, please cite our paper

@inproceedings{liang2021domain,
    title={Domain Adaptation with Auxiliary Target Domain-Oriented Classifier},
    author={Liang, Jian and Hu, Dapeng and Feng, Jiashi},
    booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
    year={2021}
}

Contact

atdoc's People

Contributors

tim-learn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

atdoc's Issues

features normalization

Hi,thanks for sharing your code! I have a question about calculating the cosine distance in demo_uda , line 267. dis = -torch.mm(features_target.detach(), mem_fea.t())I think before calculating the cosine distance,the features should be normalized.May be I'm missing something?

Cannot duplicate the accuracy result of experiment in office-31 A-D

Hi~ Thanks for your codes, it helps me so much to understand your paper.
Recently I use this code to run related experiments in the dataset: OFFICE-31 with the command:

python demo_uda.py --pl atdoc_na --tar_par 0.2 --dset office --max_epoch 100 --s 0 --t 1 --gpu_id 0 --method DDC --output logs/uda/run1/

However, the experiment result of office-31 in A to D cannot achieve 96% in your paper but got 89%, which made me so confused.
I have tried to revise the batch size to 16 or 28,but does not work.
(Cause of my GPU memory limitation, I cannot set the batch size to 32 or 36 )
Can you share more detail of the hyper-parameter for this dataset training, I will be very grateful.

settings about semi-supervised DA

Thanks for sharing the code~ After reading the codebase, I find the provided demo is aimed at unsupervised DA, while your paper also provide some promising results on SSDA setting. Therefore I wonder if there are any difference between hyperparameter settings under DA and SSDA scenario.

For example

  • the training batch distribution for label-source, label-target and unlabel-target
  • whether the labeled target feature & score are used to update memory
  • the scheme to adjust weight $lambda$ of self-supervised loss term
  • whehter the hyperparameters are different for other datasets like DomainNet

BTW, I find the following code for NA classifier (Line 305 from demo_uda.py) seems not consistent with the Eq (6) in paper

outputs_target = softmax_out**2 / ((softmax_out**2).sum(dim=0))

From Eq (6) in the paper, the normalization is over prediction on all classes to make the distribution sharper, while in the code the parameter is dim=0, resulting normalization over all unlabeled data samples, will the normalization direction make big difference in final results ?

Appreciation if you can provide more detail about it~

the form of idx

Hi,thanks for sharing your code! I have a question in demo_uda , line 169. dis[di, idx[di]] = torch.max(dis) What is the form of idx, I can't get it through iter.next() in the dataset I built myself (not the image public dataset),thank you

About Nearest centroid Classifier

Is there a big difference in performance between the fully-connected layer often used in image classification tasks compared to the Nearest centroid Classifier used here?

How to train on VISDA-C dataset

I simply use the demo of 【'ATDOC-NA' combined with 'CDAN+E'】,change the dataloader with mine and set epochs=10,

python demo_uda.py --pl atdoc_na --tar_par 0.2 --dset VISDA-C --max_epoch 10 --s 0 --t 1 --gpu_id 1 --method CDANE --output logs/uda/run1/

but result only achieve 69.18%.
Can you relese hyper-parameters of training on VISDA-C dataset?
Thanks!

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.