Предположим, у нас есть модель, уже подготовленная для какой-либо задачи. Можем ли мы использовать прогноз этой модели в качестве лямбда-слоя внутри другой модели? Я думаю что-то в следующем формате:
pretrained_model=get_Model() #Loaded from a different file
pretrained_model.load_weights('pretrained_model_weights.h5')
base_model = VGG16(weights = 'imagenet',include_top=False,input_shape (240,320,3))
for layer in base_model.layers:
layer.trainable = True
img_input=base_model.input
encoded=base_model.output
pretrained_model_output=Lambda(lambda x: pretrained_model.predict(img_input))
#Then run pretrained_model_output through an architecture that gives same output size as base_model.output and then
concat = Concatenate([img_input,Output_Convolutions_pretrained_model_output],axis=-1)
#then feed this through another block in the model
Является ли что-то подобное в Керасе?