我有一个60000张图像的数据集,我将它们分成训练和验证集(80/20),并且我使用ImageDataGenerator
从磁盘上以32个大小的批次获取图像。我正在处理多个具有6000个类别(标签)的标签分类任务。为了解决此问题,我使用Keras使用以下CNN:
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv2d_27 (Conv2D) (None, 256, 256, 64) 1792
_________________________________________________________________
max_pooling2d_27 (MaxPooling (None, 128, 128, 64) 0
_________________________________________________________________
conv2d_28 (Conv2D) (None, 128, 128, 128) 73856
_________________________________________________________________
max_pooling2d_28 (MaxPooling (None, 64, 64, 128) 0
_________________________________________________________________
conv2d_29 (Conv2D) (None, 64, 64, 128) 147584
_________________________________________________________________
max_pooling2d_29 (MaxPooling (None, 32, 32, 128) 0
_________________________________________________________________
flatten_10 (Flatten) (None, 131072) 0
_________________________________________________________________
dense_20 (Dense) (None, 512) 67109376
_________________________________________________________________
dense_21 (Dense) (None, 5216) 2675808
=================================================================
Total params: 70,008,416
Trainable params: 70,008,416
Non-trainable params: 0
_________________________________________________________________
我正在使用fit_generator
训练模型和steps_per_epoch = total_training_samples/batch_size
。但是,它花费了太长时间(超过一周)来训练10个时代,这是一个非常简单的模型。我试图通过减少层和神经元的数量来使体系结构更加简单,但是训练时间也太多了,结果很糟糕。我知道最后一个决策层(具有5216个神经元)负责大量参数。我还能改变什么以使模型更易于训练?