Closed
Description
🚀 Feature
The current torchvision.io.read_image
function reads a JPEG
or PNG
image into a 3 dimensional RGB Tensor. When the image has a single channel, this function throws a runtime error saying "RuntimeError: Non-RGB images are not supported.".
It would be nice to add support for non-RGB images.
Motivation
This can be extremely helpful for example when reading in the segmentation maps in the VOC dataset which are originally single-channel png images.
Pitch
This can probably be resolved in the method decode_image
by converting the image to RGB with a boolean flag to_rgb=True
similar to MXNet's image read method here as an argument.
Alternatives
For now to get around these, one needs to use the PIL Image module or OpenCV. torchvision native io doesn't support these.
Metadata
Metadata
Assignees
Labels
No labels