Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Issue was coming from the definition of SpatialPad (self.ldm_resizer)… #449

Conversation

virginiafdez
Copy link
Contributor

… and Crop (self.autoencoder_resizer). The spatial_size passed included a [-1] to cover the channel dimension. The code, as it was written, made the assumption that this channel dimension was a spatial dimension and that the batch dimension was the channel one, leading to errors related to the affine transform of the MetaTensor being wrong. self.ldm_resizer should operate on an unbatched version of the tensor, hence we changed the call to the resizers by one that uses decollate and then stacks the elements of the batch together again.

… and Crop (self.autoencoder_resizer). The spatial_size passed included a [-1] to cover the channel dimension. The code, as it was written, made the assumption that this channel dimension was a spatial dimension and that the batch dimension was the channel one, leading to errors related to the affine transform of the MetaTensor being wrong. self.ldm_resizer should operate on an unbatched version of the tensor, hence we changed the call to the resizers by one that uses decollate and then stacks the elements of the batch together again.
@virginiafdez
Copy link
Contributor Author

@ericspod I have changed this to not wrongly assume that the batch is the channel, as was done before - this is what I understood from the MONAI Core discussion (Project-MONAI/MONAI#7323). This makes more sense and seems to work fine.

@marksgraham marksgraham merged commit a3762b9 into main Dec 20, 2023
@marksgraham marksgraham deleted the 447-spatialpad-on-the-inferer-when-the-to-pad-shape-is-the-same-as-the-tensor branch December 20, 2023 14:03
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpatialPad on the inferer when the to-pad shape is the same as the tensor
2 participants