dvlab-research / Parametric-Contrastive-Learning

Parametric Contrastive Learning (ICCV2021) & GPaCo (TPAMI 2023)
https://arxiv.org/abs/2107.12028
MIT License
240 stars 32 forks source link

Question about inference function in moco/builder.py #13

Closed pseulki closed 2 years ago

pseulki commented 2 years ago

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_avgq as input for linear. Then, it doesn't seem to need the first two lines in the code. Or, should _self.feat_after_avgq 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_
jiequancui commented 2 years ago

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