---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-9-cc1db0739a8b> in <module>
----> 1 pred_df = predict(model, image_paths)
<ipython-input-8-c6b4e5cb344e> in predict(model, image_paths, window_size, device)
10 img = img.reshape(-1,z,y,x)
11 for i in range(len(img)):
---> 12 output = sliding_window_inference(img[i][None,None], window_size, 1, model.cuda(), overlap=0.2, sw_device=device, device='cpu', mode='gaussian')
13 output = model.tensor_to_dict(output)
14 p_si = sliding_window_inference(output['logits'], window_size, 1, post_proc, overlap=0.2, sw_device=device, device='cpu', mode='gaussian')
~/anaconda3/envs/decode2_dev/lib/python3.7/site-packages/monai/inferers/utils.py in sliding_window_inference(inputs, roi_size, sw_batch_size, predictor, overlap, mode, sigma_scale, padding_mode, cval, sw_device, device, *args, **kwargs)
128 ]
129 window_data = torch.cat([inputs[win_slice] for win_slice in unravel_slice]).to(sw_device)
--> 130 seg_prob = predictor(window_data, *args, **kwargs).to(device) # batched patch segmentation
131
132 if not _initialized: # init. buffer at the first iteration
~/anaconda3/envs/decode2_dev/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
725 result = self._slow_forward(*input, **kwargs)
726 else:
--> 727 result = self.forward(*input, **kwargs)
728 for hook in itertools.chain(
729 _global_forward_hooks.values(),
~/Dropbox (mackelab)/Artur/WorkDB/deepstorm/decode_fish/decode_fish/engine/model.py in forward(self, x)
511
512 def forward(self, x):
--> 513 out = self.unet(x)
514
515 logit = F.elu(self.p_out1(out))
~/anaconda3/envs/decode2_dev/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
725 result = self._slow_forward(*input, **kwargs)
726 else:
--> 727 result = self.forward(*input, **kwargs)
728 for hook in itertools.chain(
729 _global_forward_hooks.values(),
~/Dropbox (mackelab)/Artur/WorkDB/deepstorm/decode_fish/decode_fish/engine/model.py in forward(self, x)
444 # pass the output from the corresponding encoder and the output
445 # of the previous decoder
--> 446 x = decoder(encoder_features, x)
447
448 # x = self.final_conv(x)
~/anaconda3/envs/decode2_dev/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
725 result = self._slow_forward(*input, **kwargs)
726 else:
--> 727 result = self.forward(*input, **kwargs)
728 for hook in itertools.chain(
729 _global_forward_hooks.values(),
~/Dropbox (mackelab)/Artur/WorkDB/deepstorm/decode_fish/decode_fish/engine/model.py in forward(self, encoder_features, x)
246 def forward(self, encoder_features, x):
247 x = self.upsampling(encoder_features=encoder_features, x=x)
--> 248 x = self.joining(encoder_features, x)
249 x = self.basic_module(x)
250 return x
~/Dropbox (mackelab)/Artur/WorkDB/deepstorm/decode_fish/decode_fish/engine/model.py in _joining(encoder_features, x, concat)
253 def _joining(encoder_features, x, concat):
254 if concat:
--> 255 return torch.cat((encoder_features, x), dim=1)
256 else:
257 return encoder_features + x
RuntimeError: CUDA out of memory. Tried to allocate 3.00 GiB (GPU 0; 11.78 GiB total capacity; 3.28 GiB already allocated; 2.07 GiB free; 3.53 GiB reserved in total by PyTorch)