dvlab-research / Parametric-Contrastive-Learning

Parametric Contrastive Learning (ICCV2021) & GPaCo (TPAMI 2023)

Home Page:https://arxiv.org/abs/2107.12028

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about inference function in moco/builder.py

pseulki opened this issue · comments

Hello, I'm impressed with your work and thank you for sharing the codes.

I have a question abut inference function in LT/moco/builder.py !
In the code below, you are not using q but using self.feat_after_avg_q as input for linear.
Then, it doesn't seem to need the first two lines in the code.
Or, should self.feat_after_avg_q be changed to q?
Can you check this?
Thank you in advance! :)

_def _inference(self, image):
q = self.encoder_q(image)
q = nn.functional.normalize(q, dim=1)
encoder_q_logits = self.linear(self.feat_after_avg_q)

    return encoder_q_logits_

Hi,

Thanks for your question.

"self.feat_after_avg_q" is updated by the hook function defined in https://github.com/dvlab-research/Parametric-Contrastive-Learning/blob/main/LT/moco/builder.py #95

Best,
Jiequan