mrnet icon indicating copy to clipboard operation
mrnet copied to clipboard

Seems that "Softmax" should be used instead of "Sigmoid"?

Open ABC67876 opened this issue 11 months ago • 0 comments

Hello, thanks for your implementation. However, I found that the "probs" for binary classification doesn't sum up to be 1.0.


        prediction = model.forward(image.float())
        loss = torch.nn.BCEWithLogitsLoss(weight=weight)(prediction, label)
        loss.backward()
        optimizer.step()

        loss_value = loss.item()
        losses.append(loss_value)

        probas = torch.sigmoid(prediction)

        y_trues.append(int(label[0][1]))
        y_preds.append(probas[0][1].item())

The issue mentioned is located in "https://github.com/ahmedbesbes/mrnet/blob/master/train.py"

ABC67876 avatar Jul 23 '23 15:07 ABC67876