https://github.com/YinengWang/Supervised-Image-Classification-with-Noisy-Labels-Using-Deep-Learning/blob/19a3be19637ef6ca7202c100a6fabb2dfc2170fd/Custom_dataset.py#L24 If no transformer is present the image object will be close before the return and unexpected behavior can happen. Priority: very very low (we never call it without a transformer)