Code Monkey home page Code Monkey logo

m-adda's Introduction

M-ADDA: Metric-based Adversarial Discriminative Domain Adaptation [Paper]

Accepted in the ICML 2018 Workshop of Domain Adaptation for Visual Understanding (DAVU).

Description

The idea is to cluster the source dataset using the triplet loss and then cluster the target dataset using adversarial learning and the center-magnet loss. The Figure below shows the resultant clusters after using this method. The different colored stars represent the cluster centers, each corresponding to a different digit category.

Source (MNIST) Target (USPS)

Requirements

  • pytorch 0.4.0.
  • torchvision 0.2.0

Download the datasets

cd datasets
bash download.sh

Test results

To obtain the test results, do the following two steps:

1. Download the checkpoints

cd checkpoints
bash download.sh

2. Run the following command,

python main.py -e usps2mnist mnist2usps uspsBig2mnistBig mnistBig2uspsBig -m test_model

The output should be,

mnist2usps          0.955676
mnistBig2uspsBig    0.980541
usps2mnist          0.951500
uspsBig2mnistBig    0.983100

which represent the accuracies obtained on the target test set.

  • mnistBig, and uspsBig use the full training set.
  • mnist, and usps use 2000 images from MNIST and 1800 images from USPS for training, respectively.

Training the models

0. Download the pretrained models and the usps dataset

cd checkpoints
bash download.sh
cd ..
cd datasets
bash download.sh
cd ..

1. Experiment USPS => MNIST

python main.py -e usps2mnist  -m train -rt 1

2. Experiment MNIST => USPS

python main.py -e mnist2usps  -m train -rt 1

3. Experiment MNIST ALL => USPS ALL

python main.py -e mnistBig2uspsBig  -m train -rt 1

4. Experiment USPS ALL => MNIST ALL

python main.py -e uspsBig2mnistBig  -m train -rt 1

Citation

If you find this useful for your research, please cite:

@Article{laradji2018m,
    title={M-ADDA: Unsupervised Domain Adaptation with Deep Metric Learning},
    author={Laradji, Issam and Babanezhad, Reza},
    journal={arXiv preprint arXiv:1807.02552},
    year = {2018}
}

m-adda's People

Contributors

issamlaradji 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  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  avatar  avatar  avatar  avatar  avatar

m-adda's Issues

Fatal error in your paper

You are solving unsupervised domain adaptation, however, I find out you use target label in your training procedure.
That is cheating !!

AttributeError: 'int' object has no attribute 'clone'

I got the following error.

File "/media/redhat/DATA/M-ADDA/datasets/uspsBig.py", line 69, in getitem
img, label = self.X[index].clone(), self.y[index].clone()
AttributeError: 'int' object has no attribute 'clone'

acc_tgt of target domain decreased gradually

Hello, sir, thank you for your code, I used your data set and got the same result, but when I was loading my own data set and testing the source domain -> target domain, with the increase of epoch, the training accuracy of target domain training became lower and lower, and the final accuracy was equivalent to guessing. What is the reason for this?
` epoch acc_src acc_tgt n_train - src_datasetss n_train - tgt_datasetss n_test - tgt_datasetss

0 3 0.9 0.8 272 272 71

epoch acc_src acc_tgt n_train - src_datasetss n_train - tgt_datasetss n_test - tgt_datasetss

0 4 0.9 0.573333 272 272 71

epoch acc_src acc_tgt n_train - src_datasetss n_train - tgt_datasetss n_test - tgt_datasetss

0 5 0.9 0.346667 272 272 71

epoch acc_src acc_tgt n_train - src_datasetss n_train - tgt_datasetss n_test - tgt_datasetss

0 6 0.9 0.226667 272 272 71
`

about download

Hello sir,Thans for your code,it's good,when i try to run it,i find the url to download checkpoint and dataset are invalid,would you mind put the new url?Thank you very much.

Traceback (most recent call last):

I was running your code,and after I run your main.py,I got follow error.
File "main.py", line 70, in
for exp_name in args.expList:
TypeError: 'NoneType' object is not iterable,
How can I deal with it?

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.