Could you check the values of your mask? Resizing a target mask without specifying an interpolation technique such as NEAREST might corrupt the mask tensor.
Also, your model seems to output a single channel (1 class), while nn.NLLLoss is used for a multi-class classification use case (>= 2 classes) and expects an output of [batch_size, nb_classes, height, width] for a segmentation use case.
If you are dealing with a binary classification use case, you might want to use nn.BCEWithLogitsLoss instead.