小编Pet*_*agy的帖子

使用 ResNet50,验证准确性和损失不会改变

我正在尝试使用ResNet50Python ( keras)进行图像识别。我试图用 做同样的任务VGG16,我得到了一些这样的结果(对我来说似乎没问题): resultsVGG16。训练和验证的准确率/损失函数每一步都在变好,因此网络必须学习。

然而,随着ResNet50训练函数的投注更好,而验证函数没有改变:resultsResNet

我两次都使用了相同的代码和数据,只是模型发生了变化。

那么ResNet50只在训练数据上学习的原因是什么?

我的 ResNet 模型如下所示:

'''Python

model = Sequential()
base_model = VGG16(weights='imagenet', include_top=False,input_shape= 
(image_size,image_size,3))
for layer in base_model.layers[:-4]:
    layer.trainable=False

model.add(base_model)
model.add(Flatten())
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.4))
model.add(Dense(NUM_CLASSES, activation='softmax'))
Run Code Online (Sandbox Code Playgroud)

VGG 非常相似:

model = Sequential()
base_model = ResNet50(include_top=False, weights='imagenet', input_shape= 
(image_size,image_size,3))
for layer in base_model.layers[:-8]:
     layer.trainable=False

model.add(base_model)
model.add(Flatten())
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.4))
model.add(Dense(NUM_CLASSES, activation='softmax'))
Run Code Online (Sandbox Code Playgroud)

python keras tensorflow resnet cnn

5
推荐指数
1
解决办法
1418
查看次数

标签 统计

cnn ×1

keras ×1

python ×1

resnet ×1

tensorflow ×1