🚀 The feature
- Add "torchvision" image loader backend based on new
torchvision.io APIs (See: Release Notes v0.20) and enable it by default.
- VisionDatasets should return
TVTensor images by default instead of PIL.Image.
Motivation, pitch
- TorchVision v0.20 introduces new
torchvision.io APIs that enhance its encoding/decoding capabilities.
- Current VisionDatasets returns
PIL.Image by default, but the first step of transforms is usually transforms.ToImage().
- PIL is slow (See: Pillow-SIMD), especially when compared with new
torchvision.io APIs.
- Current TorchVision image loader backends are based on PIL or accimage, not including new
torchvision.io APIs.
Alternatives
- The return type of datasets can be
PIL.Image when using the PIL or the accimage backends, and be TVTensor if using new APIs (may lose consistency).
Additional context
I would like to make a pull request if the community likes this feature.