How to load indexed images (color maps) using dataset loader
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
The dataset loader returns image loaded as rgb. Which is great for all other purposes, but loading an indexed image for example segmentation mask is a pain.
This is the line :
https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py#L161
The PIL module does load images by default if they are just color maps, can we not just return without conversion to rgb or pass a flag to convert to rgb ?
OR is there any other better way of creating a dataloader with the masks folder ?
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 torchvision/datasets/folder.py line 161 and inspect how the dataset loader converts images through PIL. Compare the current RGB behavior with the needs of indexed segmentation masks and determine whether preserving the source mode or adding an option is appropriate. Done means the loader can support masks without losing their indexed color-map values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100