0

我的模型是

Using TensorFlow backend.
Found 8704 images belonging to 68 classes.
Found 2176 images belonging to 68 classes.
Found 1360 images belonging to 68 classes.

_________________________________________________________________
None
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
vgg16 (Model)                (None, 4, 4, 512)         14714688  
_________________________________________________________________
flatten_1 (Flatten)          (None, 8192)              0         
_________________________________________________________________
dense_1 (Dense)              (None, 256)               2097408   
_________________________________________________________________
dropout_1 (Dropout)          (None, 256)               0         
_________________________________________________________________
dense_2 (Dense)              (None, 68)                17476     
=================================================================
Total params: 16,829,572
Trainable params: 3,850,372
Non-trainable params: 12,979,200
_________________________________________________________________

每张图像为 128*128*3。我的笔记本电脑上有 8 个 CPU,CPU 使用率约为 700%。为什么运行一个 epoch 大约需要 1 小时?如何提高性能?谢谢

更新

以下是我的模型的详细信息:

vgg16 = VGG16(include_top=False,
              weights='imagenet',
              input_tensor=None,
              input_shape=(IMG_SIZE, IMG_SIZE, CHANNELS),
              pooling=None,
              classes=68)


for layer in vgg16.layers[-8:-1]:
    layer.trainable = False

model = Sequential()

model.add(vgg16)
model.add(Flatten())
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(68, activation='softmax'))


print(model.summary())
4

0 回答 0