Reputation:
I have a InceptionV3 model built in Keras.
cnn_model = InceptionV3(weights='imagenet', include_top=False)
#Adding custom layers to the model (output layer)
x = cnn_model.output
x = Flatten()(x)
x = Dense(units=1024, activation='relu')(x)
x = Dropout(0.25)(x)
x = Dense(2048, activation='relu')(x)
predictions = Dense(units=4, activation='softmax')(x)
#Creating the predictor model
predictor_model = Model(input=cnn_model.input, output=predictions)
return predictor_model
I need to save the output from the final pool layer and convert these output (features) into a sequence to process that sequence in an LSTM layer. Actually i'm working with frames (of a video, of course), but I still don't know how to do this.
So, to confirm, i need to:
Thanks a lot for the support!
Upvotes: 0
Views: 1679
Reputation:
I found out the answer!
To extract the output from the final pooling layer in a Keras InceptionV3 module you have just to:
output = cnn_model.get_layer('avg_pool').output
You can check the name of the layers and more module informations using this snippet:
from keras.applications.inception_v3 import InceptionV3
model = InceptionV3()
model.summary()
If you use the InceptionV3 module, you'll get this:
avg_pool (GlobalAveragePooling2 (None, 2048) 0 mixed10[0][0]
Best,
Arthur.
Upvotes: 1