I am looking at a diagram of ZFNet in an attempt to understand how CNNs are designed effectively. I'm working with the CIFAR10 set in pytorch.

In the first layer, I understand the depth of 3 (224x224x3) is the number of color channels in the image.

In the second layer I understand the 110x110 is is (224 - ( 7 * 2)) / 2

I also understand how pooling works to create a size reduction.

But where does the depth of 96 come from in the second layer? Is this the new "batch size"? Is it totally arbitrary? Bonus points if someone can direct me to a reference that can help me understand how all these dimensions relate to each other.


The 96 is the amount of filter maps (also: filter kernels). It is a fundamental of convolutional neural networks. The exact number is not arbritary, although there is no equation or exact rule of restricting the number.

If you have a CNN one single convolution operation would be pointless: since it used for the whole image information it can generalize, but only to specific (meaning: finite amount of) features. Easy example: if a 7x7 filter in the first layer concentrates on round shapes, it can not generalize on let's say red cubes at the same time.

Therefore you convolutional layers have several filter kernels, i.e. several weights where each is used for a convolution. The result of each of these convolutions is one filter map, i.e. the image information convolved by a kernel.

Typically you look at your filter kernels and your problem's domain to figure out what an appropriate number of filter kernels could be. You also have to keep in mind that too few kernels could possibly lose information and overfit to specific patterns, while too many kernels could possibly underfit. Especially when you have far more parameters (primarily the weights of your network) than training data your network will normally perform bad and you have to reduce its size.

The filter kernels should not be confused with batch size. The batch size is the amount of samples (here: images) you train in parallel. Each training step of your network does not only consist of feeding a single image, but feeding batch size number of images, usually combined with batch normalization steps between the layers. Hence, this has nothing to do the amount of filter kernels / convolutions of your network.

  • 1
    $\begingroup$ This is great, I understand now. Using the terminology in your post, I had a search and found: adeshpande3.github.io/adeshpande3.github.io/… which made it clear what the purpose of each filter kernel was. Thanks! $\endgroup$
    – OnNIX
    May 9 '17 at 0:04

In simple terms, it can explain as below,

Let's say you have 10 filters where each filter is the size of 5x5x3. What does this mean? the depth of this layer is 10 which is equal to the number of filters. Size of each filter can be defined as we want e.g., 5x5x3 in this case where 3 is the depth of the previous layer. To be precise, depth of each filer in the next layer should be 10 ( nxnx10) where n can be defined as you want like 5 or something else. Hope will make everything clear.


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.