# Which convolution should I use? Conv2d or Conv1d

I've dataset which contains dlib landmark points of the faces. I'm using keras to train a model.

The dataset shape is (length_of_dataset,68,2). I know that I've two options.

• The first is using conv1d with input_shape = (68,2).
• The second is using conv2d with input_shape = (1,68,2).

My question is which one is better?and why?

• What do you intend to do with your model ? What is the purpose of your training ? – ma3oun May 31 '18 at 14:37

When using Conv2D , the input_shape does not have to be (1,68,2). The number of samples does not have anything to do with the convolution, one sample is given to the layer at each time anyway.

What changes is the number of spatial dimensions of your input that is convolved:

• With Conv1D, one dimension only is used, so the convolution operates on the first axis (size 68).
• With Conv2D, two dimensions are used, so the convolution operates on the two axis defining the data (size (68,2))

Therefore you have to carefully chose the filter size. For instance, if you chose a Conv2D with a filter size (4,2), it will produce the same results as a Conv1D with size (4) as it will operate fully on the second axis of data.

Finally, there is no response to what is the best method. Generally, Conv2D work well on images and Conv1D on text. Given the size of your second dimension of data, Conv2D does not seem to make a lot of sense hence Conv1D should work well.