copperwiring:

I was wondering if the vectors need to be one-hot encoded or not?


For a multi-class classification or segmentation, the target should not be one-hot encoded.
Based on your masks output, it seems that you might be dealing with a multi-label segmentation, where each pixel might belong to zero, one, or multiple classes.
Some pixels have no active class (e.g. row0, last column). Is that your use case?