使用keras在自定义CNN上转移学习

时间:2020-07-06 20:20:27

标签: tensorflow keras cnn transfer-learning

我使用以下结构构建了自定义CNN:

arCNN.summary()

conv2d_141 (Conv2D)          (None, 16, 16, 256)       590080    
_________________________________________________________________
batch_normalization_150 (Bat (None, 16, 16, 256)       1024      
_________________________________________________________________
conv2d_142 (Conv2D)          (None, 14, 14, 256)       590080    
_________________________________________________________________
batch_normalization_151 (Bat (None, 14, 14, 256)       1024      
_________________________________________________________________
conv2d_143 (Conv2D)          (None, 12, 12, 256)       590080    
_________________________________________________________________
batch_normalization_152 (Bat (None, 12, 12, 256)       1024      
_________________________________________________________________
conv2d_144 (Conv2D)          (None, 6, 6, 256)         1638656   
_________________________________________________________________
dropout_37 (Dropout)         (None, 6, 6, 256)         0         
_________________________________________________________________
conv2d_145 (Conv2D)          (None, 6, 6, 512)         1180160   
_________________________________________________________________
batch_normalization_153 (Bat (None, 6, 6, 512)         2048      
_________________________________________________________________
conv2d_146 (Conv2D)          (None, 6, 6, 512)         2359808   
_________________________________________________________________
batch_normalization_154 (Bat (None, 6, 6, 512)         2048      
_________________________________________________________________
conv2d_147 (Conv2D)          (None, 4, 4, 512)         2359808   
_________________________________________________________________
batch_normalization_155 (Bat (None, 4, 4, 512)         2048      
_________________________________________________________________
conv2d_148 (Conv2D)          (None, 2, 2, 512)         2359808   
_________________________________________________________________
batch_normalization_156 (Bat (None, 2, 2, 512)         2048      
_________________________________________________________________
conv2d_149 (Conv2D)          (None, 1, 1, 512)         6554112   
_________________________________________________________________
dropout_38 (Dropout)         (None, 1, 1, 512)         0         
_________________________________________________________________
flatten_9 (Flatten)          (None, 512)               0         
_________________________________________________________________
dense_36 (Dense)             (None, 512)               262656    
_________________________________________________________________
batch_normalization_157 (Bat (None, 512)               2048      
_________________________________________________________________
dense_37 (Dense)             (None, 512)               262656    
_________________________________________________________________
batch_normalization_158 (Bat (None, 512)               2048      
_________________________________________________________________
dense_38 (Dense)             (None, 512)               262656    
_________________________________________________________________
batch_normalization_159 (Bat (None, 512)               2048      
_________________________________________________________________
dropout_39 (Dropout)         (None, 512)               0         
_________________________________________________________________
dense_39 (Dense)             (None, 20)                10260     
=================================================================
Total params: 19,344,660
Trainable params: 0
Non-trainable params: 19,344,660
_________________________________________________________________

我想通过保留此模型的卷积层并利用新的头来训练新数据来利用转移学习。

我该如何实现? (我在网上看到了很多关于重新训练标准CNN的资料,但是我正在努力删除我所没有的自定义标题,而该自定义标题没有参数include_top = False)

0 个答案:

没有答案