Replies: 3 comments 2 replies
-
@wyli can you find any possible reason from the error message? Thanks. |
Beta Was this translation helpful? Give feedback.
-
this is a use case that is currently not directly supported by sliding_window_inference. perhaps after training, you could try to convert the classification model into a fully convolutional one |
Beta Was this translation helpful? Give feedback.
-
One possibility is to do tiling yourself. Here is an example: |
Beta Was this translation helpful? Give feedback.
-
Hello,
We are working on using densenet121 model for training a classifier on 3D MRI images. We are using RandCropByPosNegLabel random crop (images/mask) for the purpose of training. However for testing, we wanted to use sliding window inference so as to cover the entire MRI image to find the region of interest.
When I am trying to use sliding_window_inference, I am getting following error
sw_batch_size=4 print(test_images.shape) test_outputs = sliding_window_inference(test_images, (96,96,96), sw_batch_size, model)
torch.Size([1, 1, 512, 504, 157])
~/monai_code/MONAI/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)
140 # store the result in the proper location of the full output. Apply weights from importance map.
141 for idx, original_idx in zip(slice_range, unravel_slice):
--> 142 output_image[original_idx] += importance_map * seg_prob[idx - slice_g]
143 count_map[original_idx] += importance_map
144
RuntimeError: The size of tensor a (96) must match the size of tensor b (2) at non-singleton dimension 2
Beta Was this translation helpful? Give feedback.
All reactions