# Convolutional Neural Network: learning capacity and image coverage

I was looking through a CNN tutorial and towards the end they refer to learning capacity and image coverage during network learning diagnostics

What do those 2 terms mean in the context of a convolutional neural network?

## 1 Answer

You can look at nolearn/lasagne/util.py to see how learning capacity and image coverage are computed for each layer:

real_filters = get_real_filter(layers, img_size)
receptive_fields = get_receptive_field(layers, img_size)
capacity = 100. * real_filters / receptive_fields
capacity[np.logical_not(np.isfinite(capacity))] = 1
img_coverage = 100. * receptive_fields / img_size


Xudong Cao. "A practical theory for designing very deep convolutional neural networks". 2015. https://www.kaggle.com/c/datasciencebowl/forums/t/13166/happy-lantern-festival-report-and-code explains how to compute the capacity of a layer:

To quantitatively measure the learning capacity of a convolutional layer we define the c-value of a convolutional layer as follows.

c-value = Real Filter Size / Receptive Field Size

where the real filter size of a k-by-k convolutional layer is k if there is no down sampling, it doubles after each down sampling i.e. 2k after one down sampling and 4k after two down sampling etc. The receptive field size is defined as the maximum size of a neuron can see on the raw image. It grows proportionally as the convolutional neural network goes deep. Figure 3 shows how the receptive fields grows in an exemplar convolutional neural network.

This is why the coverage increases as you go deeper in the network, e.g.:

# Neural Network with 122154 learnable parameters

## Layer information

name        size        total    cap.Y    cap.X    cov.Y    cov.X
----------  --------  -------  -------  -------  -------  -------
input0      1x28x28       784   100.00   100.00   100.00   100.00
conv2d1     32x26x26    21632   100.00   100.00    10.71    10.71
maxpool2d2  32x13x13     5408   100.00   100.00    10.71    10.71
conv2d3     64x11x11     7744    85.71    85.71    25.00    25.00
conv2d4     64x9x9       5184    54.55    54.55    39.29    39.29
maxpool2d5  64x4x4       1024    54.55    54.55    39.29    39.29
conv2d6     96x2x2        384    63.16    63.16    67.86    67.86
maxpool2d7  96x1x1         96    63.16    63.16    67.86    67.86
dense8      64             64   100.00   100.00   100.00   100.00
dropout9    64             64   100.00   100.00   100.00   100.00
dense10     64             64   100.00   100.00   100.00   100.00
dense11     10             10   100.00   100.00   100.00   100.00

Explanation
X, Y:    image dimensions
cap.:    learning capacity
cov.:    coverage of image
magenta: capacity too low (<1/6)
cyan:    image coverage too high (>100%)
red:     capacity too low and coverage too high