Skip to content

Fixes pad list data collate#4670

Merged
wyli merged 4 commits intoProject-MONAI:devfrom
wyli:fixes-pad-collate
Jul 12, 2022
Merged

Fixes pad list data collate#4670
wyli merged 4 commits intoProject-MONAI:devfrom
wyli:fixes-pad-collate

Conversation

@wyli
Copy link
Copy Markdown
Contributor

@wyli wyli commented Jul 11, 2022

Description

the current PadListDataCollate pushes to the applied operations twice, but it pops once in the inverse, this causes inconsistencies. This PR fixes this issue and adds more tests about PadListDataCollate and BatchInverseTransform

padder = SpatialPad(spatial_size=max_shape, method=self.method, mode=self.mode, **self.kwargs)
for idx, batch_i in enumerate(batch):
orig_size = batch_i[key_or_idx].shape[1:]
padded = padder(batch_i[key_or_idx])
batch = replace_element(padded, batch, idx, key_or_idx)
# If we have a dictionary of data, append to list
if is_list_of_dicts:
self.push_transform(batch[idx], key_or_idx, orig_size=orig_size)

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • 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 --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

wyli added 2 commits July 11, 2022 11:22
Signed-off-by: Wenqi Li <[email protected]>
Signed-off-by: Wenqi Li <[email protected]>
@wyli wyli requested review from Nic-Ma, ericspod and rijobro July 11, 2022 11:53
@wyli
Copy link
Copy Markdown
Contributor Author

wyli commented Jul 11, 2022

/black

@wyli
Copy link
Copy Markdown
Contributor Author

wyli commented Jul 12, 2022

could you please help review? @Nic-Ma

Copy link
Copy Markdown
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Looks good to me, put minor comments inline.

Thanks.

@wyli wyli force-pushed the fixes-pad-collate branch from 36416bf to 76b6ae4 Compare July 12, 2022 08:16
@wyli
Copy link
Copy Markdown
Contributor Author

wyli commented Jul 12, 2022

/build

@wyli wyli enabled auto-merge (squash) July 12, 2022 09:27
@wyli wyli merged commit 51753ab into Project-MONAI:dev Jul 12, 2022
@wyli wyli deleted the fixes-pad-collate branch July 19, 2022 21:28
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