I've tried to implement a CNN from scratch in Java. I am not using any external libraries which make things harder.
My CNN has the following structure: Input -> [ConvLayer, Pool, ReLU, FullyConnected] -> Output
These layers can be added behind each other in nearly any order. Every Layer works except the ConvLayer. The forward pass is fine but I am stuck with the backward pass of the error and the update of the weights.
I know that it is some kind of backward convolution with reversed kernels or something like this but I just can't get this to work and it would be great if someone could briefly explain what values have to be multiplied with what values :)
My attempt can be found here: CNN Convolution Layer - Backpropagation problems
I am happy for any kind of help.
Greetings, Finn
When we do backward passing for a specific layer, we need
The fact is weights updating in convolutional layer is very similar with things you do in fully connected layer. If you have your loss L calculated in fully connected layer, then you can calculate the loss of convolutional layer by partial of L with respect to y, where y is the output of the convolutional layer in your case. Then gradients computing will be the same as you do for fully connected layer.
If you like some description more mathematical, please refer to Backpropagation.
Hope this will help you.