thuml / Transfer-Learning-Library

Transfer Learning Library for Domain Adaptation, Task Adaptation, and Domain Generalization

Home Page:http://transfer.thuml.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于Debiased Self-Training的问题

PpxiA6 opened this issue · comments

commented

作者你好,最近阅读到你们这篇Debiased Self-Training文章,对我近期的项目很有启发,十分感谢你们做的工作,我想请问下原文中式7在代码中如何体现的呢?WorstCaseEstimationLoss是用于获取最坏情况的分类头,但是我好像没找到如何在这个最坏的分类头上优化特征表示用于提升最坏分类头的性能,恳请作者能够指点一下,十分感谢。

可以参考这里的实现

class Classifier(ClassifierBase):

具体来说,在line54我们定义了一个梯度反转层,其作用为使得backbone和worst head的目标相反,即进行对抗的训练(line84-85)

训练worst head的目标函数实现在

class WorstCaseEstimationLoss(nn.Module):

其在labeled data上和main head输出尽可能一致,而在unlabeled data上和main head输出尽可能不一致