So if I have $3$ RGB channels, $6$ convolutional layers and $4$ kernels, does this mean that each kernel does a convolution on each channel and so the input for the next convolution will be $3 \times 4=12$ channels? Or those outputs are just stacked on each other (summed) and the input to the next neural network is still 3 channels?

Edit: I am pretty sure that the input for the next convolution would still be $3$, but why is that? What is the operation performed?


1 Answer 1


Check this video. Color channels in a CNN are only involved in the first layer, where the original image is given as the input. Let us assume we are taking a 3x3 filter. This actually means we have 3 3x3 filters for each color channels. Each filter is applied to its corresponding color channel: Red filter is applied to Red channel, Blue filter to Blue channel etc.., and at the end you simply add the result for each filter, for each pixel.

Assuming you use a padding that preserves the original size of the image, the output for these filters will be the same size as the original image, where each pixel is calculated by adding up the result of the filter. Of course we never use a single filter. The number of filters you use will determine the dimension of the output.

For example, check this model summary from TensorFlow documentation, and compare it to the model above. The last parameter in parentheses represents the number of filters, while the last parameter in the first row is the number color channels in the given image.


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.