How to convert rgba 4 channel map to single channel map by pytorch?
I think you can use the
PIL Image API to apply transformations to your image.
If you opened the image with
PIL then you can use the
Image.convert() method as seen in the docs to convert RGBA to a single channel.
I haven’t tested the below snippet but I think it may work. Give it a try I got the modes from here.
from PIL import Image img = Image.open('myrgba.png').convert(mode='RGBA')