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/.


2 Answers 2


Sometimes the kernel function is very difficult to choose in a fixed form even if once found it would be easier. It can be learned to map the data in a features space (Hilbert space) through an Convex Optimisation method such as Semidefinite programming, using Hyperkernels, etc.

Some very usefull papers for your question can be found here:

Learning the Kernel via Convex Optimisation

Learning the Kernel Matrix with Semidefinite Programming

Learning the Kernel with Hyperkernels

Learning the Kernel Function via Regularization

I hope that answers your question


Surprisingly, convolutional kernels are learned through plain backpropagation. The model propagates the error to kernel parameters just as it does with more canonical dense parameters, and trains them accordingly.

The kernels are not fixed, it is known that learned filters are much more powerful than fixed a priori ones.

This is one of the cases in which the visualization of it is actually more complex than the math behind (IMHO).

If you are looking for detailed explanations, this article is a very good explanation of all the details of convolution, then I found this one and this one that how backprop works more specifically. They are a bit more technical though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.