<p>I have a problem in which my input data may have a varying number of channels. Let me explain with an example.</p>
<blockquote>
<p>Imagine we have a classification problem in which we wish to identify
if certain species are present in wildlife photographs. This can be
done via a neural network including maybe some convolutions. For the
first layer of the network we could set up a convolutional layer with
3 input channels (one for R, G and B respectively) and this would
probably work well enough.</p>
<p>Now imagine that someone comes along with some new data for us and
this time they have not only taken regular RGB images but they have
used an IR-camera as well. Great, but how do we treat this data, we
have one more channel?! One could of course simply add an extra channel
and re-train the network but that would mean that our old data (without
IR-info) is useless and what if someone comes along with a
UV-camera.....</p>
</blockquote>
<p>My situation is similar but I will most definitely be dealing with varying numbers of channels and the range can be quite wide (from 5 channels all the way up to maybe 50). Is there a good way of dealing with a situation like this?</p>

CC BY-SA 4.0
2021-03-03T12:11:28.743Z
A naive way will be to 0-pad all the training samples to fit the maximum number of channels.
razvanc92
CC BY-SA 4.0
2021-03-03T12:44:35.957Z
@DuttaA Do you care to expand on that? I've never heard of meta learning and learning with privileged information before.
Ivar Eriksson
CC BY-SA 4.0
2021-03-04T02:32:52.777Z
Given the enormous range of the number of channels per input, I would suggest treating each channel as a step in a time series. So create some kind of RNN with convolutions throughout that accepts a channel of the input. That way it will be able to deal with varying input sizes and still give valid predictions.
Recessive
<convolutional-neural-networks><data-preprocessing>
How to deal with a variable number of channels of the inputs?
Ivar Eriksson
# How to deal with a variable number of channels of the inputs?

(Asked by: username_0 on 2021-03-03)

I have a problem in which my input data may have a varying number of channels. Let me explain with an example.

> Imagine we have a classification problem in which we wish to identify
> if certain species are present in wildlife photographs. This can be
> done via a neural network including maybe some convolutions. For the
> first layer of the network we could set up a convolutional layer with
> 3 input channels (one for R, G and B respectively) and this would
> probably work well enough.
>
> Now imagine that someone comes along with some new data for us and
> this time they have not only taken regular RGB images but they have
> used an IR-camera as well. Great, but how do we treat this data, we
> have one more channel?! One could of course simply add an extra channel
> and re-train the network but that would mean that our old data (without
> IR-info) is useless and what if someone comes along with a
> UV-camera.....

My situation is similar but I will most definitely be dealing with varying numbers of channels and the range can be quite wide (from 5 channels all the way up to maybe 50). Is there a good way of dealing with a situation like this?

**Tags:** convolutional-neural-networks, data-preprocessing

> **Comments:**
> **username_1**: A naive way will be to 0-pad all the training samples to fit the maximum number of channels.  
> **username_0**: @DuttaA Do you care to expand on that? I've never heard of meta learning and learning with privileged information before.  
> **username_2**: Given the enormous range of the number of channels per input, I would suggest treating each channel as a step in a time series. So create some kind of RNN with convolutions throughout that accepts a channel of the input. That way it will be able to deal with varying input sizes and still give valid predictions.  

---

## 0 answers

