mobilenetv3-segmentation icon indicating copy to clipboard operation
mobilenetv3-segmentation copied to clipboard

RuntimeError: Given input size: (576x48x48). Calculated output size: (576x0x0). Output size is too small

Open kukby opened this issue 4 years ago • 5 comments

Hello Think for your job. When I use your code i meet a question: Traceback (most recent call last): File "train.py", line 288, in trainer.train() File "train.py", line 182, in train outputs = self.model(images) File "/home/kukby/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/home/kukby/mobilenetv3-segmentation-master/core/model/segmentation.py", line 23, in forward x = self.head(c4) File "/home/kukby/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/home/kukby/mobilenetv3-segmentation-master/core/model/segmentation.py", line 42, in forward x = self.lr_aspp(x) File "/home/kukby/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/home/kukby/mobilenetv3-segmentation-master/core/model/segmentation.py", line 67, in forward feat2 = self.b1(x) File "/home/kukby/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/home/kukby/.local/lib/python3.6/site-packages/torch/nn/modules/container.py", line 100, in forward input = module(input) File "/home/kukby/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, **kwargs) File "/home/kukby/.local/lib/python3.6/site-packages/torch/nn/modules/pooling.py", line 554, in forward self.padding, self.ceil_mode, self.count_include_pad, self.divisor_override) RuntimeError: Given input size: (576x48x48). Calculated output size: (576x0x0). Output size is too small

kukby avatar Jun 03 '20 09:06 kukby

@kukby You can check the Lite R-ASPP module in your training code. The origin LRASPP in the project is defined with fixed parameters for the standard mobilenet-v3 processing and you should change the size params to adapt your training input size.

Aitical avatar Aug 28 '20 07:08 Aitical

I was able to fix this by using AdaptiveAvgPooling instead of AvgPool in the LRASPP implementation.

dscarmo avatar May 27 '21 21:05 dscarmo