对于迁移学习,我使用的是在 ImageNet 上预训练的 ResNet50 模型。删除最后一层后,我想使用最后一层之前的层的输出(因为最后一层是通过 make 删除的top = False
)作为特征提取器来训练逻辑回归分类器。我在下面的行中得到了这个 UserWarning (在问题的标题中提到):
model = ResNet50(weights='imagenet', include_top = False)
为什么会这样?
对于迁移学习,我使用的是在 ImageNet 上预训练的 ResNet50 模型。删除最后一层后,我想使用最后一层之前的层的输出(因为最后一层是通过 make 删除的top = False
)作为特征提取器来训练逻辑回归分类器。我在下面的行中得到了这个 UserWarning (在问题的标题中提到):
model = ResNet50(weights='imagenet', include_top = False)
为什么会这样?
给出“include_top = False”后我遇到了同样的问题。然后首先我设置“incude_top = True”,下载数据集。之后,我设置“include_top = False”,数据集被下载,没有错误。
base_model = ResNet50(include_top=False,weights='imagenet',input_shape = (224,224,3),pooling='avg')
设置pooling='avg'
或'max'
如果您转到警告链接,您可以在 resnet50.py 的代码中看到它