# Output dimension of convolutional layer - where did color dimension go?

I'm working with a Convolutional Neural Network in Matlab, and I'm struggling to understand the output dimensionality of a convolutional layer.

The input is an image: 227 x 227 x 3 (last dimension is rgb). Filter size is 11 x 11, and there are 96 filters. Vertical and horizontal stride is 4. There is no padding.

I tried calculating the output dimensionality as follows:

output_width = (Width - FilterWidth + 2*Padding)/StrideHorizontal = (227 - 11 + 0)/4 = 55.

Now, I expected an output of 55 x 55 x 3 x 96, as there are 96 filters, but I get 55 x 55 x 96. What I don't understand is, what happened to the color dimension?

## 1 Answer

The filter dimension replaces the channels in the convolutional layer: $$3$$ becomes $$96$$ it isn't lost.

Each one of the pixels 96 in a specific location are computed as the weighted average of the $$11\times11\times3$$ pixels in the same region of the image.

For more details on how exactly the convolution operation is computed I'd suggest reading this. It has numerical examples later on to see exactly what's computed.

• Oooh, it's a weighted average. Thank you! Commented Aug 24, 2019 at 12:21