I have been doing this online course Introduction to TensorFlow for AI, ML and DL. Here in one part, they were showing a CNN model for classifying human and horses. In this model, the first Conv2D layer had 16 filters, followed by two more Conv2D layers with 32 and 64 filters respectively. I am not sure how the number of filters is correlated with the deeper convolution layers.

Declaration of the model


The higher the number of filters, the higher the number of abstractions that your Network is able to extract from image data. The reason why the number of filters is generally ascending is that at the input layer the Network receives raw pixel data. Raw data are always noisy, and this is especially true for image data.

Because of this, we let CNNs extract first some relevant information from noisy, "dirty" raw pixel data. Once the useful features have been extracted, then we make the CNN elaborate more complex abstractions on it.

That is why the number of filters usually increases as the Network gets deeper, even though it doesn't necessarily have to be like that.

  • $\begingroup$ Thank you so much for the clarification. :) $\endgroup$ – Sanjay Saha Jul 12 at 9:36

For this you need to understand what filters does actually.

In every layer filters are there to capture patterns. For example in the first layer filters capture patterns like edges, corners, dots etc. In the subsequent layers we combine those patterns to make bigger patterns. Like combine edges to make squares, circle etc.

Now as we move forward in the layers the patterns gets more complex, hence larger combinations of patterns to capture. That's why we increase filter size in the subsequent layers to capture as many combinations as possible.

  • 1
    $\begingroup$ Thank you so much for the clarification. :) $\endgroup$ – Sanjay Saha Jul 12 at 9:36
  • 1
    $\begingroup$ Good answer. Just a remark to be more exact, I would say "combinations" and not "permutations". $\endgroup$ – Ismael EL ATIFI Jul 13 at 18:08
  • 2
    $\begingroup$ Yes right. Thanks for pointing !! $\endgroup$ – ashukid Jul 14 at 5:51

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.