tim-learn / SHOT

code released for our ICML 2020 paper "Do We Really Need to Access the Source Data? Source Hypothesis Transfer for Unsupervised Domain Adaptation"
MIT License
437 stars 78 forks source link

Some questions about SHOT code. #18

Closed EricKani closed 3 years ago

EricKani commented 3 years ago

Hi Tim,

Firstly thanks for sharing the code to the community. I encountered some questions in my code reading process.

In your "/object/image_target.py" file: 1) Line 191: the "_taridx" here is a batch of dataloader of "_dsetloaders["target"]", but "_memlabel" is the prediction of "_dsetloaders['test']". Are they matching in content~? 2) Line 192: is there a softmax operator needed for "outputs_test"? I found there is a \dleta in equ.7. 3) Line 264 and 265 are not been used below. 4) Line 270: why should we concatenate a "torch.ones(all_fea.size(0), 1))" to our "all_fea" in channel dimension when "distance" is "cosine"~? I don't understand this...

Thanks!

Eric

tim-learn commented 3 years ago

Hi Tim,

Firstly thanks for sharing the code to the community. I encountered some questions in my code reading process.

In your "/object/image_target.py" file:

  1. Line 191: the "_taridx" here is a batch of dataloader of "_dsetloaders["target"]", but "_memlabel" is the prediction of "_dsetloaders['test']". Are they matching in content~?
  2. Line 192: is there a softmax operator needed for "outputs_test"? I found there is a \dleta in equ.7.
  3. Line 264 and 265 are not been used below.
  4. Line 270: why should we concatenate a "torch.ones(all_fea.size(0), 1))" to our "all_fea" in channel dimension when "distance" is "cosine"~? I don't understand this...

Thanks!

Eric

Thanks, Eric!

  1. the test loader and the target loader are consistent, differs only in the data transformation function.
  2. for crossentropyloss, the softmax is hidden inside.
  3. yes, lines 264-265 are not used, you can ignore them.
  4. you can refer #13 for this question.

Best,

Tim

EricKani commented 3 years ago

Thanks for your quick response, Tim!

I have understand the first three answers. I will think about the fourth question further based on # 13 issue.

Best, Eric