Gorilla-Lab-SCUT / SRDC-CVPR2020

Code release for Unsupervised Domain Adaptation via Structurally Regularized Deep Clustering (CVPR2020-Oral).
MIT License
80 stars 16 forks source link

Why function "TarDisClusterLoss" uses target domain label (target_target)? #3

Closed wusuoweima closed 4 years ago

wusuoweima commented 4 years ago

in trainer.py, line 73 -80, why function "TarDisClusterLoss" uses target domain label (target_target)? ` loss += weight * TarDisClusterLoss(args, epoch, ca_t, target_target, em=(args.cluster_method == 'em'))

if args.learn_embed:
    prob_pred = (1 + (f_t.unsqueeze(1) - learn_cen.unsqueeze(0)).pow(2).sum(2) / args.alpha).pow(- (args.alpha + 1) / 2)
    loss += weight * TarDisClusterLoss(args, epoch, prob_pred, target_target, softmax=args.embed_softmax)
    if not args.no_second_embed:
        prob_pred_2 = (1 + (f_t_2.unsqueeze(1) - learn_cen_2.unsqueeze(0)).pow(2).sum(2) / args.alpha).pow(- (args.alpha + 1) / 2)
        loss += weight * TarDisClusterLoss(args, epoch, prob_pred_2, target_target, softmax=args.embed_softmax)`
huitangtang commented 4 years ago

Hello, glad to hear from you. For your problem, note that the target domain label was pseudo-labeled by K-means clustering in line 145 in main.py. Please check the corresponding function in trainer.py. We do this mainly for initialization at the first epoch and we set all target labels to -1 in line 115 to make sure no use of ground truth target labels.发自我的华为手机-------- 原始邮件 --------发件人: wusuowei_m notifications@github.com日期: 2020年8月15日周六 晚上9:15收件人: huitangtang/SRDC-CVPR2020 SRDC-CVPR2020@noreply.github.com抄送: Subscribed subscribed@noreply.github.com主 题: [huitangtang/SRDC-CVPR2020] Why function "TarDisClusterLoss" uses target domain label (target_target)? (#3) in trainer.py, line 73 -80, why function "TarDisClusterLoss" uses target domain label (target_target)? loss += weight * TarDisClusterLoss(args, epoch, ca_t, target_target, em=(args.cluster_method == 'em')) if args.learn_embed: prob_pred = (1 + (f_t.unsqueeze(1) - learn_cen.unsqueeze(0)).pow(2).sum(2) / args.alpha).pow(- (args.alpha + 1) / 2) loss += weight * TarDisClusterLoss(args, epoch, prob_pred, target_target, softmax=args.embed_softmax) if not args.no_second_embed: prob_pred_2 = (1 + (f_t_2.unsqueeze(1) - learn_cen_2.unsqueeze(0)).pow(2).sum(2) / args.alpha).pow(- (args.alpha + 1) / 2) loss += weight * TarDisClusterLoss(args, epoch, prob_pred_2, target_target, softmax=args.embed_softmax)

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

wusuoweima commented 4 years ago

谢谢你。Thanks for your reply! Do you use KL loss in the default setting of the code(amazon->webcam)?I can't find it. "criterion_cons" is not conducted.

``

huitangtang commented 4 years ago

Hi, our default setting does not include the KL loss. 发自我的华为手机-------- 原始邮件 --------发件人: wusuowei_m notifications@github.com日期: 2020年8月15日周六 半夜11:29收件人: huitangtang/SRDC-CVPR2020 SRDC-CVPR2020@noreply.github.com抄送: HuiTang eehuitang@mail.scut.edu.cn, Comment comment@noreply.github.com主 题: Re: [huitangtang/SRDC-CVPR2020] Why function "TarDisClusterLoss" uses target domain label (target_target)? (#3)

谢谢你。Thanks for your reply!

Do you use KL loss in the default setting of the code(amazon->webcam)?I can't find it. "criterion_cons" is not conducted.

``

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

wusuoweima commented 4 years ago

明白了,谢谢😊发自我的华为手机-------- 原始邮件 --------发件人: HuiTang notifications@github.com日期: 2020年8月16日周日 00:00收件人: huitangtang/SRDC-CVPR2020 SRDC-CVPR2020@noreply.github.com抄送: wusuowei_m btao_ma@163.com, Author author@noreply.github.com主 题: Re: [huitangtang/SRDC-CVPR2020] Why function "TarDisClusterLoss" uses target domain label (target_target)? (#3)

Hi, our default setting does not include the KL loss. 发自我的华为手机-------- 原始邮件 --------发件人: wusuowei_m notifications@github.com日期: 2020年8月15日周六 半夜11:29收件人: huitangtang/SRDC-CVPR2020 SRDC-CVPR2020@noreply.github.com抄送: HuiTang eehuitang@mail.scut.edu.cn, Comment comment@noreply.github.com主 题: Re: [huitangtang/SRDC-CVPR2020] Why function "TarDisClusterLoss" uses target domain label (target_target)? (#3)

谢谢你。Thanks for your reply!

Do you use KL loss in the default setting of the code(amazon->webcam)?I can't find it. "criterion_cons" is not conducted.

``

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

wusuoweima commented 4 years ago

I get the following results with the default setting. 1) office31:Amazon->webcam best val acc: 92.830190 best test acc: 92.830190 cond best test acc: 92.830190

2)office31:Amazon->webcam_half best val acc: 89.743590 best test acc: 39.417990 cond best test acc: 39.417990 They are far below the results in your paper: the first column of both Tabel1 and Table2. Can you tell me how to change the setting to get the complete model of your paper and the comparable results with your paper? I'm very interested in your work and plan to do a new work based on your work. We will cite your paper in the future.

huitangtang commented 4 years ago
Hello!

I get the following results on amazon->webcam_half and amazon->dslr_half with the default setting on June 3rd, 2020 respectively:
   best val acc till now: 91.025643
   best test acc till now: 91.851853
   cond best test acc till now: 91.851853

   best test acc till now: 91.764707
   cond best test acc till now: 91.764707    

After the final test, I uploaded the code to GitHub.

So I didn't understand why your results were weird. Maybe It is the problem of version or data in your machine if the code was not modified. Please check it carefully. 

Wish everything goes well for you!

-----原始邮件-----

发件人:wusuowei_m notifications@github.com 发送时间:2020-08-16 15:24:54 (星期日) 收件人: huitangtang/SRDC-CVPR2020 SRDC-CVPR2020@noreply.github.com 抄送: HuiTang eehuitang@mail.scut.edu.cn, Comment comment@noreply.github.com 主题: Re: [huitangtang/SRDC-CVPR2020] Why function "TarDisClusterLoss" uses target domain label (target_target)? (#3)

    I get the following results with the default setting.

        office31:Amazon->webcam

best val acc: 92.830190 best test acc: 92.830190 cond best test acc: 92.830190

    2)office31:Amazon->webcam_half

best val acc: 89.743590 best test acc: 39.417990 cond best test acc: 39.417990 They are far below the results in your paper: the first column of both Tabel1 and Table2. Can you tell me how to change the setting to get the complete model of your paper and the comparable results with your paper? I'm very interested in your work and plan to do a new work based on your work. We will cite your paper in the future.

You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

wusuoweima commented 4 years ago

Thanks, I will check it again. Can you tell me how to change the setting to get the complete model of your paper? e.g. add KL loss etc. Is the following code? Do I set args.aug_tar_agree=True and args.no_da=True? line 66-71 in trainer.py: if args.aug_tar_agree and (not args.gray_tar_agree): loss += weight * criterion_cons(ca_t, ca_t_dup) elif args.gray_tar_agree and (not args.aug_tar_agree): loss += weight * criterion_cons(ca_t, ca_t_gray) elif args.aug_tar_agree and args.gray_tar_agree: loss += weight * (criterion_cons(ca_t, ca_t_dup) + criterion_cons(ca_t, ca_t_gray))

huitangtang commented 4 years ago

Yes. You can try different settings to know the resulted difference, from which you may have new findings.发自我的华为手机-------- 原始邮件 --------发件人: wusuowei_m notifications@github.com日期: 2020年8月16日周日 傍晚5:02收件人: huitangtang/SRDC-CVPR2020 SRDC-CVPR2020@noreply.github.com抄送: HuiTang eehuitang@mail.scut.edu.cn, Comment comment@noreply.github.com主 题: Re: [huitangtang/SRDC-CVPR2020] Why function "TarDisClusterLoss" uses target domain label (target_target)? (#3)

Thanks, I will check it again.

Can you tell me how to change the setting to get the complete model of your paper? e.g. add KL loss etc.

Is the following code? Do I set args.aug_tar_agree=True and args.no_da=True?

line 66-71 in trainer.py:

if args.aug_tar_agree and (not args.gray_tar_agree): loss += weight * criterion_cons(ca_t, ca_t_dup) elif args.gray_tar_agree and (not args.aug_tar_agree): loss += weight * criterion_cons(ca_t, ca_t_gray) elif args.aug_tar_agree and args.gray_tar_agree: loss += weight * (criterion_cons(ca_t, ca_t_dup) + criterion_cons(ca_t, ca_t_gray))

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.