agaldran / lwnet

State-of-the-art retinal vessel segmentation with minimalistic models
MIT License
73 stars 27 forks source link

Run time error when trying to predict #10

Open zs735 opened 2 months ago

zs735 commented 2 months ago

Hi Adrian Getting the following issue after training. Training was with 2040x2040 img, same size for mask. val_auc: 243.786961 val_dice: 0.379771 best_cycle: 45

Now, i tried to run this with same sized image. got the below error. Not sure

.....

File "d:\Dev\LWNET1\predict_images_test.py", line 322, in full_pred, full_pred_bin = create_pred(model, im_tens, mask, coords_crop, original_sz, bin_thresh=bin_thresh, tta=tta) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\Dev\LWNET1\predict_images_test.py", line 120, in create_pred logits = model(tens.unsqueeze(dim=0).to(device)).squeeze(dim=0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\Dev\LWNET1\models\get_model.py", line 16, in forward x1 = self.unet1(x) ^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\Dev\LWNET1\models\res_unet_adrian.py", line 123, in forward x = self.first(x) ^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\Dev\LWNET1\models\res_unet_adrian.py", line 35, in forward out = self.block(x) ^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\container.py", line 219, in forward input = module(input) ^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\conv.py", line 458, in forward return self._conv_forward(input, self.weight, self.bias) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Master\anaconda3\envs\lwnet\Lib\site-packages\torch\nn\modules\conv.py", line 454, in _conv_forward return F.conv2d(input, weight, bias, self.stride, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same