I had the same problem, the solution is to also set target_transform in the dataset. I believe it is the masks that are causing the error, and simply converting them to tensors fixed the error for me; haven’t trained a model yet so can’t say for sure that’s the right thing to do.