likyoo / change_detection.pytorch

Deep learning models for change detection of remote sensing images
MIT License
331 stars 59 forks source link

当你的输入图片不是32的倍数时,调用Unet和Unet++会报错。 #25

Open yuxin7 opened 1 year ago

yuxin7 commented 1 year ago

warnings.warn("pyprof will be removed by the end of June, 2022", FutureWarning) Traceback (most recent call last): File "D:/WorkSpace/PythonWorkSpace/change_detection/test.py", line 60, in y_pred = model(img1, img2) File "D:\Software\Anconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detection_pytorch\base\model.py", line 35, in forward return self.base_forward(x1, x2) File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detection_pytorch\base\model.py", line 20, in base_forward decoder_output = self.decoder(features) File "D:\Software\Anconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detectionpytorch\unetplusplus\decoder.py", line 137, in forward output = self.blocks[f'x{depthidx}{depth_idx}'](features[depth_idx], features[depth_idx+1]) File "D:\Software\Anconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detection_pytorch\unetplusplus\decoder.py", line 39, in forward x = torch.cat([x, skip], dim=1) RuntimeError: Sizes of tensors must match except in dimension 2. Got 49 and 50 (The offending index is 0) RuntimeError: Sizes of tensors must match except in dimension 2. Got 49 and 50 (The offending index is 0)

xuxiansheng2018 commented 10 months ago

请问你解决了吗?