There are some previous examples of creating custom classes to help work with 4+ channels How to work with 4+ channel images in fastai_v1 which help to clarify things. In the above example, the author is pulling each channel from a different file and appending those together. Obviously you have different requirements.
If you only want to add the alpha channel, I believe that you can just add a parameter to the constructor.
ImageList.from_folder(path_img, convert_mode='RGBA')
I haven’t tested this, but give it a whirl and let me know. FWIW, I just traced the ImageList code. Internally, the open method will be called for each image file in your dataset. open calls open_image which calls PIL’s convert method which takes in the convert_mode
parameter.
The code is definitely hard to trace on github, so if you’re feeling overwhelmed you aren’t alone
Hope this helps!