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??
Asked
Active
Viewed 184 times
-1
-
Can you explain what you already tried? – luistm Dec 07 '19 at 13:57
-
You can train with one dataset using model.pop() to remove the last layer and replace it with the target of the new dataset and train again. – Chris Tosh Dec 07 '19 at 14:09
-
Furthermore, I agree with @luistm that you should add more info and explain also what you have done already. – Chris Tosh Dec 07 '19 at 14:12
-
1i have trained my model ucf 101 dataset now i need to train last layer on hmdb51 – raja Dec 08 '19 at 16:04
1 Answers
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