Add a new parameter to skip conversion to PIL Image for VisionDataset Loading
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
🚀 Feature
Add a new parameter to skip conversion to PIL Image for VisionDataset Loading
Motivation
The original slowness-related issue was brought up in https://github.com/pytorch/pytorch/issues/42405. This SO question: https://stackoverflow.com/questions/63202478/why-pytorch-is-slower-than-tensorflow-in-read-data/63204186#63204186 is a live example.
The investigation (https://github.com/pytorch/pytorch/issues/42405#issuecomment-670971616) pointed to the fact that we are converting from Tensor -> PIL Image -> Tensor (via a toTensor Transform), which seems unnecessary.
Pitch
We want to allow VisionDataset to directly return Tensor without converting to PIL Image. This will be controlled by a parameter which for BC will be turned off by default.
Alternatives
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the VisionDataset loading path and trace the Tensor → PIL Image → Tensor conversion described in the issue. Define the parameter's default behavior for backward compatibility and verify that tensor-returning datasets avoid the conversion while existing behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100