aauker:

Everything is fine technically. I was mostly curious if a pure C++ implementation would actually be faster/possible.


The transforms are all implemented in C under the hood. The PyTorch vision transform functions are just wrappers around the PIL (pillow) library and the PIL operations are implemented in C. It’s unlikely (but possible) that the overhead of the Python wrapper pieces are the bottleneck.
As @JuanFMontesinos wrote, pillow-simd is faster than pillow. The accimage 18 library is probably even faster, but only supports a few transforms.
If you’re trying to optimize data loading, you should try to simplify your program as much as possible and measure independent pieces. You’ve already ruled out the GPU part of the network. So temporarily get rid of the DataLoader and multiprocessing which are complicated and:

Measure file loading times
Measure the transform times on a single tile
Measure the transform time on a composite (?) image

If you’re on Linux, use perf top 7 to figure out if the bulk of the time is spent in Python or in the native C code.
From what you wrote, it seems likely that the transforms are just slow and your images are huge. There’s a good chance that some of your data augmentations are not very helpful for your task – try getting rid of some. For example, my experience with ColorJitter is that it had no effect for training ResNet classifiers on ImageNet. I’m also confused by the RandomResizedCrop followed by the Resize – that seems redundant?