Training a classifier Tutotrial

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(3, 6, 5)
        self.pool = nn.MaxPool2d(2, 2)
        self.conv2 = nn.Conv2d(6, 16, 5)
        self.fc1 = nn.Linear(16 * 5 * 5, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 10)

Can someone explain to me what the 3,6,5 numbers at the first and the seconds convolution layer mean?

The Documentation for nn.Conv2d suggests that:

  • In the first nn.Conv2d, 3 is the number of input channels, 6 is the number of output channels and 5 in the length of the kernel, assuming a square kernel. So your kernel is a [5,5] box.
  • In the second nn.Conv2d, 6 is the number of input channels, 16 is the number of output channels and 5 is the size of the kernel.

More information available here: link

1 Like