2
$\begingroup$

While reading about 1D-convolution in PyTorch, I encountered the concept of channels

in_channels (int) – Number of channels in the input image

out_channels (int) – Number of channels produced by the convolution

Although I encountered this concept of channels early, I am confused about channels and might understand them in the wrong manner.

Since the operation we are discussing is 1D convolution, then there will be two lists of numbers, one is the input list and the other is the filter list. The last one is the feature map (output list).

They look like below

1-D convolution

The left one is the input list, the middle one is the filter list and the rightmost is the output list.

Each cell in the input list contains a whole number. Each cell may take value in the fixed range $[a,b]$ of numbers.

What is the concept of channels used here? From where the channels are coming? Is the number of channels stand for the number of elements in the corresponding list?

$\endgroup$
1

2 Answers 2

1
$\begingroup$

Channels can be thought of as alternate numbers in the same space.

As an example, the three colour channels of a typical image are often values for amount of red, green or blue light received from each position within the picture.

Your 1D convolution example has one input channel and one output channel. Depending on what the input represents, you might have additional input channels representing other values measured in the same input space. For all but the most simple problems, you will have multiple output channels. The number of channels in each layer may vary, similarly to how the size of hidden layers in a fully connected neural network can vary.

The term "feature map" means the same as channel, and is typically used to describe the outputs of hidden layers.

To map from N input channels to M output channels requires $N \times M$ filters. Each of the M outputs is connected by a filter to each of the N inputs, and the results of running those N convolutions is summed and passed through a nonlinear activation function to generate an output channel.

Although in the abstract, a channel is a type of dimension, channels are considered as entirely separate to the space which is being processed. So adding channels to your 1D example does not make it a 2D convolutional neural network.

$\endgroup$
1
  • 2
    $\begingroup$ In NLP, the channels are the word vector (embedding) dimensions. $\endgroup$
    – hobs
    May 30, 2022 at 11:50
0
$\begingroup$

A common use case for 1d-convolution is to analyse & interpret time series data. Imagine a single sensor that generates a sequence of readings such as [1 2 3 4 2].

That is equivalent to a single channel.

However its also possible to have multiple sensors generating readings, such as

[ 1 2 3 2 4]
[ 2 3 4 1 2]
[ 3 4 5 1 2]

This would be equivalent to 3 channels of time series data that's consumed by a 1d convolution.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .