i notice that we could get our desired output_channel.
for example:
if i have rgb image so in_channel will be 3 and i could create output channel 15. what happen during this process to get 15 output channel from 3 channel? do we randomize weight in kernel to get 15 channel?
The number of output channels corresponds to the number of convolution filters/kernels you want this layer to have. You should maybe read some tutorials on how convolutions work to get what I mean by kernel, maybe this one could be helpful.
Here is a little snippet to get a better grasp on how it works in PyTorch:
import torch
batch = torch.rand(16, 3, 100, 100) # N, C, H, W
conv = torch.nn.Conv2d(
in_channels=3, # RGB channels
out_channels=7, # Number of kernels
kernel_size=5, # Size of kernels, i. e. of size 5x5
stride=1,
padding=2)
print(conv.weight.size()) # 7 x 5 x 5 x 3 (7 kernels of size 5x5 having 3 of depth)
print(conv(batch).size())
The feature maps of each kernel are concatenated in the second dimension to for a (16, 7, 100, 100) Tensor, this is how you “increase” the number of channels.