I have build a Keras sequencial model using a pretrained model with addition of some layers. The code is as below. Then tried to predict and expected prediction shape was number of (samples,16) but got the prrediction results as (samples,8). The code for model building and the shape printing are as below.
`
layer_output = base_model.get_layer(output_layer).output
x=layer_output
x = Dense(1024, activation='sigmoid',name='1024_out')(x)
x = Dense(512, activation='sigmoid', name='512_out')(x)
x = Dense(16, activation='sigmoid',name="final")(x)
model = Model(base_model.input, outputs=x)
sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='mean_squared_error', optimizer=sgd)
model.load_weights(weight_path)
The prediction shape andd the shape of last layer output
print("Pred ",model.predict(images[:2]).shape,"Last Layer:",model.layers[-1].output_shape)`
The output is Pred (2, 8) Last Layer: (None, 16)