Fast-SCNN-pytorch icon indicating copy to clipboard operation
Fast-SCNN-pytorch copied to clipboard

Support of testing for any size image

Open rose-jinyang opened this issue 5 years ago • 5 comments

Hello How are you? Thanks for contributing this project. It seems that the script demo.py can not process any size of image. Could u revise the script so that it can process any size of image? Thanks.

rose-jinyang avatar Sep 02 '20 12:09 rose-jinyang

There is no limit to the image size in the demo.py.

Tramac avatar Sep 02 '20 12:09 Tramac

Hi I used the size 875x583 of image. Please check this issue.

Traceback (most recent call last): File "E:/Jin/Internet_Task/Jobs/2020/2020.08.31-U2_Net/Fast-SCNN-pytorch-master/demo.py", line 57, in demo() File "E:/Jin/Internet_Task/Jobs/2020/2020.08.31-U2_Net/Fast-SCNN-pytorch-master/demo.py", line 49, in demo outputs = model(image) File "C:\Users\admin\Anaconda3\envs\py37_tf2.x\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, **kwargs) File "E:\Jin\Internet_Task\Jobs\2020\2020.08.31-U2_Net\Fast-SCNN-pytorch-master\models\fast_scnn.py", line 37, in forward x = self.feature_fusion(higher_res_features, x) File "C:\Users\admin\Anaconda3\envs\py37_tf2.x\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, **kwargs) File "E:\Jin\Internet_Task\Jobs\2020\2020.08.31-U2_Net\Fast-SCNN-pytorch-master\models\fast_scnn.py", line 213, in forward out = higher_res_feature + lower_res_feature RuntimeError: The size of tensor a (110) must match the size of tensor b (112) at non-singleton dimension 3

Thanks

rose-jinyang avatar Sep 02 '20 13:09 rose-jinyang

Hi I did padding so that the width and height of image can be multiples of 32. So the issue disappeared but the result is not normal. This is the padded input image. 1

That is the output image. Esha-gupta

How can I understand this? Thanks

rose-jinyang avatar Sep 02 '20 14:09 rose-jinyang

same problem. did you find any solution? thanks

milad-4274 avatar Dec 12 '20 11:12 milad-4274

There was no such problem during the first training. The same data set for the second training is reported as follows:

Traceback (most recent call last): File "/home/lyl/000_Code/Fast-SCNN/train.py", line 200, in <module> trainer.train() File "/home/lyl/000_Code/Fast-SCNN/train.py", line 127, in train for i, (images, targets) in enumerate(self.train_loader): File "/home/lyl/anaconda3/envs/fastscnn1.0/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 615, in __next__ batch = self.collate_fn([self.dataset[i] for i in indices]) File "/home/lyl/anaconda3/envs/fastscnn1.0/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 615, in <listcomp> batch = self.collate_fn([self.dataset[i] for i in indices]) File "/home/lyl/000_Code/Fast-SCNN/data_loader/cityscapes.py", line 93, in __getitem__ img, mask = self._sync_transform(img, mask) File "/home/lyl/000_Code/Fast-SCNN/data_loader/cityscapes.py", line 141, in _sync_transform img = img.resize((ow, oh), Image.BILINEAR) File "/home/lyl/anaconda3/envs/fastscnn1.0/lib/python3.6/site-packages/PIL/Image.py", line 1923, in resize return self._new(self.im.resize(size, resample, box)) ValueError: height and width must be > 0

Linda-L avatar Dec 13 '20 08:12 Linda-L