What is the use of 1D filter?

I have seen a tutorial on CNNs and it seems to me that 1D filters can not possibly be useful to detect edges etc as you’d see in the standard handwritten digit problem.

Is there any reason to use 1D filter instead of a matrix ?

CNNs for vision tasks typically use 2d kernels. I’ve not seen a model based on 1d kernels. Usually those get used in sequence data like audio or nlp tasks.

Suppose we have an image with:

[[1, 1, 1],
[0, 0, 1],
[0, 0, 1]]

And let’s suppose we convolve it with the following kernel with a stride of 1 and no padding:

[[1, 1],
[0, 1]]

The output will be:

[[2, 3],
[0, 2]]

The pixel where there is a 3 indicates a left facing right angle. In this way, kernels can detect edges. Hope that helps.

It might not be very useful when dealing with 2D array inputs like grayscale images, but it can be a useful tool for modelling with vector-based inputs over fully-connected networks.

For instance, if you have a vector-valued input where each item in the vector is indexed in time, a convolution in 1D over the input can act as a ‘smoother’ and recover moving averages, etc.