Hi,
There might be grayscale images in your dataset as you can see in the error, some of images have 3 channels, some of them 1. Try to add a transform to convert colored images to grayscale or vice versa.
Bests