Solved by ptrblck in post #2 
              
              
                The error is most likely caused by an image with 4 channels (additional alpha channel), while the rest seem to use 3 channels (RGB only). 
You could iterate your DataLoader once and make sure it’s able to create the batches. 
How would a “fault-tolerant” dataset work? I.e. you could use a try/except …