Label image getting noisy during training

Hi,
I’m working on a problem regarding image segmentation.
My input is RGB, and the labels are 4 channels, one for each of the classes. Technically, the first 3 channels form an RGB image and the last channel is added to differentiate between the other 3 classes and the background.
A typical input and label combo looks like this. This is extracted from the dataloader itself, outside training.
index
The specific problem is with my labels (which are also images) totally changing somewhere in the process and I’m not quite sure where or how this is happening
During the training process, I printed the label images for debugging purposes, and this is what i get.
index1

Does anyone know whats going on here?

Thanks.

It looks like you tried to permute your label tensor and somehow the dimensions got mixed up.
Could you search for code using view, permute or another transformation on your labels, and post these here?

Thanks, it was indeed a problem with permutation when I made it go from HxWxC to CxHxW, all fixed now, cheers.