I will be really thankful to those who can explain me this. I know the formula for calculation but after some iterations, I haven’t got to the answer yet.
The formula for output neuron:
Output = ((I-K+2P)/S + 1), where
I - a size of input neuron,
K - kernel size,
P - padding,
S - stride.
Input tensor shape:
torch.Size([36, 200, 150, 3])
I have the following model:
class Flatten(torch.nn.Module):
def forward(self, x):
return x.view(x.size()[0], -1)
model = torch.nn.Sequential(
torch.nn.Conv2d(32, 64, kernel_size=(3, 3)),
torch.nn.ReLU(),
torch.nn.Conv2d(64, 128, kernel_size=(3, 3)),
torch.nn.ReLU(),
torch.nn.MaxPool2d(kernel_size=(2, 2)),
torch.nn.Dropout(0.25),
Flatten(),
torch.nn.Linear(128, 128),
torch.nn.ReLU(),
torch.nn.Linear(128, 2),
torch.nn.Softmax()
)
I can’t calculate the number of neurons in Linear layer.
Could you kindly help and explain me the calculations of Linear input neuron size behind this network?