corenel / pytorch-adda

A PyTorch implementation for Adversarial Discriminative Domain Adaptation
MIT License
474 stars 139 forks source link

accuracy just 13% after adaptation? #8

Open dupanfei1 opened 6 years ago

dupanfei1 commented 6 years ago

Thank you for you code! I have run the code as the instruction, but just got 13% accuracy on target domain. is there something wrong?

IssamLaradji commented 6 years ago

Same here...did you upgrade to 0.4 ?

IssamLaradji commented 6 years ago

The model outputs a single class only

IssamLaradji commented 6 years ago

I found the issue, if you downgrade torchvision to version 0.1.9 i.e. pip install torchvision==0.2.0 then you get the right results. it seems that torchvision 0.2.1 does not normalize the usps images...

dupanfei1 commented 6 years ago

thank you for you answer! my torchvision version is 0.2.1 pytorch is 0.2.0post3 And do you try another ADDA code? https://github.com/nitahhhh/adda-pytorch I also got 15% accracy?

IssamLaradji commented 6 years ago

It worked with me when I installed torchvision 0.2.0 instead. You can do pip install torchvision==0.2.0 Did you try with torchvision 0.2.0 ?

dupanfei1 commented 6 years ago

I have tried torchvision==0.1.9 it did work for https://github.com/corenel/pytorch-adda. BUT it did not work for https://github.com/nitahhhh/adda-pytorch. I will try 0.2.0. Is the version difference so big?

xingkongliang commented 6 years ago

In torchvision version 0.2.1. When you load data, tensor will subtract mean every time. So I sovle this by adding torchvision/transforms/transforms.py 143 line: tensor = tensor.clone() return F.normalize(tensor, self.mean, self.std) === Evaluating classifier for encoded target domain === source only <<< Avg Loss = 0.3259507119655609, Avg Accuracy = 96.236557% domain adaption <<< Avg Loss = 0.4486095607280731, Avg Accuracy = 96.397847%

wgqtmac commented 5 years ago

@xingkongliang How to find the path of transforms.py?Is it in anaconda3/lib/python3.6/site-packages/ ?But I don't find it.