使用多种技术降低后,验证错误没有下降



我一直在努力减少我在训练的CNN中出现的验证错误数量。我尝试了各种方法,如l1和l2正则化、丢弃、高斯噪声和重塑CNN网络。然而,验证错误从未下降到0.5以下,这对我的应用程序来说太高了(我需要它接近0.1或0.2(。以下是CNN的副本,没有任何方法来减少验证错误:

model = Sequential()
model.add(Reshape((20, 60, 3)))
model.add(Conv2D(24, (5, 5), input_shape=(20, 60, 3), activation='relu'))
model.add(Conv2D(36, (5, 5),activation='relu'))
model.add(Conv2D(48, (5, 5),  activation='elu'))
model.add(Conv2D(64, (3, 3), activation='elu'))
model.add(Conv2D(64, (3, 3), activation='elu'))
model.add(Flatten())
model.add(Dense(50, activation = 'relu', bias_regularizer=l1(0.09)))
model.add(Dense(50, activation = 'elu'))
model.add(Dense(10, activation = 'relu'))
model.add(Dense(1))
model.compile(Adam(lr = 0.0001, decay=1e-6), loss='mse', metrics = ['mae'])
<!-- end snippet -->

Epoch 1/500
84/84 [==============================] - 1s 9ms/step - loss: 35.1210 - mae: 4.9702 - val_loss: 1.8467 - val_mae: 1.0457
Epoch 2/500
84/84 [==============================] - 0s 6ms/step - loss: 1.4348 - mae: 0.9413 - val_loss: 1.0911 - val_mae: 0.8573
Epoch 3/500
84/84 [==============================] - 0s 6ms/step - loss: 1.1180 - mae: 0.8686 - val_loss: 1.1062 - val_mae: 0.8561
Epoch 4/500
84/84 [==============================] - 0s 6ms/step - loss: 0.9902 - mae: 0.8055 - val_loss: 0.9725 - val_mae: 0.8031
Epoch 5/500
84/84 [==============================] - 0s 6ms/step - loss: 0.8890 - mae: 0.7571 - val_loss: 0.8132 - val_mae: 0.7385
Epoch 6/500
84/84 [==============================] - 0s 6ms/step - loss: 0.7439 - mae: 0.6985 - val_loss: 0.8021 - val_mae: 0.7304
Epoch 7/500
84/84 [==============================] - 0s 6ms/step - loss: 0.7172 - mae: 0.6676 - val_loss: 0.7327 - val_mae: 0.6954
Epoch 8/500
84/84 [==============================] - 0s 6ms/step - loss: 0.6808 - mae: 0.6522 - val_loss: 0.6892 - val_mae: 0.6690
Epoch 9/500
84/84 [==============================] - 0s 6ms/step - loss: 0.6084 - mae: 0.6209 - 
[...Continues training ...]
val_loss: 0.5327 - val_mae: 0.5292
Epoch 479/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0407 - mae: 0.1361 - val_loss: 0.5249 - val_mae: 0.5315
Epoch 480/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0320 - mae: 0.1203 - val_loss: 0.5199 - val_mae: 0.5223
Epoch 481/500
84/84 [==============================] - 1s 7ms/step - loss: 0.0334 - mae: 0.1199 - val_loss: 0.5439 - val_mae: 0.5354
Epoch 482/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0368 - mae: 0.1300 - val_loss: 0.5356 - val_mae: 0.5373
Epoch 483/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0493 - mae: 0.1555 - val_loss: 0.5455 - val_mae: 0.5430
Epoch 484/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0380 - mae: 0.1315 - val_loss: 0.5240 - val_mae: 0.5278
Epoch 485/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0364 - mae: 0.1320 - val_loss: 0.5132 - val_mae: 0.5233
Epoch 486/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0388 - mae: 0.1309 - val_loss: 0.5558 - val_mae: 0.5499
Epoch 487/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0386 - mae: 0.1369 - val_loss: 0.5442 - val_mae: 0.5376
Epoch 488/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0347 - mae: 0.1269 - val_loss: 0.5334 - val_mae: 0.5344
Epoch 489/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0393 - mae: 0.1368 - val_loss: 0.5507 - val_mae: 0.5383
Epoch 490/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0348 - mae: 0.1307 - val_loss: 0.5382 - val_mae: 0.5337
Epoch 491/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0341 - mae: 0.1253 - val_loss: 0.5301 - val_mae: 0.5367
Epoch 492/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0359 - mae: 0.1342 - val_loss: 0.5293 - val_mae: 0.5317
Epoch 493/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0360 - mae: 0.1325 - val_loss: 0.5434 - val_mae: 0.5443
Epoch 494/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0339 - mae: 0.1275 - val_loss: 0.5341 - val_mae: 0.5305
Epoch 495/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0358 - mae: 0.1252 - val_loss: 0.5621 - val_mae: 0.5478
Epoch 496/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0379 - mae: 0.1341 - val_loss: 0.5228 - val_mae: 0.5293
Epoch 497/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0297 - mae: 0.1174 - val_loss: 0.5345 - val_mae: 0.5335
Epoch 498/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0328 - mae: 0.1252 - val_loss: 0.5492 - val_mae: 0.5454
Epoch 499/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0361 - mae: 0.1332 - val_loss: 0.5421 - val_mae: 0.5382
Epoch 500/500
84/84 [==============================] - 1s 6ms/step - loss: 0.0294 - mae: 0.1182 - val_loss: 0.5354 - val_mae: 0.5380

我如何才能减少验证错误,以及其他技术不起作用的原因是什么?

如果您在epoch 500检查您的val_loss,您将看到他的值为0.5354,而训练损失为0.0294。它几乎大了20倍。此外,如果你只关注val_loss,你会看到从epoch 8(0.6892(到epoch 500(0.5354(,你做出了非常小的改进。所以您可以说您是过拟合

为了避免这种情况,您应该在训练和验证之间获得超级相似的val值。

避免过度拟合的典型步骤:

  • 使用更多数据进行训练(我不知道在你的情况下是否可能(
  • 增加CNN的复杂性(更多的层和每层更多的神经元(
  • 使用额外的技术(正如您已经使用的:丢弃、正则化等(
  • 降低学习率(甚至更多(

可能在应用技术后没有达到效果,因为你没有避免过拟合。你的网络似乎太简单了,或者你只有一些数据。

相关内容

  • 没有找到相关文章

最新更新