inverse transform error: expecting ints not tensors #2102
jpcenteno80
started this conversation in
General
Replies: 1 comment 3 replies
-
Sorry, I think the issue is that you are not supposed to invert items that have gone through a dataloader. I was trying to test the functionality by iterating through a dataloader and that is why I am getting tensors out. If I just iterate through a list of dictionaries with 'image' and 'label' in them, and pass them through the list of transforms wrapped in a |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am working with Monai version
0.5.dev2114
and I am trying to use inverse transforms to place a 3d segmentation back to its original space. I run into the following error which I think comes frommonai/transforms/croppad/array.py in __call__(self, img, mode)
, line 151:ValueError: self.spatial_border must contain only ints, got (tensor([72]), tensor([125]), tensor([104]), tensor([70]), tensor([95]), tensor([73])).
My transform looks like this:
Where keys = ['image', 'label', 'mask'] and there are also some other pre-processing functions to move around label values.
My output in
batch['label_transforms']
:I noticed in the
inverse_transforms_and_test_time_augmentations.ipynb
tutorial that one of the transforms has a parameteras_tensor_output=False
, and I wonder if this is a requirement for inverse transforms to work. The transform from that tutorial is below:If
as_tensor_output=False
is required, are there any negative effects with respect to processing speed in the remaining transformations?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions