9
$\begingroup$

I'm trying to understand the receptive fields of CNN better. To do that I would like to calculate the receptive field of each neuron in LeNet. For a normal MLP it's rather easy (see http://deeplearning.net/tutorial/lenet.html#sparse-connectivity), but it's more difficult to calculate the receptive field of a neuron in a layer following one or more convolutional layers and pooling layers.

What is the receptive field of a neuron in the 2. convolutional layer? How much bigger is it in the following subsampling/pooling layer? And what is the formula for calculating these?

$\endgroup$
1
  • 1
    $\begingroup$ The related sidebar suggested this question, which is relevant to the kind of thing you're thinking about and interesting. $\endgroup$
    – Danica
    Mar 20, 2015 at 16:26

2 Answers 2

2
$\begingroup$

If you think about a convolutional net as an instance of a standard MLP, you can figure out the receptive fields in exactly the same way as the example you linked.

Recall that a convolutional layer is essentially a shorthand for a layer with many repeated patterns, as in this image (from this answer, originally from here):

visual example of convolution

Each of the "destination pixels" of that image corresponds to a neuron whose inputs are the blue square in the source image. Depending on your network architecture the convolutions may not exactly correspond to pixels like that, but it's the same idea. The weights used as inputs for all of those convolutional neurons are tied, but that's irrelevant to what you're thinking about here.

Pooling neurons can be thought of in the same way, combining the receptive fields of each of their inputs.

$\endgroup$
3
  • $\begingroup$ Nice visualization! Your example makes perfect sense. If I added a 2x2 pooling layer after the convolutional layer, then each neuron in the pooling layer would only have a receptive field of 4x4, despite mixing four 3x3 fields as the neurons in the convolutional layer overlap. I can easily get my head around this and create some simple formulas for the receptive field based on pooling size etc. However, it gets more complex for the following convolutional layer as the receptive field now also depends on the stride for the polling layer etc. What formula for RF takes this into account? $\endgroup$
    – pir
    Mar 21, 2015 at 12:41
  • 1
    $\begingroup$ so is the blue square in the source pixel the size of the receptive field? $\endgroup$ Jun 7, 2016 at 0:40
  • $\begingroup$ I have the same question, in the paper "Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks", it says in section 3.1, the receptive field of ZF and VGG16 is 171 and 228 but it doesn't add up from the network configuration. Hope somebody could clear this up for me. $\endgroup$
    – Chan Kim
    Jun 12, 2016 at 14:52
0
$\begingroup$

In Faster-rcnn, the effective receptive field can be calculated as follow (VGG16):

Img->
Conv1(3)->Conv1(3)->Pool1(2) ==>
Conv2(3)->Conv2(3)->Pool2(2) ==>
Conv3(3)->Conv3(3)->Conv3(3)->Pool3(2) ==>
Conv4(3)->Conv4(3)->Conv4(3)->Pool4(2) ==>
Conv5(3)->Conv5(3)->Conv5(3) ====>
a 3 * 3 window in feature map.
Lets take one dimension for simplicity. If we derive back from size 3, the original receptive field:
1). in the beginning of Conv5: 3 + 2 + 2 + 2 = 9
2). in the beginning of Conv4: 9 * 2 + 2 + 2 + 2 = 24
3). in the beginning of Conv3: 24 * 2 + 2 + 2 + 2 = 54
4). in the beginning of Conv2: 54 * 2 + 2 + 2 = 112
5). in the beginning of Conv1 (original input): 112 * 2 + 2 + 2 = 228

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.