When I build a convolution layer for image processing, the filter parameters should have 3 dimensions, (filter_length, filter_width, color_depth) is that correct?

Why is this convolution layer called Conv2D? Where does the 2 come from?


1 Answer 1


A 2D convolution is a convolution where the kernel has the same depth as the input, so, in theory, you do not need to specify the depth of the kernel, if you know the depth of the input.

I don't know which library you are referring to (although you tagged your post with TensorFlow and Keras), but, in TensorFlow, you only need to specify the width and height of the kernel in the Conv2D class, given that the depth is automatically calculated from the depth of the input.

Thus, the $2$ comes from the fact that you slide across two dimensions (i.e. width and height).

On the other hand, in a 3D convolution, the depth of the kernel does not necessarily have the same depth of the input, so, in that case, you also slide across the depth. In TensorFlow, you need to specify the width, height and depth of the Conv3D class.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .