Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some question about office31 sets #36

Open
hongshen-zhang opened this issue Jul 30, 2019 · 2 comments
Open

Some question about office31 sets #36

hongshen-zhang opened this issue Jul 30, 2019 · 2 comments
Labels
question Further information is requested

Comments

@hongshen-zhang
Copy link

Your work is marvelous! I am a new-comer in transfer learning. I could test your code in digit sets(mnist, usps,svhn). However, I tried for several days but I still can't test your code in office31 sets (amazon,webcam,dslr). Could you please give me an concrete example on how to test your code in office31 sets?
(Just like python scripts/train_digits.py --source amazon --target webcam --dann)
Thank you very much!

@stes
Copy link
Contributor

stes commented Jul 31, 2019

Hi @jkljk67890 , thanks for your interest! I'm afraid the current code base does not have a standalone and easy-to-run example for Office31. You'd need to wrap a model like a Resnet from torchvision and adapt it for domain adaptation; this primarily boils down to adjusting the forward function to return a feature vector and the logits, since the solvers internally call it like this:

src_e, src_p = self.model(src_x)

I'd suggest to adapt the digit example to perform this task; please let me know if you need further help, in case you're up for implementing this, feel free to open a PR afterwards!

@stes stes added the question Further information is requested label Jul 31, 2019
@hongshen-zhang
Copy link
Author

hongshen-zhang commented Jul 31, 2019

Thank you for your request! I have tried my best to change the code, but I met a question that

$ python train_OFFICE.py --gpu 0 --source amazon --target webcam --assoc
Start Experiments
Registered DigitModel as "classifier"
Registered CrossEntropyLoss as "ce" with weight 1.0
Registered AccuracyScore as "acc_s" with weight None
Registered AccuracyScore as "acc_t" with weight None
Registered AssociativeLoss as "assoc" with weight 1.0
Registered Adam as ""
0%| | 0/100 [00:00<?, ?it/sTraceback (most recent call last): | 0/8 [00:00<?, ?it/s]
File "train_OFFICE.py", line 133, in
experiment.optimize()
File "/home/zhanghongshen/good/salad-master/scripts/salad/solver/base.py", line 459, in optimize
history, terminate = self._epoch(epoch)
File "/home/zhanghongshen/good/salad-master/scripts/salad/solver/base.py", line 423, in _epoch
total_losses = self._step(batch)
File "/home/zhanghongshen/good/salad-master/scripts/salad/solver/base.py", line 391, in _step
loss, loss_dict = self._loss(optimizer, batch)
File "/home/zhanghongshen/good/salad-master/scripts/salad/solver/base.py", line 366, in _loss
loss_args = self.agg_lossoptim
File "/home/zhanghongshen/good/salad-master/scripts/salad/solver/da/association.py", line 38, in call
(xs, ys), (xt, yt) = batch
ValueError: too many values to unpack (expected 2)
(uses assoc).

I tried for several algorithm and their error are similar.

(use teach: File "/home/zhanghongshen/good/salad-master/scripts/salad/solver/da/ensembling.py", line 20, in call
(x_stud_xs, ys), (x_stud_xt,x_teach_xt,yt) = batch
ValueError: too many values to unpack (expected 2))

It seems that there is something wrong with batch, but I don't know where to change.
Could you please tell me where should I change?
(I print the batch,it was too large, and it can be run for several times and then meet an error(too many values).)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants