Solved by ptrblck in post #2 
              
              
                PyTorch doesn’t provide any image decoding methods and torchvision uses PIL by default. 
You could try to use OpenCV instead of PIL or alternatively PIL-SIMD, which might speedup your code.