In the recent human atlas competition on kaggle, we have given 4 channel images. I am using fastai_v1. I tried to modify the internal code but got errors. Also, pretrained networks are for 3 channels. So got no idea how to do this. If anyone has tried something, please tell
Maybe this kaggle kernel can help you (however, it is based on fastai v0.7): https://www.kaggle.com/iafoss/pretrained-resnet34-with-rgby-0-460-public-lb
Actually like this kernel, I tried to use the internal code of fastai_v1. But I couldn’t change it
I have the same question. After trying to look at the source code for FastAI v1/pytorchvision, It seems like both rely heavy on PIL for importing images. However, looking at the PIL package shows that it only supports up to RGB + Alpha. Link to PIL Concenpts And it seems like alot of people are just converting TIF files with multiple channels to JPEG and throwing out the extra channels like planet competition.
Does FastAi support 4+ channels natively or do we need to export each channel as an image, import each channel, combine, and run the model like the RGBY kaggle kernel mentioned above?
These are two examples of how to deal with multiple channels images (both based on human atlas competition):
The current version of data block api is very simple to customize: my code that use 4+ channel images is:
... class MultiChannelImageItemList(ImageItemList): def open(self, fn): return openMultiChannelImage(fn) ... il = MultiChannelImageItemList.from_df(path=path, df=train_data_and_labels_df, cols=x_cols) ils = il.random_split_by_pct() ...
Of course you’ve to adapt your model to accept 4+ channels images…