При использовании предварительно обученного VGG19 с TimeDistributed в Keras у меня возникает следующая ошибка:
TypeError: can only concatenate tuple (not "list") to tuple
Это в windows, Keras, python3.6
def build_vgg(self):
img = Input(shape=(self.n_frames, self.img_rows, self.img_cols, 3))
# Get the vgg network from Keras applications
vgg = VGG19(weights="imagenet", include_top=False, input_shape=(self.img_rows, self.img_cols, 3))
# Output the first three pooling layers
outputs = [vgg.layers[i].output for i in self.vgg_layers]
vgg.outputs = outputs
# Create model and compile,
vggmodel = Model(inputs=vgg.inputs, outputs=outputs)
vggmodel.trainable = False
h2 = layers.wrappers.TimeDistributed(vggmodel)(img)
model = Model(inputs=img,outputs=h2)
model.compile(loss='mse', optimizer='adam')
return model
IЯ ожидаю, что обученная модель VGG19 будет загружена, а оболочка TimeDistributed будет использовать обученную модель и заставит ее работать в Видео.
Ошибка, отображаемая при выполнении этой строки в коде:
h2 = layers.wrappers.TimeDistributed(vggmodel)(img)