我希望我的cnn仅提取要进一步传递给lstm进行分类的功能,但不确定在合并后是否需要添加任何其他图层?
input_size = (img_size, img_size, 3)
if model_name == "resnet":
baseModel = ResNet50(
weights="imagenet",
include_top=False,
input_shape=(img_size, img_size, 3)
)
headModel = baseModel.output
headModel = GlobalMaxPooling2D()(headModel)
model = Model(inputs=baseModel.input, outputs=headModel)
model.summary()
对于baseModel.layers中的图层: layer.trainable = True