Hi @ptrblck, The main problem for me is, in the original implementation of SupContrast, labels [ground truth] are just numbers from 0-9, but in my case ground truth is an image of shape [bsz, h,w], what I wanted to do is I wanted to define supervised contrastive loss at the pixel level, that is If two pixels are labeled with the same class, I want to make them a positive pair, otherwise, a negative pair.