I am struggling on using CNN with BCELoss to classify with 0 or 1 images. Basically the loss struggles with the type of the labels but I really don’t understand how I should do it. Basically I have a class Dataset that opens an image and depending on having or not a feature I define a variable label as int 1 or int 0. Then, I convert it to tensor using torch.Tensor() and this class returns a sample with the image and the label. But then, when I try to train it, it always gives errors in the loss function and I really don’t understand why it doesn’t work.
Can someone help me? Thank you in advance.