question about the input img size
yuzehui1996 opened this issue · 8 comments
hey! I am confused with the input size of the training data. I train a dataset which input size is (3,112,112), should I have to make some changes to the model?
This model is made for CIFAR, which is (3, 32, 32), so the last avg pooling operation will not coincide for bigger input. You can just change it for .mean(-1).mean(-1). It will do the same as average pooling but without complaining about the image size.
I can't get the point you say. Could you please explian it?
x = self.conv_1_3x3.forward(x)
x = F.relu(self.bn_1.forward(x), inplace=True)
x = self.stage_1.forward(x)
x = self.stage_2.forward(x)
x = self.stage_3.forward(x)
x = F.avg_pool2d(x, 8, 1)
x = x.view(-1, self.stages[3])
return self.classifier(x)
Do you mean the 'F.avg_pool2d(x,8,1)' ???
Yes! Just change it by x.mean(3).mean(2)
I replace the avg_pool with 'x=x.mean(-1).mean(-1)', but it doesn't work. Did I misunderstand your suggestion? BTW, the error shows that "cuda out of memory", and it shows the error in the stage_1.forward.
Well, that's another matter. Can you try with batch_size = 1?
It sill doesn't work!
the error is :
ValueError: Expected input batch_size (441) to match target batch_size (1).
And I resize the img to (3,32,32) and it works.
If you do:
model(image)
where image is of size (1, 3, 112, 112), it should work.