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

About the gan-loss #181

Open
cannonli7 opened this issue Oct 20, 2023 · 2 comments
Open

About the gan-loss #181

cannonli7 opened this issue Oct 20, 2023 · 2 comments

Comments

@cannonli7
Copy link

Thanks for your work. Im a little curious about the code of the gan loss in MAE? But i cannot find the code in this repository. could you help me with that

@tangky22
Copy link

Thanks for your work. Im a little curious about the code of the gan loss in MAE? But i cannot find the code in this repository. could you help me with that

Hello, I also curious about the gan loss in MAE. I found the process is the same when loading two models in demo.py and I also couldn't find definiton of gan loss in the code. Have you solve the problem?

@kevin-Abbring
Copy link

Thanks for your work. Im a little curious about the code of the gan loss in MAE? But i cannot find the code in this repository. could you help me with that

def forward_loss(self, imgs, pred, mask):
    """
    imgs: [N, 3, H, W]
    pred: [N, L, p*p*3]
    mask: [N, L], 0 is keep, 1 is remove, 
    """
    target = self.patchify(imgs)
    if self.norm_pix_loss:
        mean = target.mean(dim=-1, keepdim=True)
        var = target.var(dim=-1, keepdim=True)
        target = (target - mean) / (var + 1.e-6)**.5

    loss = (pred - target) ** 2
    loss = loss.mean(dim=-1)  # [N, L], mean loss per patch

    loss = (loss * mask).sum() / mask.sum()  # mean loss on removed patches
    return loss
    
    如果不是,就是?我也没有找到明文的gan_loss代码,只能暂且这么认为。

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

No branches or pull requests

3 participants