Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Pad model outputs if they are smaller than the inputs #681

Merged
merged 5 commits into from
Mar 9, 2022

Conversation

fepegar
Copy link
Contributor

@fepegar fepegar commented Mar 3, 2022

When patches are sampled from a volume, the bounding box of the patch is saved so the inferred results can be aggregated into the original position. This requires that the sampled patch and the one that will be aggregated be of the same size.

After this pull request is merged, the model outputs will be padded so they have the same shape as the sampled patches. If we merge this into #677, the CI errors should be fixed.

@fepegar fepegar changed the title Pad patches if they are smaller than input to aggregator Pad model outputs if they are smaller than the inputs Mar 3, 2022
@fepegar fepegar marked this pull request as draft March 3, 2022 15:03
Update CHANGELOG

Fix linting errors

Ignore mypy error

Fix linting error
@fepegar fepegar force-pushed the 677-pad-patches-if-small branch from d750bf6 to 71ffa9d Compare March 3, 2022 15:27
@fepegar fepegar marked this pull request as ready for review March 3, 2022 15:48
@fepegar fepegar marked this pull request as draft March 3, 2022 17:05
@fepegar fepegar marked this pull request as ready for review March 3, 2022 17:41
@fepegar fepegar requested a review from javier-alvarez March 7, 2022 09:56
@fepegar fepegar requested a review from ant0nsc March 7, 2022 11:34
ant0nsc
ant0nsc previously approved these changes Mar 8, 2022
Copy link
Contributor

@ant0nsc ant0nsc left a comment

Choose a reason for hiding this comment

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

Change looks good - but when are we running into that problem? If it's easily doable, can there be a test for that?

@fepegar
Copy link
Contributor Author

fepegar commented Mar 8, 2022

when are we running into that problem?

When the output of a model is smaller than the input. For example, when padding is not used in a U-Net (as in the original implementation):

U-Net

can there be a test for that?

I think there's already one (with a typo in the name):

@pytest.mark.parametrize("shrink_by", [(0, 0, 0), (1, 1, 1), (1, 0, 1)])
def test_inference_shrink_y(shrink_by: Any,
test_output_dirs: OutputFolderForTests) -> None:
inference_identity(shrink_by=shrink_by,
test_output_dirs=test_output_dirs)

I don't know why the test is passing on Azure pipelines... It fails on the main branch on my machine.

@fepegar fepegar requested a review from Shruthi42 March 9, 2022 09:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants