Arranging the parameters of ConvNN

Hi, I’m confused and lost in convNN parameters
some example code that i forked before:

nn.Conv2d(3, 6, 3)
pool = nn.MaxPool2d(2, 2) 
conv2 = nn.Conv2d(6, 16, 3)

What determines the change of the numbers ?
First 3 is our channels and 6 our filters and the last 3 is 3x3 filter size as i remembered but i couldn’t understand the math behind that how to determine the (6,16,3) for the second conv layer after maxPooling layer.

thanks for your help.

In conv2

  • 6 -> refers to the number of in_channels, after first conv your output had 6 out_channels, so they become input in conv2
  • 16 -> refers to the number of out_channels. It can be any number. It is your choice. You can set it to 100, 10 anything.
  • 3 -> kernel_size again is your choice. But kernel_size value 2 and 3 are common, so don’t need to experiment much
1 Like