-1

I have trained my cnn-lstm on ucf 101 dataset. Now I want to train it on hmdb-51 dataset only on the last Dense layer a using pretained ucf-101 model weight for the rest of the layers. How can I do that??

raja
  • 1

1 Answers1

2

What can be done is to train your model with your source dataset A which contains L target output layers. Having trained your weights, you could load that weights remove the last layer using, for example, Keras model.pop() function and train your last layer with the new target. The following code is not tested, but you need to follow the logic:

model = Model_A()
model.compile(....)
model.fit(X_train_A, y_train_A, nb_epoch=..., batch_size=...,...)
# you load model_A which is defined for your dataset A and then you perform fit with the data from dataset A.
model.pop()
model.add(Dense(nb_classes_dataset_B))
# then proceed with model.fit() for dataset B
Chris Tosh
  • 446
  • 2
  • 8