1
votes

when i tried to add dropout to the keras model it cause OOM error: tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[128,128,176,216]...

the model suppose to be autoencoder that produce super resolution x4.

autoencoder = Sequential()
autoencoder.add(Conv2D(64*comlex, (3, 3), activation='relu', 
padding='same', input_shape=x_train[0].shape))
autoencoder.add(Dropout(0.25))
autoencoder.add(UpSampling2D((2, 2)))
autoencoder.add(Conv2D(64*comlex, (3, 3), activation='relu', padding='same'))
# autoencoder.add(Dropout(0.25))
autoencoder.add(UpSampling2D((2, 2)))
autoencoder.add(Conv2D(3, (3, 3), activation='sigmoid', padding='same'))
autoencoder.compile(optimizer='adam', loss='binary_crossentropy',metrics=['accuracy'])

the line in comment causes OOM.

why does dropout take so much memory?

1
It doesn't, its probably just that your feature maps are really big (as seen in the error msg) and you don't have enough RAM for it. Try reducing the batch size.Dr. Snoopy

1 Answers

-1
votes

Update:

Tensorflow/Keras OOM(Out of memory) error occures because of the excess amount of model parameters e.g. image size/feature number etc. with high batch size value, which can cause higher GPU memory consumption. Sometimes these can associate with residual memory from previous processes as well.