Edge Detector Filter

The 3x3 vertical edge detector introduced in lecture looks like this:

1 0 -1
1 0 -1
1 0 -1

If the goal is to detect vertical edges, what’s the purpose of the column of zeros in the middle? Why not use a filter like this:

1 -1
1 -1
1 -1

It seems like this filter would do a better job detecting a vertical edge.

There has to be a color transition to detect the edges. The column of zeros provides just that. The transition in brightness will lead to the edges being detected.

Did you try that to see what kind of values it generates compared to the example that Prof Ng showed in the lectures?

Also note that your proposed filter is not square. I don’t think anything fundamentally requires filters to have the same vertical and horizontal dimensions, but every example of a Conv Layer I’ve ever seen in these courses has filters that are square and whose dimensions are odd numbers. Prof Ng does comment in the lectures in Week 1 about even sized filters being a bit awkward, but I forget exactly where he discusses that.

1 Like