Hello
np.unpackbits get 24 bits for Cityscapes  we reverse the order (total 19 classes) for SBD  datasets we reverse the order (total 20 classes)
For ADE20K that has 150 classes what i do for getting 150 bits.
def _sync_transform(self, img, mask):
#hy modified this function
# random crop crop_size
crop_size = self.crop_size
w, h = img.size
x1 = random.randint(0, w - crop_size)
y1 = random.randint(0, h - crop_size)
img = img.crop((x1, y1, x1+crop_size, y1+crop_size))
mask = mask.crop((x1, y1, x1+crop_size, y1+crop_size))
#np.unpackbits get 24 bits, we extract [:,:5:] and reverse the order (total 19 classes), i.e. [:,:,-1:-20:-1]
mask = np.unpackbits(np.array(mask), axis=2)[:,:,-1:-20:-1]
mask = torch.from_numpy(np.array(mask)).float()
mask = mask.transpose(0, 1).transpose(0, 2) #channel first
# return img, self._mask_transform(mask)
return img, mask
Thank you