pytorch-semseg
pytorch-semseg copied to clipboard
unet error with (1,3,256,256) input
I'm try to input a tensor with the size of (1, 3, 256, 256)
, after many conv2d and maxpool, the centre feature size is (1, 256, 8, 8)
, and the covn4 is (1, 128, 24, 24)
, after up_layer, the feature size is (1, 128, 12, 12)
, and after up is (1,64,24,24)
, but the conv3 is (1, 64, 57, 57)
, and if this size goes with cropping, it will be (1,64,23,23)
, which is different from (1,64,24,24)
, and makes an error.
Do you solve this problem? Can you share yourself config file with Unet
Same Problem
Do you solve this problem? I have the same problem.
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 24 and 23 in dimension 2 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71
Do you solve this problem? I have the same problem.
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 24 and 23 in dimension 2 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71
Are you applying unet to a square input or rectangular? I had to alter the model to work for validating on rectangular input
Do you solve this problem? I have the same problem. RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 24 and 23 in dimension 2 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71
Are you applying unet to a square input or rectangular? I had to alter the model to work for validating on rectangular input
My image size is (256,256,3), its a square input
def forward(self, inputs1, inputs2):
outputs2 = self.up(inputs2)
offset1 = outputs2.size()[2] - inputs1.size()[2]
offset2 = inputs1.size()[2] - outputs2.size()[2]
padding = 2 * [offset1//2, -(offset2//2)]
outputs1 = F.pad(inputs1, padding)
return self.conv(torch.cat([outputs1, outputs2], 1))
I changed the calculation method of padding. It seems that this problem has been solved.
Thanks @flyking1994, +1 here for Cityscapes datasets gtFine_trainvaltest.zip and leftImg8bit_trainvaltest.zip, cropped and resized to (224, 224). Will try a run later with the original size of (2048, 1024)