Tricks-of-Semi-supervisedDeepLeanring-Pytorch icon indicating copy to clipboard operation
Tricks-of-Semi-supervisedDeepLeanring-Pytorch copied to clipboard

FixMatch for single class

Open dendrobiumz opened this issue 5 years ago • 1 comments

I try to apply FixMatch on one class data. For the unsupervised loss part, I modified the code like that.

self.uce_loss   = torch.nn.BCEWithLogitsLoss(reduction='none')
with torch.no_grad():
    woutputs = self.model(weak_u)
    woutputs = torh.sigmoid(woutput)
      
           
mask = woutputs .ge(self.threshold).float()
soutputs = self.model(strong_u)
uloss  = torch.mean(mask* self.uce_loss(soutputs, mask) )

Is that correct?

dendrobiumz avatar Aug 01 '20 15:08 dendrobiumz

It seems ok. Running your code is the best way to check it. Then I advised you to verify the effectiveness of the data augmentation on your data. The data augmentation plays the important role.

iBelieveCJM avatar Aug 20 '20 11:08 iBelieveCJM