如何改进 val_loss 和 val_acc

我正在训练卷积神经网络(使用 for segmentation)。而且我对验证结果有疑问(val_loss, val_acc-in network for segmentation 正在使用 term val_dice_coef),因为只有很小的变化,并且与 -and 相比,结果没有acc 改善。dice_coefloss


我正在将此代码示例与自己的优化器一起使用 - 我的参数:


total_number_of_data = 3547 #val + training data

epochs = 400

image_size = 128

batch_size = 2

val_data_size = 400


opt = optimizers.RMSprop(learning_rate=0.0000001, decay=1e-6)

350历元后的结果:


epoch |     dice_coef      |        loss         |      val_loss      |   val_dice_coef

------------------------------------------------------------------------------------------

1     | 0.5633156299591064 | 0.43668392300605774 | 0.4752978980541229 | 0.5247021317481995

350   | 0.9698152542114258 | 0.03018493764102459 | 0.3346560299396515 | 0.6653439402580261

我应该怎么办?


当年话下
浏览 120回答 1
1回答

HUX布斯

他们不是任何特殊的解决方案,您必须在这里尝试所有可能的情况。但是我告诉您最大宗师遵循的更一般的过程。def build_lrfn(lr_start=0.00001, lr_max=0.0008,&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lr_min=0.00001, lr_rampup_epochs=20,&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lr_sustain_epochs=0, lr_exp_decay=.8):&nbsp; &nbsp; lr_max = lr_max * strategy.num_replicas_in_sync&nbsp; &nbsp; def lrfn(epoch):&nbsp; &nbsp; &nbsp; &nbsp; if epoch < lr_rampup_epochs:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lr = (lr_max - lr_start) / lr_rampup_epochs * epoch + lr_start&nbsp; &nbsp; &nbsp; &nbsp; elif epoch < lr_rampup_epochs + lr_sustain_epochs:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lr = lr_max&nbsp; &nbsp; &nbsp; &nbsp; else:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lr = (lr_max - lr_min) * lr_exp_decay**(epoch - lr_rampup_epochs - lr_sustain_epochs) + lr_min&nbsp; &nbsp; &nbsp; &nbsp; return lr&nbsp; &nbsp; return lrfnlrfn = build_lrfn()lr_schedule = tf.keras.callbacks.LearningRateScheduler(lrfn, verbose=1)history = model.fit(&nbsp; &nbsp; train_dataset,&nbsp;&nbsp; &nbsp; epochs=EPOCHS,&nbsp;&nbsp; &nbsp; callbacks=[lr_schedule],&nbsp; &nbsp; steps_per_epoch=STEPS_PER_EPOCH,&nbsp; &nbsp; validation_data=valid_dataset)对于更多优化器,我总是关注这个链接在我看来,亚当最近最适合你的模型
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python