我想在Eurosat-rgb数据集中使用带有迁移学习的EfficientNet。我的问题是,它似乎不会学习。
首先,我从使用迁移学习和MobileNet的以下模型开始,它在(1)上工作得很好
model_base = tf.keras.applications.MobileNet(weights='imagenet', include_top=False, input_shape=input_shape=(224,224,3))
model_base.trainable=False
model = tf.keras.Sequential([
model_base,
tf.keras.layers.GlobalAveragePooling2D(name="avg_pool"),
tf.keras.layers.Dense(10, activation="softmax", name="predictions")
])
然后,我从MobileNet更改为EfficientNetB1,突然它没有学到任何(2)。然后,如果我尝试使用model_base.trainable=True,训练精度会提高,但验证精度(3)不会提高。
我做错了什么?
如果我在没有迁移学习的情况下使用EfficientNet,我也会得到很好的结果(4),但这显然需要很多时间。我也尝试过将优化器从sgd改为adam,但也不起作用。
发布于 2021-05-20 04:39:50
我认为,对于Mobilenet,预处理功能会在-1到+1之间缩放图像。然而,对于EfficientNetB1,文档中提到了here
Note: each Keras Application expects a specific kind of input preprocessing.
For EfficientNet, input preprocessing is included as part of the model
(as a Rescaling layer), and thus tf.keras.applications.efficientnet.preprocess_input
is actually a pass-through function.
EfficientNet models expect their inputs to be float tensors of pixels with values
in the [0-255] range.
因此,当您从Mobilenet更改到Efficientnet时,请确保删除像素值的任何重新缩放
https://stackoverflow.com/questions/67608988
复制相似问题