# Dealing with pre-trained model for grayscale images

I would like to do Transfer Learning using one of the novel networks such as VGG, ResNet, Inception, etc.

The problem is that my images are grayscale (1 channel) since all the above mentioned models were trained on ImageNet dataset (which consists of RGB images).

One of the solutions is to repeat the image array 3 times to make it 3 channel.

Is this really the only solution for that? Is it a good solution? Are there any other solutions?

• Here's an answer to it. stackoverflow.com/questions/45939561/… – Shubham Panchal May 4 '19 at 2:36
• Shubham has already provided with another question's link, but I would also like to add one more method here. You can simply change the input layer to accept the grayscale image and then use the pretrained weights for the hidden layers. – thanatoz May 4 '19 at 5:06
• Dear Shubham, the link provides the same way that I asked about which is "repeat the image array 3 times to make it 3 channel". – Hunar May 4 '19 at 13:17
• @thanatoz, could you give more detail? what you mean by "You can simply change the input layer to accept the grayscale image and then use the pretrained weights for the hidden layers.". – Hunar May 4 '19 at 13:18
• @SoK, Sorry, but this approach does not works. Will need to figure out something else. Throws this error Input 0 is incompatible with layer block1_conv1: – thanatoz May 6 '19 at 6:36

print(grayscale_batch.shape)  # (64, 224, 224)