You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So for your use-case, it might be best to simply call the ToGrayscale transform on such images. It would be a no-op for images which are already in grayscale.
@NicolasHug , thank you for the reply.
I've just noticed the Note on ImageReadMode page, so thanks for pointing that out.
Is there a possibility to add this extra call inside the function just for the WEBP to keep things consistent?
Not sure how it's implemented, but opencv can read WEBP as grayscale if you specify it in read function. I think tensorflow is also able to read it as a grayscale image, although, I'm not sure.
Or at least emit a warning when trying to open WEBP with ImageReadMode.GRAY so that it's super clear what went wrong if you missed the note in documentation?
🐛 Describe the bug
The
read_image
func ignoresImageReadMode.GRAY
when reading WEBP images. It produces tensors with 3 color channels instead of 1.Example image: here
Reproduction code:
Expected:
torch.Size([1, 576, 1022])
Actual:
torch.Size([3, 576, 1022])
Versions
The text was updated successfully, but these errors were encountered: