5
$\begingroup$

I am self-studying CNNs, and have noticed that in many implementations the number of feature maps / filters increase as we get deeper in the network (closer to the output layer). What is the intuition / reason for this? How does this help learning? (example from a typical CNN below, with an increase from 32 to 64 to 128)

net2 = NeuralNet(
    layers=[
        ('input', layers.InputLayer),
        ('conv1', layers.Conv2DLayer),
        ('pool1', layers.MaxPool2DLayer),
        ('conv2', layers.Conv2DLayer),
        ('pool2', layers.MaxPool2DLayer),
        ('conv3', layers.Conv2DLayer),
        ('pool3', layers.MaxPool2DLayer),
        ('hidden4', layers.DenseLayer),
        ('hidden5', layers.DenseLayer),
        ('output', layers.DenseLayer),
        ],
    input_shape=(None, 1, 96, 96),
    conv1_num_filters=32, conv1_filter_size=(3, 3), pool1_pool_size=(2, 2),
    conv2_num_filters=64, conv2_filter_size=(2, 2), pool2_pool_size=(2, 2),
    conv3_num_filters=128, conv3_filter_size=(2, 2), pool3_pool_size=(2, 2),
    hidden4_num_units=500, hidden5_num_units=500,
    output_num_units=30, output_nonlinearity=None,

    update_learning_rate=0.01,
    update_momentum=0.9,

    regression=True,
    max_epochs=1000,
    verbose=1,
    )
$\endgroup$
1
  • $\begingroup$ The code looks pretty clean. What library is this? $\endgroup$
    – attomos
    Commented Aug 31, 2018 at 4:41

1 Answer 1

7
$\begingroup$

Here is an example of what a convolutional network might be looking for, layer by layer.

Layer 1: simple edges at various orientations

Layer 2: combinations of simple edges that form more complex edges and textures such as rounded edges or multiple edges touching

Layer 3: combinations of complex edges that form parts of objects, such as circles or grid like patterns

Layer 4: combinations of object parts that form whole objects, such as faces, cars, or trees

Each layer has a much wider scope of different things it can look for. The first layer doesn't have a wide variety of things to look for because it is so general. There are vertical edges, horizontal edges, diagonal edges, and some angles in between. But the final layer has a huge variety of things it could be looking for, so a larger number of filters is beneficial.

This image may also make it clearer. A technique is used to visualize the learned filters of the first, 2nd, and 3rd layers. enter image description here

$\endgroup$

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.