As I went through the basics of machine learning, I failed to understand how do the Convolutional layers in a CNN learn the convolution kernels. After looking at first few tutorials, I thought the kernels were fixed: for example, there was a 2D kernel which extracts vertical lines, another one extracted horizontal lines etc. Later on I realized that kernels are learned by the network and not fixed.
Is there a good explanation on how the learning goes, how does the backpropagation work (compared to fully connected layers), what is the optimization function, etc.?
p.s. Let this be an example function to explain: https://keras.io/layers/convolutional/.