Actually, the assert is raised. I checked the image (numpy array) coming from the dataset class is indeed 4 channels every time. It seems that when the dataloader is getting the image, sometimes it converts it into a 3 channel?
I narrowed it down to it being albementations that converts it to 3 channels ‘sometimes’. Still can’t pinpoint why its doing it.