I came across this nice article which gives an intuitive explanation of how convnets work.
Now trying to understand what is going on exactly inside a caffe conv layer:
With input data of shape 1 x 13 x 19 x 19, and 128 filters conv layer:
layers {
name: "conv1_7x7_128"
type: CONVOLUTION
blobs_lr: 1.
blobs_lr: 2.
bottom: "data"
top: "conv2"
convolution_param {
num_output: 128
kernel_size: 7
pad: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
Layer output shape is 1 x 128 x 19 x 19 if i understand correctly.
Looking at the layer's weights' shapes in net->layers()[1]->blobs()
:
layer 1: type Convolution 'conv1_7x7_128'
blob 0: 128 13 7 7
blob 1: 128
Looks like blob 0 has all the weigths: one 7x7 matrix per plane (13) per filter (128).
Doing convolutions with blob 0 on 1 x 13 x 19 x 19 data, if i understand correctly we end up with 128 x 13 x 19 x 19 output (there's padding so each 7x7 matrix produces one number for each pixel)
How does 128 x 13 x 19 x 19 turn into layer's 1 x 128 x 19 x 19 output ?
What are the 128 weights in blob 1 ?
Bonus question: what is blobs_lr
?