SDT
SDT copied to clipboard
Only have positive pairs?
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.
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.
Wow, Thanks for your answer! I got it!