除了最后一个Dense层以外,谁能告诉我如何固定模型的权重。
我的代码:
VGG_model=keras.applications.vgg16.VGG16(input_shape=(224,224,3),weights='imagenet', include_top=True)# Generate a model with all layers (with top)
#Add a layer where input is the output of the second last layer
x = Dense(2, activation='softmax', name='predictions')(VGG_model.layers[-2].output)