1
$\begingroup$

I have been going through a CNN tutorial and noticed that depth of a convolutional layer is equal to the number of filters. But, shouldn't the depth be the number of colors in the image? I mean, if it's RGB then, depth is 3 right? Am I missing something here?

$\endgroup$
1
$\begingroup$

Yes, the depth of an image is equal to the color channels (1 for gray-scale images, 3 for RGB).

However, that is only the case for the input layer of the CNN. During the first convolution layer, the image can be passed through as many filters as we select. This number becomes the depth of the first layer. The subsequent layers can have any depth we want.

For example in the CNN depicted below:

The image input to the CNN initially has a depth of 1 (because it is gray-scale). The first convolutional layer passes it through 6 filters, so the depth of the first layer becomes 6. The second layer passes the output of the first through 16 filters, meaning that the second layer has a depth of 16, etc.

$\endgroup$
1
  • $\begingroup$ so, input depth is colorspace size, and further from there its always number of filters. Thank you very much $\endgroup$
    – InAFlash
    Aug 3 '18 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.