OpenCV or PIL Image? Which one is better for PyTorch?

There seem to be some benchmarks showing a better performance for OpenCV, while others show some use cases where PIL is the winner (or Pillow-SIMD).
Pillow-SIMD is a drop-in replacement for PIL using SIMD operations.

You can find some benchmarks here, but as always with benchmarks I would be skeptical.

Personally, I would recommend to use PIL, since it’s supported by torchvision which makes data augmentation and processing quite easy.

1 Like