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 paletted images for io.image.read_image #2823

Closed
vfdev-5 opened this issue Oct 16, 2020 · 0 comments · Fixed by #2984
Closed

Support paletted images for io.image.read_image #2823

vfdev-5 opened this issue Oct 16, 2020 · 0 comments · Fixed by #2984

Comments

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Oct 16, 2020

🚀 Feature

The following code raises an error for mask images

from torchvision.io.image import read_image

read_image("/data/VOCdevkit/VOC2012/SegmentationClass/2007_000032.png")
> 
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-13-5d26944acaeb> in <module>
----> 1 read_image("/data/VOCdevkit/VOC2012/SegmentationClass/2007_000032.png")

.../lib/python3.7/site-packages/torchvision/io/image.py in read_image(path)
    228     """
    229     data = read_file(path)
--> 230     return decode_image(data)

.../lib/python3.7/site-packages/torchvision/io/image.py in decode_image(input)
    209     output: Tensor[3, image_height, image_width]
    210     """
--> 211     output = torch.ops.image.decode_image(input)
    212     return output
    213 

RuntimeError: Non RGB images are not supported.

The problem is related to paletted type images.

It would be nice to support those images and return a single channel tensor.

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

Successfully merging a pull request may close this issue.

3 participants