Is there any way I can use the ImageNet weights for ResNet50 for my project which has images of shape (224,224,4)? The image has R,G,B,Y channels.
At the moment, I am simply using
model = ResNet50(include_top=True, weights=None, input_tensor=None, input_shape=input_shape, pooling=None, classes=num_classes)
Now, if I need to use the ImageNet weights, I need to always set the number of classes to 1000. I tried doing that, and then popping the last layer, and adding my own Dense(num_classes) layer. However, now, the number of channels is an issue.
Can anyone suggest a way to accommodate 4 channels in the model while using the ImageNet weights?
keras.applications
and modify network whatever you want. I've made a minimal working example of ResNet50 with imagenet weights (what's modified: 1st conv name: 'conv1_NEW', model.load_weights(weights_path, by_name=True)). Link: github.com/kohrah/rnd_stuff/blob/master/ResNet50_4channel.py – Height