How to determined out_channels

Hi I try to develop CNN and im not sure how to determine out_channels for conv2d:

torch.nn.Conv2d(in_channels, out_channel, kernel,stride,Padding)

I know in_channel depend on you use colour or Gray scale, kernel, stride and padding is try and error but how does out_channel come from ? is it just guess? for example

self.conv1 = ConvBlock(3, 64, 3, 2, 1)

how does 64 come from

1 Like

out_channels represents the number of output channels or feature maps. Usually they are chosen by intuition or empirically (there are guides on how to do that on other sites, e.g. link).

3 Likes