I have a greyscale dataset that I am plugging into the standard flow from lesson 1.
Without any changes it looks like the fastai library is handling it quite well.
Can anyone provide any insight what the library is doing?
Should I bother converting the images to 3 channel? my initial strategy would be to just duplicate the existing channel 2 more times.
I am interested in greyscale images, too. It is my understanding that the
open_image() method, which is part of
FilesDataset() automatically converts images to “RGB”. So you will always get a shape of (sz_x, sz_y, 3).
You can test by
This is because all the models pretrained on ImageNet expect RGB images. For greyscale images this might work, but is kind of a waste of memory and computation time. Adapting fastai to greyscale images would be some work, as many parts, including
transforms.py are involved.
Anyone else with experience using greyscale images in fastai?
I think you are right in that fast.ai library can handle greyscale images. I had some success recently using transfer learning with grey scale images.
As for adding the ability to handle greyscale images into fast.ai I feel like that might not be a great idea because for transfer learning I think the images have to be converted to the same size(l,w) and channels as the images used to originally train the transfer learning model. so in order to use transfer learning model in grey scale only mode the original model would need to have been trained in grey scale only.
This is all conjecture… I have not reviewed source code for this comment.
Well, it might not be a great idea for transfer learning using the in-built pre-trained models. You could, however, train your own, say, classifier on grayscale images (with 1 channel, instead of three), then shave the head off and transfer it it to some other problem. In that case it would make sense to change some parts of fastai to handle grayscale images correctly.