SDT icon indicating copy to clipboard operation
SDT copied to clipboard

Only have positive pairs?

Open Meimeiainaonao opened this issue 1 year ago • 2 comments

Thanks for your sharing!

May I have a question about NCELoss? I cannot find how to choose the negative samples in your code. I only found how to choose the positive pairs in your ''random_double_sampling'' and how to calculate the NCELoss by using the positive pairs. So May I know where is the part I need?

Thanks for your help.

image

Meimeiainaonao avatar Nov 02 '23 11:11 Meimeiainaonao

Hi~ Thanks for your attention. As mentioned in our paper, our GlyphNCE independently samples positive pairs within a character, and samples negative samples from other characters, as illustrated in Figure 3. In our code implementation, we use the in-batch contrastive loss where the negative samples are all characters in one batch except for the anchor sample. More implementation details can be seen in SupConLoss.

dailenson avatar Nov 03 '23 15:11 dailenson

Wow, Thanks for your answer! I got it!

Meimeiainaonao avatar Nov 05 '23 06:11 Meimeiainaonao