Skip to content

Conversation

@rijobro
Copy link
Contributor

@rijobro rijobro commented Mar 19, 2021

Addresses #1795 (comment).

part of #1515

Description

Create transform that in the forward direction takes a batch of data and centrally pads any tensors to the maximum size of each dimension of all images in the batch.

The inverse acts on a dictionary containing the data for 1 dataset.

I find the asymmetry between the forward and inverse a little ugly, but I can't really see any other way about it. The only reason we need the whole batch in the forward direction is so that we can find out the required padding size. However, in the inverse direction, we want to deal with them individually so that we can take advantage of multiprocessing.

I should note that the asymmetry is mostly hidden from the user who wouldn't call this directly. Instead, they would pass the forward as the collate_fn for a DataLoader, and then the inverse would be called automatically when doing batch inversion.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro requested a review from wyli March 19, 2021 18:47
Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@wyli wyli merged commit 3e313d2 into Project-MONAI:master Mar 19, 2021
@rijobro rijobro deleted the pad_collation_transform branch March 19, 2021 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants