The error claims the height of the images is different as:
Got 406 and 513 in dimension 3

so it seems the Resize is not used at all.
Could you post the complete stack trace? Maybe the error isn’t raised by the DataLoader at all.