Support of testing for any size image
rose-jinyang opened this issue · 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.
There is no limit to the image size in the demo.py
.
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
same problem. did you find any solution?
thanks
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