Can demo be run on different sizes of images?
Closed this issue · 2 comments
I've been trying to run the eval/eval_cityscape_color.py for a demoSequence for different sizes and I'm getting an error. Only 1024 x 2048 works. Is there anyway to run for different sizes?
File "/datadrive/pytorch/erfnet/erfnet_pytorch/eval/erfnet.py", line 21, in forward
output = torch.cat([self.conv(input), self.pool(input)], 1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 170 and 171 in dimension 3 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:87
Hi @chichilicious, It should work alright by just changing the values in the "Resize" functions in the input and target transforms. I've uploaded an update in the file to specify the interpolation types (it needs to be bilinear for input and nearest for target):
input_transform_cityscapes = Compose([ Resize((512,1024),Image.BILINEAR), ToTensor(), #Normalize([.485, .456, .406], [.229, .224, .225]), ]) target_transform_cityscapes = Compose([ Resize((512,1024),Image.NEAREST), ToLabel(), Relabel(255, 19), #ignore label to 19 ])
Hi @Eromera it works fine. Thank you!