I hadn’t thought of that problem… I can think of two approaches but I can’t tell you which will work the fastest.

Convert each image into .bmp format instead of .jpg. Then use your original loader to load the .bmp format which will decompress much faster than .jpg.
Use torchvision.transforms.ToPILImage which I think should run pretty fast.