Code Monkey home page Code Monkey logo

mdd's Introduction

Margin Disparity Discrepancy

Prerequisites:

  • Python3
  • PyTorch ==0.3.1 (with suitable CUDA and CuDNN version)
  • torchvision == 0.2.0
  • Numpy
  • argparse
  • PIL
  • tqdm

Dataset:

You need to modify the path of the image in every ".txt" in "./data".

Training:

You can run "./scripts/train.sh" to train and evaluate on the task. Before that, you need to change the project root, dataset (Office-Home or Office-31), data address and CUDA_VISIBLE_DEVICES in the script.

Citation:

If you use this code for your research, please consider citing:

@inproceedings{MDD_ICML_19,
  title={Bridging Theory and Algorithm for Domain Adaptation},
  author={Zhang, Yuchen and Liu, Tianle and Long, Mingsheng and Jordan, Michael},
  booktitle={International Conference on Machine Learning},
  pages={7404--7413},
  year={2019}
}

Contact

If you have any problem about our code, feel free to contact [email protected].

mdd's People

Contributors

hlqwerty 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

mdd's Issues

Total loss changes to Nan somehow

Hi, thanks for sharing your nice code. I found that the total loss changes to Nan somehow and the accuracy on the target domain would drop to zero at the same time.

visda2017 accuracy

I try to experiment with visda2017 data

The paper shows 74% of the results, but my experiment is 66%

Do I have to change hyper parameters on your code to reproduce the 74% results?

Problem about accuracy

Hello, Thank you for your reply about accuracy.
Yes, it is a problem about pytorch version.
In pytorch1.0, I just change the code:
accuracy = torch.sum(torch.squeeze(predict).float() == all_labels) / float(all_labels.size()[0]) in train.py to --->
accuracy = Tensor.cpu(torch.sum(torch.squeeze(predict).float() == all_labels)).numpy() / float(all_labels.size()[0])

It will run rightly.
Thank you for your reply again.

Problem about accuracy

Hello,thank you for your sharing.
I have a problem. When I run your codes, the eval accuracy is always 0. Just as bleow.
Cloud please tell me something about it?

init_lr: 0.004
lr_scheduler: {'gamma': 0.001, 'decay_rate': 0.75, 'type': 'inv'}
optim: {'type': 'sgd', 'params': {'momentum': 0.9, 'nesterov': True, 'weight_decay': 0.0005, 'lr': 0.004}}
start train...
Train iter: 0%|▍ | 500/100000 [03:21<11:58:55, 2.31it/s]
{'accuracy': tensor(0, device='cuda:0')} | 4/16 [00:01<00:05, 2.14it/s]
Train iter: 1%|▋ | 1000/100000 [06:48<10:18:59, 2.67it/s]
{'accuracy': tensor(0, device='cuda:0')} | 8/16 [00:03<00:03, 2.60it/s]
Train iter: 2%|█▏ | 1500/100000 [10:14<9:52:52, 2.77it/s]
{'accuracy': tensor(0, device='cuda:0')}▊ | 12/16 [00:04<00:01, 2.74it/s]
Train iter: 2%|█▌ | 2000/100000 [13:31<8:34:56, 3.17it/s]
{'accuracy': tensor(0, device='cuda:0')} | 0/16 [00:00<?, ?it/s]
Train iter: 2%|█▊ | 2500/100000 [16:58<12:21:09, 2.19it/s]
{'accuracy': tensor(0, device='cuda:0')} | 4/16 [00:01<00:06, 1.86it/s]
Train iter: 3%|██▎ | 3000/100000 [20:25<9:56:52, 2.71it/s]
{'accuracy': tensor(0, device='cuda:0')} | 8/16 [00:03<00:03, 2.64it/s]
Train iter: 4%|██▋ | 3500/100000 [23:53<9:39:06, 2.78it/s]

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.