Keras pretrain CNN with TimeDistributed
My simple solution is a pretty one.
Considering you are using a pre-trained network from keras, you can replace it with your own pre-trained network too.
Here's a simple solution::
model_vgg=keras.applications.VGG16(input_shape=(256, 256, 3),
include_top=False,
weights='imagenet')
model_vgg.trainable = False
model_vgg.summary()
If you want to use any intermediate layers then, otherwise replace 'block2_pool' with last layer's name::
intermediate_model= Model(inputs=model_vgg.input, outputs=model_vgg.get_layer('block2_pool').output)
intermediate_model.summary()
Finally wrap it in a TimeDistributed Layer
input_tensor = Input(shape=(time_steps,height, width, channels))
timeDistributed_layer = TimeDistributed( intermediate_model )(input_tensor)
Now you can simply do::
my_time_model = Model( inputs = input_tensor, outputs = timeDistributed_layer )