22.02.2024 Views

Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

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

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

"Honestly, I am a bit confused with channels and filters … are they

the same or not?! How about kernels?"

This is a bit confusing indeed—let’s try to organize our thoughts about filters,

kernels, and channels.

This is what we have seen so far:

1. Every filter has as many channels as the image it is convolving (input).

2. Each channel of the filter / kernel is a small square matrix (that is being

convolved over the corresponding input channel).

3. A convolution produces as many channels as there are filters (output).

For example, we may have an RGB image as input (three channels) and use two

filters (each having three channels of its own to match the input (1)) to produce

two channels as output (3).

But things can get very messy if we start using "filter" to designate other things:

• Each channel of a filter / kernel is often referred to as a "filter" itself.

• Each channel of the output produced by convolving the filter over the input

image is often referred to as a "filter" too.

In the example, we would then have six "filters" (instead of two filters with three

channels each), and we would produce two "filters" as output (instead of two

channels). This is confusing!

We’re avoiding these messy definitions here, so we’re using channel

concatenation (or even better, stacking) instead of the confusing "filter

concatenation."

Having cleared that up, we can return to the Inception module itself. As we’ve seen,

the regular version simply stacks the output channels of convolutions with

different filter / kernel sizes. What about the other version?

It also does that, but the Inception module with dimension-reduction layers uses

1x1 convolutions to:

• reduce the number of input channels for both 3x3 and 5x5 convolution

branches; and

528 | Chapter 7: Transfer Learning

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

Saved successfully!

Ooh no, something went wrong!