Hi @ptrblck,
I did what you suggested here:


Use nn.BCEWithLogitsLoss as your criterion, make sure your model outputs logits with the shape [batch_size, 1, height, width] and use a target with the same shape containing your labels (0 and 1). For the accuracy calculation, you could apply a threshold of 0 to get the predicted class as: preds = outputs > 0.



However, two things happen (which are very contradictory to each other):

Accuracy comes out to be 86% though results look bad
the preds array only contains False. I tested it using :
   print(np.where(preds.data.numpy()[0,0,:,:])[0])