Can I put several different images as channels?

Viewed 846

Normally, we set input images 'height','width','channels'.

In 'channels', we set 1 for gray level pictures, and 3 for RGB pictures.

My question is, should it be the same picture using this channels? Like mentioned above.

Or I can set series of images to channels?

(e.g. I have 10 images discrete in space at one moment, so I set channels 10 as one input)

Will there be any problem and is it the right way to do?

Or I should just set 10 input for these 10 images?

Thanks for answering!

1 Answers

No, it won't be the same, because the number of channels of input layer determines the shape of convolutional filters, hence the number of parameters and how they are applied.

Compare these two convolutional networks:

  • [32x32x3] input shape, batch_size=5, 5x5 receptive field, then each neuron in the conv layer will have weights to a [5x5x3] region in the input volume, for a total of 5*5*3 = 75 weights (and +1 bias parameter).
  • [32x32x15] input shape, batch_size=1, same 5x5 receptive field, then each neuron will have weights to a [5x5x15] region, for a total of 5*5*15 = 325 weights (and the same +1 bias parameter).

In both cases, the two conv layers sees 15 RGB images, but the second network will use 5 times more parameters to learn the same data, while the first one will reuse the same parameters for different images. Also note that the second network will have dedicated parameters to each first image, each second image, etc.

Obviously, the first approach is better, not only because it saves the resources, it's also invariant to the order of training images in a batch.

Related