# Does not using more filters in deeper CNN creates more images?

For example, we have applied 32 filters to a single image. Then it created 32 different images (stack of convolutional values).

And in the second layer, if we apply 64 filters, are all these filters going to be applied on all those 32 images? If so, then it will create 64*32 numbers of output or I am understanding wrong?

I have become confused because when I studied keras documentation, it says that using 64 filters it will create 64 outputs. If anybody enlights me on how the second or deeper layer works in CNN briefly it will be helpful for me.

• @noe has correctly answered. Also, read the CS231 on CNN. Link Commented Apr 22, 2021 at 11:45

No, your understanding is not correct.

Each of the 64 filters of the second layer will be applied to each of the 32 channels from the output of the first layer, resulting in 64 channels in the output of the second layer.

When the input of a convolutional layer has multiple channels, the convolution filter itself has the same number of channels. In your example, if we are using $$3\times3$$ filters, each filter in the second layer will be a tensor of dimensions $$3\times3\times32$$. Therefore, the filter "covers" the full depth of the input. Then, you simply perform the element-wise multiplication of the filter with the overlapping region in the input and add all the resulting elements together. Applying just 1 filter, we obtain a result with 1 channel.

This way, the number of channels of the output of a convolutional layer is the same as the number of filters in the convolution.

• so I understood as: after 1st layer, the input is 128X128X32(128 is arbitrary). then if there are 64 filters, then each of them will be 3X3X32. Each filter will be applied and their individual outputs will be added to make one single channel. And, 64 filters will create total of 64 channels. So the output will be 126X126X64. I hope my understanding is correct now.
– EMT
Commented May 1, 2021 at 22:41
• Yes, that is correct.
– noe
Commented May 1, 2021 at 22:44