Solved by ptrblck in post #2 
              
              
                Based on the output shape it looks like you have 32 different classes. 
Your target shape, i.e. the segmentation mask, should have the shape [batch_size, 224, 224], and should contain the class indices as its values. 
The spatial size mismatch between the target mask and the model output does matter…