有没有办法改善val_acc?

时间:2019-11-29 14:24:45

标签: python-3.x tensorflow keras conv-neural-network talos

上下文:

我正在尝试在kaggle cell dataset上希望达到0.95 val_acc的图像分类器上进行训练。我已经尝试了许多模型架构和历元数,以及其他几个超参数,得出了一个有希望的集合,其结果为0.9 val_acc。

我尝试过的事情

  • 混洗的图像标签对在一起,因此正确的标签与图像保持在一起
  • 对图像进行归一化,因此每个像素在0到1之间
  • 添加了BatchNormalization()Dropout(),以减少过度拟合(现在模型正在拟合不足)
  • permutations of hyperparameters tried

问题:

在0.9处给出最佳val_acc静止板的超参数集。我尝试了许多排列,有什么遗漏/做错了吗?

型号:

Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d (Conv2D)              (None, 120, 160, 8)       224       
_________________________________________________________________
batch_normalization (BatchNo (None, 120, 160, 8)       32        
_________________________________________________________________
activation (Activation)      (None, 120, 160, 8)       0         
_________________________________________________________________
dropout (Dropout)            (None, 120, 160, 8)       0         
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 60, 80, 8)         584       
_________________________________________________________________
batch_normalization_1 (Batch (None, 60, 80, 8)         32        
_________________________________________________________________
activation_1 (Activation)    (None, 60, 80, 8)         0         
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 60, 80, 8)         584       
_________________________________________________________________
batch_normalization_2 (Batch (None, 60, 80, 8)         32        
_________________________________________________________________
activation_2 (Activation)    (None, 60, 80, 8)         0         
_________________________________________________________________
dropout_1 (Dropout)          (None, 60, 80, 8)         0         
_________________________________________________________________
conv2d_3 (Conv2D)            (None, 30, 40, 8)         584       
_________________________________________________________________
batch_normalization_3 (Batch (None, 30, 40, 8)         32        
_________________________________________________________________
activation_3 (Activation)    (None, 30, 40, 8)         0         
_________________________________________________________________
conv2d_4 (Conv2D)            (None, 30, 40, 8)         584       
_________________________________________________________________
batch_normalization_4 (Batch (None, 30, 40, 8)         32        
_________________________________________________________________
activation_4 (Activation)    (None, 30, 40, 8)         0         
_________________________________________________________________
dropout_2 (Dropout)          (None, 30, 40, 8)         0         
_________________________________________________________________
conv2d_5 (Conv2D)            (None, 15, 20, 8)         584       
_________________________________________________________________
batch_normalization_5 (Batch (None, 15, 20, 8)         32        
_________________________________________________________________
activation_5 (Activation)    (None, 15, 20, 8)         0         
_________________________________________________________________
conv2d_6 (Conv2D)            (None, 15, 20, 16)        3216      
_________________________________________________________________
batch_normalization_6 (Batch (None, 15, 20, 16)        64        
_________________________________________________________________
activation_6 (Activation)    (None, 15, 20, 16)        0         
_________________________________________________________________
dropout_3 (Dropout)          (None, 15, 20, 16)        0         
_________________________________________________________________
conv2d_7 (Conv2D)            (None, 8, 10, 16)         6416      
_________________________________________________________________
batch_normalization_7 (Batch (None, 8, 10, 16)         64        
_________________________________________________________________
activation_7 (Activation)    (None, 8, 10, 16)         0         
_________________________________________________________________
conv2d_8 (Conv2D)            (None, 8, 10, 16)         6416      
_________________________________________________________________
batch_normalization_8 (Batch (None, 8, 10, 16)         64        
_________________________________________________________________
activation_8 (Activation)    (None, 8, 10, 16)         0         
_________________________________________________________________
dropout_4 (Dropout)          (None, 8, 10, 16)         0         
_________________________________________________________________
conv2d_9 (Conv2D)            (None, 4, 5, 16)          6416      
_________________________________________________________________
batch_normalization_9 (Batch (None, 4, 5, 16)          64        
_________________________________________________________________
activation_9 (Activation)    (None, 4, 5, 16)          0         
_________________________________________________________________
flatten (Flatten)            (None, 320)               0         
_________________________________________________________________
dense (Dense)                (None, 240)               77040     
_________________________________________________________________
batch_normalization_10 (Batc (None, 240)               960       
_________________________________________________________________
dropout_5 (Dropout)          (None, 240)               0         
_________________________________________________________________
dense_1 (Dense)              (None, 162)               39042     
_________________________________________________________________
batch_normalization_11 (Batc (None, 162)               648       
_________________________________________________________________
dropout_6 (Dropout)          (None, 162)               0         
_________________________________________________________________
dense_2 (Dense)              (None, 84)                13692     
_________________________________________________________________
batch_normalization_12 (Batc (None, 84)                336       
_________________________________________________________________
dropout_7 (Dropout)          (None, 84)                0         
_________________________________________________________________
dense_3 (Dense)              (None, 4)                 340       
=================================================================
Total params: 158,114
Trainable params: 156,918
Non-trainable params: 1,196

visualization of activations and val_acc, val_loss

注意:

使用here找到的talos完成了优化。我编辑并添加了一些模块here


编辑1:

我使用的优化器是Nadam,学习率是0.0002。 Full notebook

TLDR:

kaggle cell dataset上进行了训练,使用了尝试运行大约200种不同超参数的最佳超参数。高原0.9。为什么不更高?

full notebook

1 个答案:

答案 0 :(得分:0)

根据我的发现,我使用的学习率太低。增加它似乎有帮助。