20.03.2021 Views

Deep-Learning-with-PyTorch

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Convolutions in action

201

0

output

0

input

5

5

10

10

15

15

20

20

25

25

30

0 5 10 15 20 25 30

30

0 5 10 15 20 25 30

Figure 8.4

Our bird, this time blurred thanks to a constant convolution kernel

Working out the weighted sum for an arbitrary pixel in position 2,2, as we did earlier

for the generic convolution kernel, we get

o22 = i13 - i11 +

i23 - i21 +

i33 - i31

which performs the difference of all pixels on the right of i22 minus the pixels on the

left of i22. If the kernel is applied on a vertical boundary between two adjacent regions

of different intensity, o22 will have a high value. If the kernel is applied on a region of

uniform intensity, o22 will be zero. It’s an edge-detection kernel: the kernel highlights the

vertical edge between two horizontally adjacent regions.

Applying the convolution kernel to our image, we see the result shown in figure

8.5. As expected, the convolution kernel enhances the vertical edges. We could build

0

output

0

input

5

5

10

10

15

15

20

20

25

25

30

0 5 10 15 20 25 30

30

0 5 10 15 20 25 30

Figure 8.5

Vertical edges throughout our bird, courtesy of a handcrafted convolution kernel

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!