1
votes

I have a question regarding interconnection between two convolutional layers in CNN. for example suppose I have architecture like this:

input: 28 x 28

conv1: 3 x 3 filter, no. of filters : 16

conv2: 3 x 3 filter, no. of filters : 32

after conv1 we get output as 16 x 28 x 28 assuming dimension of image is not reduced. So we have 16 feature maps. In the next layer each feature map is connected to next layer means if we consider each feature map(28 x 28) as a neuron then each neuron will be connected to all 32 filters means total (3 x 3 x 16) x 32 parameters. How these two layers are stacked or interconnected? In the case of Artificial Neural Network we have weights between two layers. Is there something like this in CNN also? How the output of one convolutional layer is fed to the next convolutional layer?

1

1 Answers

0
votes

The number of parameters of a convolutional layer with n filters of size k×k which comes after f feature maps is

n ⋅ (f ⋅ k ⋅ k + 1)

where the +1 comes from the bias.

Hence each of the f filters is not of shape k×k×1 but of shape k×k×f.

How the output of one convolutional layer is fed to the next convolutional layer?

Just like the input is fed to the first convolutional layer. There is no difference (except the number of feature maps).

Convolution on one input feature map

Image source: https://github.com/vdumoulin/conv_arithmetic

See also: another animation

Multiple input feature maps

It works the same:

  • The filter has the same depth as the input. Before it was 1, now it is more.
  • You still slide the filter over all (x, y) positions. For each position, it gives one output.

Your example

  • First conv layer: 160 = 16*(3*3+1)
  • Second conv layer: 4640 = 32*(16*3*3+1)