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 "pixpro_instance_loss" question ??? #8

Open
LiShuiYu opened this issue Apr 27, 2021 · 1 comment
Open

About the "pixpro_instance_loss" question ??? #8

LiShuiYu opened this issue Apr 27, 2021 · 1 comment

Comments

@LiShuiYu
Copy link

Thank you very much for your work and code sharing. In the Pixpro.py, I found that in "pixpro_instance_loss", 'pred_instance_1' has one more predictor layer than 'proj_instance_1_ng'. I don’t quite understand why this is necessary. I am waiting for your reply. Thank you very much.

   if self.pixpro_ins_loss_weight > 0.:
        proj_instance_1 = self.projector_instance(feat_1)
        pred_instacne_1 = self.predictor(proj_instance_1)
        pred_instance_1 = F.normalize(self.avgpool(pred_instacne_1).view(pred_instacne_1.size(0), -1), dim=1)

        proj_instance_2 = self.projector_instance(feat_2)
        pred_instance_2 = self.predictor(proj_instance_2)
        pred_instance_2 = F.normalize(self.avgpool(pred_instance_2).view(pred_instance_2.size(0), -1), dim=1)

    # compute key features
    with torch.no_grad():  # no gradient to keys
        self._momentum_update_key_encoder()  # update the key encoder

        feat_1_ng = self.encoder_k(im_1)  # keys: NxC
        proj_1_ng = self.projector_k(feat_1_ng)
        proj_1_ng = F.normalize(proj_1_ng, dim=1)

        feat_2_ng = self.encoder_k(im_2)
        proj_2_ng = self.projector_k(feat_2_ng)
        proj_2_ng = F.normalize(proj_2_ng, dim=1)

        if self.pixpro_ins_loss_weight > 0.:
            proj_instance_1_ng = self.projector_instance_k(feat_1_ng)
            proj_instance_1_ng = F.normalize(self.avgpool(proj_instance_1_ng).view(proj_instance_1_ng.size(0), -1),
                                             dim=1)

            proj_instance_2_ng = self.projector_instance_k(feat_2_ng)
            proj_instance_2_ng = F.normalize(self.avgpool(proj_instance_2_ng).view(proj_instance_2_ng.size(0), -1),
                                             dim=1)
@LiYuhangUSTC
Copy link

I think it is also an asymmetric architecture design, similar to PPM. See BYOL paper (ref [18] in PixPro paper: https://proceedings.neurips.cc/paper/2020/file/f3ada80d5c4ee70142b17b8192b2958e-Paper.pdf) for details.

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

2 participants