调用resnet50权重_使用ResNet50,验证准确性和损失不会改变

在使用ResNet50进行图像识别时,训练准确率上升但验证准确率不变。问题可能与预训练模型有关。通过将数据增强步骤更改为使用`tf.keras.applications.resnet.preprocess_input`,验证准确率从50%逐渐提升到97%。完整代码示例展示了在猫狗分类数据集上达到95%以上训练和验证准确率的ResNet50模型。
摘要由CSDN通过智能技术生成

bd96500e110b49cbb3cd949968f18be7.png

I am trying to do image recognition with ResNet50 in Python (keras). I tried to do the same task with VGG16, and I got some results like these (which seem okay to me):

resultsVGG16 . The training and validation accuracy/loss functions are getting better with each step, so the network must learn.

However, with ResNet50 the training functions are betting better, while the validation functions are not changing: resultsResNet

I've used the same code and data in both of the times, only the model is changed.

So what are the reasons of ResNet50 learning only on the training data?

My ResNet model looks like this:

'''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'))

The VGG is very similar:

model = Sequential()

base_model = ResNet50(include_top=False, weights='imagenet', input_shape=</

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值