Tricks-of-Semi-supervisedDeepLeanring-Pytorch
Tricks-of-Semi-supervisedDeepLeanring-Pytorch copied to clipboard
FixMatch for single class
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?
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.