This is a major confusion for me - I've always thought filters (those small sliding windows size 3x3 or 5x5) are strictly 2D, this among other is specified in Caffe API:

kernel_size / kernel_h / kernel_w. The filter dimensions, given by kernel_size for square filters or kernel_h and kernel_w for rectangular filters

Now, I've never been 100% clear on what these convolutions mean (taken from Matt Zeiler's article (Visualizing and Understanding Convolutional Networks) and how they were obtained: enter image description here

After searching it turned out that filters can be 3D?? How does it work then? I found a bit of information on CS 231n course, but it's not explained in detail anywhere.


1 Answer 1


The diagram below Example 2 in this CS231 lecture is a good visualization of how filters work: http://cs231n.github.io/convolutional-networks/. Since each layer of a ConvNet has a depth corresponding to the number of filters (in an input RGB image, for example, the depth of the input layer would be 3), each filter of size $k\times k$ applied to a layer of delth $d$ slides over a volume of $k\times k\times d$ (note that the filter stays at a constant depth).

  • $\begingroup$ but doesn't this mean that for a layer size nxnx3 we will have 3 different filters kxk each? $\endgroup$
    – Alex
    Commented Mar 30, 2017 at 14:27
  • $\begingroup$ The number of filters is the depth $d'$ of your output layer, while the depth of each of those filters is the depth $d$ of your input layer $\endgroup$
    – liangjy
    Commented Mar 30, 2017 at 15:30
  • $\begingroup$ but then why doesn't caffe implement them (here's from API): see the excerpt from the API $\endgroup$
    – Alex
    Commented Mar 31, 2017 at 11:33

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.