ptrblck:

That’s a correct assumption and therefore I would transform the mask to a tensor via torch.from_numpy to keep the class indices. Some transformations, e.g. resizing or ToTensor might destroy your class indices.


Thank you for the answer.
I have another question now, if I am resizing the image so it is suitable as my network input, isn’t it mandatory then to resize the mask too?
also as my mask images do not have the same size as my input images, what is the correct approach to choose here?