0
我一直試圖讓一個帶有Tensorflow後端的VGG16 Keras模型工作,以便對Kaggle上的'Planet: Understanding the Amazon from Space競賽進行分類。不幸的是,當試圖讓模型運行時,我一直遇到內存問題,即使在AWS的g.2.8大小的內存上運行時也有60 GB的內存。Tensorflow上的VGG16存儲器問題
問題的回溯如下:
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) (None, 224, 224, 3) 0
_________________________________________________________________
block1_conv1 (Conv2D) (None, 224, 224, 64) 1792
_________________________________________________________________
block1_conv2 (Conv2D) (None, 224, 224, 64) 36928
_________________________________________________________________
block1_pool (MaxPooling2D) (None, 112, 112, 64) 0
_________________________________________________________________
block2_conv1 (Conv2D) (None, 112, 112, 128) 73856
_________________________________________________________________
block2_conv2 (Conv2D) (None, 112, 112, 128) 147584
_________________________________________________________________
block2_pool (MaxPooling2D) (None, 56, 56, 128) 0
_________________________________________________________________
block3_conv1 (Conv2D) (None, 56, 56, 256) 295168
_________________________________________________________________
block3_conv2 (Conv2D) (None, 56, 56, 256) 590080
_________________________________________________________________
block3_conv3 (Conv2D) (None, 56, 56, 256) 590080
_________________________________________________________________
block3_pool (MaxPooling2D) (None, 28, 28, 256) 0
_________________________________________________________________
block4_conv1 (Conv2D) (None, 28, 28, 512) 1180160
_________________________________________________________________
block4_conv2 (Conv2D) (None, 28, 28, 512) 2359808
_________________________________________________________________
block4_conv3 (Conv2D) (None, 28, 28, 512) 2359808
_________________________________________________________________
block4_pool (MaxPooling2D) (None, 14, 14, 512) 0
_________________________________________________________________
block5_conv1 (Conv2D) (None, 14, 14, 512) 2359808
_________________________________________________________________
block5_conv2 (Conv2D) (None, 14, 14, 512) 2359808
_________________________________________________________________
block5_conv3 (Conv2D) (None, 14, 14, 512) 2359808
_________________________________________________________________
block5_pool (MaxPooling2D) (None, 7, 7, 512) 0
_________________________________________________________________
sequential_1 (Sequential) (None, 1) 6423041
=================================================================
Total params: 21,137,729.0
Trainable params: 21,137,729.0
Non-trainable params: 0.0
_________________________________________________________________
Traceback (most recent call last):
File "VGG16_Kg_Kernel.py", line 160, in <module>
train_datagen.fit(x_train)
File "/home/ec2-user/src/anaconda3/lib/python3.5/site-packages/keras/preprocessing/image.py", line 648, in fit
x = np.copy(x)
File "/home/ec2-user/src/anaconda3/lib/python3.5/site-packages/numpy/lib/function_base.py", line 1497, in copy
return array(a, order=order, copy=True)
MemoryError
整個打印輸出可以在這裏找到:https://github.com/j-v-k/VGG16/blob/master/error_text.txt
從打印出來,在GPU似乎運行,但可能無法運行完美。
該數據包含〜100K 11.6 KB圖像。我用來運行模型的代碼可以在這裏找到:https://github.com/j-v-k/VGG16/blob/master/VGG16_Kg_Kernel.py
請讓我知道是否需要更多信息。謝謝!
謝謝,生病給我一個嘗試 – jvk777