I want to create an autoencoder starting from the vector of the features extracted with the Inception Resnet V2 model and following the diagram shown in the following image:
This is the code I wrote at the moment:
image_size = (150, 150, 3)
model = InceptionResNetV2(weights='imagenet', include_top=False, input_shape=image_size)
for layer in model.layers:
layer.trainable = False
feature = model.predict(x[:10])
print(feature.shape) # (10, 3, 3, 1536)
What is the way to implement this in Keras? Thank you for your time.
from tensorflow.keras.layers import Input, Dense
from tensorflow.keras.models import Model
inputs = Input(1536)
x = inputs
x = Dense(500, activation='relu')(x)
x = Dense(2, activation='relu')(x)
x = Dense(500, activation='relu')(x)
x = Dense(1536, activation='relu')(x)
full_model = Model(inputs, x)
print(full_model.summary())
On a side note, I highly doubt that this autoencoder could work with such a small bottleneck, so I'd increase it from 2 to some larger value (maybe 100).