I wanted to retrain the fully connected layers of VGG 16 for big gray level images (1800x1800), using Keras with Then backend.
So I've:
- created a new VGG with a single color channel and loaded the weights from of the original VGG.
- add trainable=False to all the convolution layers (the pooling and padding are not trainable by definition)
- delete the two first dense layers to keep only the output layer with two neurons
- increase drastically the max pooling dimensions and strides because I work with inputs 1800x1800 (no choice). The dimensions drop very quickly to match the original VGG dimensions.
- reduce the batch size in order to reduce the memory required.
But when I start the training, I face a CNMEM_STATUS_OUT_OF_MEMORY error. I use NVIDIA K40, so I have 12Go of memory.
Any idea how to fix it?