Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for non-rgb images in io.read_image & io.decode_image #3194

Closed
AnirudhDagar opened this issue Dec 19, 2020 · 1 comment
Closed

Support for non-rgb images in io.read_image & io.decode_image #3194

AnirudhDagar opened this issue Dec 19, 2020 · 1 comment

Comments

@AnirudhDagar
Copy link
Contributor

AnirudhDagar commented Dec 19, 2020

🚀 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.

@AnirudhDagar
Copy link
Contributor Author

nvm i think this should be fixed in #3024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant