Hi Guys,
I found a solution to the problem.
It was not because I was also returning the labels. It was because some images had 3 channels while some had only 1.
I fixed it by adding .convert(‘RGB’) to the image loading line.
Thanks