#TimeDistributed: #(1). take Conv2D model and actually make it a "Model" according to the functional API conv_model_single_image_as_model = Model(inputs=[image_input], outputs=[conv_model_single_image]) #(2). make it time distributed or bidirectional(TimeDistributed) conv_model_time_distributed = TimeDistributed( conv_model_single_image_as_model)(image_inputs) #(3). after TimeDistributed we have a tensor of shape (batch_size,number_of_time_steps,single_model_output) # so i need to add a top layer to output something of desired shape: conv_model_time_distributed = Flatten()(conv_model_time_distributed) conv_model_time_distributed = Dense(2)(conv_model_time_distributed) #(3). make the whole thing, after TimeDistributed, a Model according to the functional API: #K.set_learning_phase(0) conv_model_time_distributed = Model(inputs=[image_inputs], outputs=[conv_model_time_distributed]) conv_model_time_distributed._uses_learning_phase = True #for learning=True, for testing = False #Visualize Model: if flag_plot_model == 1: keras.utils.plot_model(conv_model_single_image_as_model) keras.utils.vis_utils.plot_model(conv_model_single_image_as_model) from IPython.display import SVG from keras.utils.vis_utils import model_to_dot SVG( model_to_dot(conv_model_single_image_as_model).create(prog='dot', format='svg')) #Summarize Model: conv_model_single_image_as_model.summary() conv_model_time_distributed.summary()