0
$\begingroup$

Let's say I have 100 32x32x3 images. I have an input layer which would would have one 32x32x3 array as the input. I connect to a convolution layer with 16 filters, which gets convoled and then regularized and max pooled, resulting in 16 activation maps.

Let's say I connect to another convolution layer, convo 2. If I have 8 filters in conv2, would each filter connect with all 16 activation maps from the previous layer? That would result in 16x 8 activation maps in the next layer.

If not is there a way to do so in Keras?

$\endgroup$
1
$\begingroup$

The depth of your filter is generally going to be the number of activation maps from the previous layer. So your 8 filters in conv2 will be NxNx16 where N is the size of the filter you want to use.

The 2nd layer will produce 8 activation maps, one that corresponds to each filter. The number of activation maps is equal to the number of filters in that layer.
The first layer's filters have a depth of 3 because you can think of the original input image being 3 different activation maps (although they aren't actually "activations") - one for red, green, and blue. You could potentially have some 4th input channel, brightness at each pixel for example, and then your first layer filters would have a depth of 4.

$\endgroup$
  • $\begingroup$ I'm confused. Wouldn't the depth of each filter be only 3 dimensions? I'm more interested in how many activation maps the conv2 would create if I used 8 filters. Thanks. $\endgroup$ – moondra Jun 10 '17 at 2:15
  • $\begingroup$ I added some more information to my answer. I know most diagrams you can find don't really explain this part so well. Hope that helps $\endgroup$ – Frobot Jun 10 '17 at 3:11
  • $\begingroup$ I asked on quora as well and this is the response I got from someone who had a PHD in computer vision: 'Its because each convolutional filter is also three dimensional. In this case every filter is of size 32x32x3." I asked him to expand on this, but I'm assuming that each of the 12 activation maps end of having a depth of 3? $\endgroup$ – moondra Jun 10 '17 at 17:28
  • $\begingroup$ The filters are 3 dimensional, but the activation maps produced by them are not. Each individual map is 2D. After these 2D maps are produced you can think of them all stacked on top of each other as a 3D volume, and then your 3D filters in the next layer convolve with your entire set of maps, and each filter produces one new 2D activation map. It wouldn't make any sense for your filters to all have a depth of 3 (except the first layer) because then either your activation maps would have to be 3D or you would have to assign certain filters to certain maps. neither is the case though $\endgroup$ – Frobot Jun 10 '17 at 22:26
  • $\begingroup$ Actually there is a paper where they had filters with a depth that was less than the number of activation maps at the given layer and they chose certain maps to be convolved with certain filters. This is by no means the standard though $\endgroup$ – Frobot Jun 10 '17 at 22:31

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.